Fog Blending

Fog blending refers to the application of the fog factor to the fog and object colors to produce the final color that appears in a scene, as discussed in the Fog Formulas topic. The D3DRENDERSTATE_FOGENABLE render state controls fog blending. Set this render state to TRUE to enable fog blending (the default is FALSE), as in the following example code:

//
// For this example, g_lpDevice is a valid pointer
// to an IDirect3DDevice3 interface.
HRESULT hr;
hr = g_lpDevice->SetRenderState(
                     D3DRENDERSTATE_FOGENABLE,
                     TRUE);
if FAILED(hr)
    return hr;
 

You must enable fog blending for both pixel fog and vertex fog. For information about using these types of fog, see Pixel Fog and Vertex Fog.