fogver(3G)fogver(3G)NAMEfogver - specify atmospheric fogging effects
FORTRAN SPECIFICATION
subroutine fogver(mode, params)
integer*4 mode
real params()PARAMETERS
mode expects one of eight valid symbolic constants:
FGVE: FGPE: interpret params as a specification for fog
density and color. These modes are suited to simulate heavy
fog.
FGVE2: FGPE2: interpret params as a specification for fog
density and color. These modes are suited to simulate distant
haze.
FGVL: FGPL: 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 depthc:
FGON: enable the previously defined fog calculation.
FGOFF: disable fog calculations. (default)
params Expects an array of floats containing value settings. For FGVE,
FGPE, FGVE2, and FGPE2 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 FGVL and FGPL 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
DESCRIPTION
The effects of fog on shading are simulated by blending computed object
colors into the specified fog color. shadem is ignored during fogging.
Calculation of the blend factor for:
FGVE:
Page 1
fogver(3G)fogver(3G)
fog = e ** (5.5*density*Zeye)
fog is computed at each vertex of the primitive
FGPE:
fog = e ** (5.5*density*Zeye)
fog is computed at each pixel of the primitive
FGVE2:
fog = e ** (-5.5*(density*Zeye) ** 2)
fog is computed at each vertex of the primitive
FGPE2:
fog = e ** (-5.5*(density*Zeye) ** 2)
fog is computed at each pixel of the primitive
FGVL:
fog = (end_fog + Zeye)/(end_fog - start_fog)
fog is computed at each vertex of the primitive
FGPL:
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:
Page 2
fogver(3G)fogver(3G)
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
vertices 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
gRGBco, 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
systems do not support the per pixel fog modes, FGPE, FGPE2, and FGPL,
while the VGXT and SkyWriter support all fog options. Use getgde to
determine whether fog support is available.
Fog only works for mmode(MVIEWING).
For FGPE, FGPE2, and FGPL, 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 lsetde range.
The results of fog calculations are defined only while in RGB mode.
Page 3