Microsoft DirectX 8.1 (Visual Basic)

Fog Parameters

Fog parameters are controlled through device render states. Both pixel and vertex fog types support all the fog formulas introduced in Fog Formulas. The CONST_D3DFOGMODE enumeration defines constants that you can use to identify the fog formula you want Microsoft® Direct3D® to use. The D3DRS_FOGTABLEMODE render state controls the fog mode that Direct3D uses for pixel fog, and the D3DRS_FOGVERTEXMODE render state controls the mode for vertex fog.

Fog type Fog start/end units
Pixel (Z) Device space [0.0,1.0]
Pixel (W) Camera space
Vertex Camera space

The D3DRS_FOGDENSITY render state controls the fog density applied when an exponential fog formula is enabled. Fog density is essentially a weighting factor, ranging from 0.0 to 1.0 (inclusive), that scales the distance value in the exponent.

The color that the system uses for fog blending is controlled through the D3DRS_FOGCOLOR device render state. Use the D3DColorXRGB function to generate valid values for this render state. For more information, see Fog Color and Fog Blending.