There are two ways to add fog to a scene: with pixel fog and/or vertex fog. The following topics illustrate the formulas used in fog equations, as well as implementing vertex and pixel fog. An application can implement fog with a vertex shader, and pixel fog simultaneously if desired.
Fog blending is controlled by render states; it is not part of the programmable pixel pipeline.