fogvertex(3G) fogvertex(3G)
fogvertex - specify atmospheric fogging effects
void fogvertex(long mode, float params[])
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.
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
Page 1
fogvertex(3G) fogvertex(3G)
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.
Page 2
fogvertex(3G) fogvertex(3G)
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.
gRGBcolor, mmode
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, 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.
PPPPaaaaggggeeee 3333 [ Back ]
|