Fog

From DmWiki

This article is a stub. You can help improve the article by expanding it.

In computer graphics, fog is used to add realism to a scene and help the viewer visualize how far an object is. It is also used to smooth out the culling process of an object when it goes out of the camera frustum. Without any fog effect, if a large object leaves the far clip plane of the camera frustum, the object would instantly disappear due to clipping. A fog effect that is set up such that the fog thickens as an object goes further away from the viewer can fix this issue, which can make it visually more realistic. Usually, fog is fully implemented in hardware (i.e. hardware-accelerated), which means it can be used with almost no additional cost.

Fog is implemented by blending the color of objects in a scene by a fog color. The fog color is based on the depth of the object (distance from the object to the camera/viewpoint). As an object goes further away from the viewer, its original color increasingly blends with the specified fog color, which creates the visual effect that the object is becoming obscured by particles in the air. Fog can be implemented at the vertex level or the pixel level, called vertex fog and pixel fog respectively.

The Mathematics of Fog

TODO: Add and discuss formulas for linear fog, exponential fog, etc.

Vertex Fog

Pixel Fog


DevMaster navigation