Fog


Fog artificially adds color to every pixel based on the distance the ray has traveled. Fog does not interact with light beams and so is generally faster than using atmospheric media.


There are two different types of fog:

Constant Fog (type 1 - default)

In the simplest form, fog is specified by a distance and color:

fog {
    distance 200
    color rgb<0.3, 0.5, 0.2>
}

where the distance value determines the distance at which 36.8% of the background are still visible. Note, you can also use rgbt and rgbf.

You can also add turbulence, making it look like it has a non-constant density:

fog {
    distance 150
    color rgbf<0.3, 0.5, 0.2, 1.0>
    turbulence 0.2
    turb_depth 0.3
} 

The turb_depth value is used to move the point at which the turbulence value is calculated along the viewing ray. Values near zero move the point to the viewer while values near one move it to the intersection point (the default value is 0.5).

Ground Fog (type 2)

Ground fog is specified as follows:

The following uses a ground fog which has a constant density below y=25 and quickly falls off for increasing altitudes.

fog {
    distance 150
    color rgbf<0.3, 0.5, 0.2, 1.0>
    fog_type 2
    fog_offset 25
    fog_alt 1
}

This can also be used to create multiple layers of fog (see tutorial).

Examples of Constant Fog with Varying Distance:

see: POV-Ray Code.

No Fog

Fog with distance = 200

Fog with distance = 150

Fog with distance = 50

Examples of Ground Fog with Distance 150 and Varying Offset and Altitude

see: POV-Ray Code.

Offset = 10, Alt = 10, Distance = 150

Offset = 10, Alt = 30, Distance = 150

Offset = 30, Alt = 10, Distance = 150