Fog Color

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

The following C++ example sets the fog color to white.

/* For this example, the d3dDevice variable is
* a valid pointer to an IDirect3DDevice9 interface.
*/
HRESULT hr;
hr = d3dDevice->SetRenderState(
                    D3DRS_FOGCOLOR,
                    0x00FFFFFF); // Highest 8 bits are not used.
if(FAILED(hr))
    return hr;

Fog is applied differently by the fixed function pipeline and the programmable pipeline.

  1. If the driver supports D3DPMISCCAPS_FOGANDSPECULARALPHA:
  2. If the driver does NOT support D3DPMISCCAPS_FOGANDSPECULARALPHA:

For more information, see D3DPMISCCAPS.