Table of contents
Collapse the table of content
Expand the table of content

Clamping Fog Intensity Per Pixel

Last Updated: 2/14/2017

A DirectX 9.0 version driver for a device that supports either pixel or vertex shader version 2.0 and later must indicate that its device supports clamping the fog intensity value on a per-pixel basis by setting the D3DPMISCCAPS_FOGINFVF capability bit. This informs users that the device does not save the fog factor in the specular alpha channel when using software vertex shaders. The device can pass the alpha channel of the specular color (computed in the fixed function vertex pipeline) to the pixel processing unit, instead of always overwriting the alpha channel with the per-vertex fog intensity value.

Because the driver clamps the fog intensity value on a per-pixel basis, the runtime for DirectX 9.0 and later no longer clamps the fog intensity value before sending it to the driver.

The driver determines how to obtain the fog value by verifying if the D3DFVF_FOG bit in the flexible vertex format (FVF) is set. If D3DFVF_FOG is set, the driver obtains the separate fog value that is passed per vertex. If D3DFVF_FOG is not set and the driver must use fog, the driver obtains the fog value from the specular color's alpha channel.

When the driver sets D3DPMISCCAPS_FOGINFVF, the runtime in turn sets the D3DPMISCCAPS_FOGANDSPECULARALPHA capability bit in the PrimitiveMiscCaps member of the D3DCAPS9 structure.

Send comments about this topic to Microsoft

© 2017 Microsoft