Fog Color

Fog color for both pixel and vertex fog is set through the D3DRENDERSTATE_FOGCOLOR render state. The render state values can be any RGB color, specified as an RGBA color (the alpha component is ignored).

The following example sets the fog color to white:

/* For this example, the g_lpD3DDevice variable is
 * a valid pointer to an IDirect3DDevice3 interface.
 */
HRESULT hr;
 
hr = pd3dDevice->SetRenderState(
                    D3DRENDERSTATE_FOGCOLOR,
                    0x00FFFFFF); // Highest 8 bits aren't used.
 
if(FAILED(hr))
    return hr;