Re: FogRange

New Message Reply Date view Thread view Subject view Author view

Michael Jones (mtj++at++babar)
Wed, 26 Oct 1994 11:19:57 -0700


On Oct 26, 10:31am, maytorre++at++NMSU.Edu wrote:
> Subject: FogRange

:Does any one know the units of pfFogRange for their opaque (far fog) range.

It's in "database units". Your channel near-clip and far-clip ranges
are in these units as well. Might be angstroms or astronomical units
or whatever else you prefer.

:Or what is their relationship to meters? We have tried making the
:following relationship but it does not appear to be correct.

The fog parameters map directly into gl (and soon, OpenGL) fog
parameters. Here's the IrisGL "fogvertex" man page, with which
IRIS Performer fog is implemented:

fogvertex(3G) fogvertex(3G)

NAME
     fogvertex - specify atmospheric fogging effects

C SPECIFICATION
     void fogvertex(long mode, float params[])

PARAMETERS
     mode expects one of eight valid symbolic constants:

              FG_VTX_EXP: FG_PIX_EXP: interpret params as a specification
              for fog density and color. These modes are suited to simulate
              heavy fog.

              FG_VTX_EXP2: FG_PIX_EXP2: interpret params as a specification
              for fog density and color. These modes are suited to simulate
              distant haze.

              FG_VTX_LIN: FG_PIX_LIN: interpret params as a specification
              for eye space distance to start of fog, eye space distance at
              which fully fogged, and fog color. These modes can be used as a
              more versatile alternative to depthcue:

              FG_ON: enable the previously defined fog calculation.

              FG_OFF: disable fog calculations. (default)

     params Expects an array of floats containing value settings. For
              FG_VTX_EXP, FG_PIX_EXP, FG_VTX_EXP2, and FG_PIX_EXP2 four floats
              are expected. They are density, red, green, and blue. density
              specifies the (thickness) of the fog (or haze). A value of 0.0
              results in no fog. Increasing positive values result in fog of
              increasing density. Values are normalized such that a density
              of 1.0 results in the fog becoming completely opaque at a
              distance of 1.0 in eye-coordinates. For FG_VTX_LIN and
              FG_PIX_LIN five floats are expected. They are eye space
              distance to start of fog, eye space distance at which fog is
              completely opaque, red, green, and blue. The colors are
              specified in the range 0.0 through 1.0. The specified contents
              of params are insignificant when mode is FG_ON, or FG_OFF.

DESCRIPTION
     The effects of fog on shading are simulated by blending computed object
     colors into the specified fog color. shademodel is ignored during
     fogging.

     Calculation of the blend factor for:

     FG_VTX_EXP:

        fog = e ** (5.5*density*Zeye)
        fog is computed at each vertex of the primitive

     FG_PIX_EXP:

        fog = e ** (5.5*density*Zeye)
        fog is computed at each pixel of the primitive

     FG_VTX_EXP2:

        fog = e ** (-5.5*(density*Zeye) ** 2)
        fog is computed at each vertex of the primitive

     FG_PIX_EXP2:

        fog = e ** (-5.5*(density*Zeye) ** 2)
        fog is computed at each pixel of the primitive

     FG_VTX_LIN:

        fog = (end_fog + Zeye)/(end_fog - start_fog)
        fog is computed at each vertex of the primitive

     FG_PIX_LIN:

        fog = (end_fog + Zeye)/(end_fog - start_fog)
        fog is computed at each pixel of the primitive

     Where:

     Zeye is the Z coordinate in eye space (always negative).

     density is the fog density.

     fog is the computed fog blending factor, ranging from 0 to 1.

     start_fog is the eye-space distance at which fog effect begins.

     end_fog is the eye-space distance at which fog is opaque.

     The pixel color/fog color blend is done with the following equation:

        C = Cp*fog + Cf*(1.0-fog)

     Where:

     fog is the computed fog blending factor, ranging from 0 to 1.

     C is the resulting color component (red, green, or blue).

     Cp is the incoming pixel color, already either Gouraud or flat shaded,
           and textured.

     Cf is the fog color component as specified by the fog definition

     Eye-coordinates exist between ModelView transformation and Projection
     transformation (see mmode). This space is right-handed, so visible ver-
     tices always have negative Z coordinates. Thus the fog equation always
     raises e to a negative power.

     In all cases (including ortho) the viewer is considered to be at location
     0,0,0, looking down the negative z axis.

SEE ALSO
     gRGBcolor, mmode

NOTES
     IRIS-4D G, GT, GTX, and the Personal Iris models do not support any fog
     options. IRIS Entry, Indy, XL, XS, XS24, XZ, Elan, Extreme, and VGX sys-
     tems do not support the per pixel fog modes, FG_PIX_EXP, FG_PIX_EXP2, and
     FG_PIX_LIN, while the VGXT and SkyWriter support all fog options. Use
     getgdesc(GD_FOGVERTEX) to determine whether fog support is available.

     Fog only works for mmode(MVIEWING).

     For FG_PIX_EXP, FG_PIX_EXP2, and FG_PIX_LIN, to maximize the accuracy of
     the fog, minimize the ratio of the distance to the far clipping plane
     over the distance to the near clipping plane. In addition, maximize the
     lsetdepth range.

     The results of fog calculations are defined only while in RGB mode.

: exp^(-density*5.5*MaxRange(in meters) <= 1/255
:
: density = 3.912 / (Visibility (km) *5500)
:
: thus
:
: Opaque Range = Visibility (km.) * 5500.0 /3.912 (meters)
:
: That is we give a visibility and compute the opaque range value assuming
:that performer's opaque range is in meters.

1.0 in eye coordinates is equivalent to the channel far-clip distance
in world space.

-- 

Be seeing you, Phone:415.390.1455 Fax:415.390.2658 M/S:8U-590 Michael T. Jones Silicon Graphics, Advanced Graphics Division mtj++at++sgi.com 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:37 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.