Vertex Fog Parameters

Vertex fog parameters related to the chosen fog formula are controlled by setting specific device lighting states (not render states) with the IDirect3DDevice3::SetLightState method. Currently, the only supported formula for vertex fog is the linear formula, which you can choose by setting the D3DLIGHTSTATE_FOGMODE lighting state to D3DFOG_LINEAR. Set the starting and ending distances for linear fog through the D3DLIGHTSTATE_FOGSTART and D3DLIGHTSTATE_FOGEND lighting states. All distances are in world space.

Note  Although exponential fog formulas are not currently supported for vertex fog, the D3DLIGHTSTATETYPE enumerated type used with the SetLightState method contains a D3DLIGHTSTATE_FOGDENSITY member. This member is not currently used, and is included to allow for future expansion.

The color that the system uses for fog blending is controlled through the D3DRENDERSTATE_FOGCOLOR device render state. For more information, see Fog Color and Fog Blending.

Applications that perform their own transformation and lighting must also perform their own vertex fog calculations, and as such they probably wouldn't use light states at all. As a result, such an application need only enable fog blending and set the fog color through the associated render states, as described in Fog Blending and Fog Color.