Creating Depth Fading with a Volume Shader

 
 
 

Depth fading, sometimes called fog or atmospherics, adds an element of realism to a scene by creating a sense of depth by adding a layer of ambient-like color (usually black or gray) in relation to an object's distance from the camera. You can create depth fading in a scene by applying a volume shader.

Below, the scene is without depth fading (top image), and with a depth fading effect (bottom image). The fade color is set to black with no transparency. Notice how the spheres appear to be less visible over distance.

To create depth-fading with a volume shader

  1. Select the pass to which you will apply the depth-fading effect and open its Render Pass Property Editor.

  2. Click the Pass Shaders tab.

  3. In the Volume stack window, click Add to open the browser at the Volume folder, and select the Fog shader.

  4. Click OK and the Volume_Fog shader is added to the shader stack.

  5. Select the Volume_Fog shader in the Volume stack window and click Inspect. This opens the shader's property editor, where you can define the Start and End distances, as well as the fog color and transparency.

    For more information on how to use this particular volume shader, click the help icon in the shader's property editor.