Blender Compositor Atmospheric Haze with Depth Map

This guide explains how to configure a custom depth map in Blender and use the Compositor to create realistic atmospheric haze or fog. By extracting depth data through either a normalized Z-Depth pass or a Mist pass, you can isolate distant geometry and blend in atmospheric colors, giving your 3D scenes a stronger sense of scale, depth, and environmental realism without increasing render times.

Step 1: Enable the Depth or Mist Pass

Blender provides two primary ways to capture depth: the standard Z-Depth pass and the Mist pass. The Mist pass is generally preferred for haze because it allows you to control the start, depth, and falloff directly in the 3D viewport.

  1. Open the View Layer Properties tab in the Properties editor.
  2. Expand the Passes panel, then expand the Data subpanel.
  3. Check the box for Mist (or Z if you prefer raw depth data).

Step 2: Configure the Mist Pass Distance

If using the Mist pass, configure its range to match the scale of your scene:

  1. Select your active Camera, go to the Camera Properties tab, expand the Viewport Display panel, and check Mist. This displays a line in the viewport indicating the mist's start and end points.
  2. Go to the World Properties tab and expand the Mist Pass panel.
  3. Set the Start value to where the haze should begin relative to the camera.
  4. Set the Depth value to the distance where the haze reaches full opacity.
  5. Select a Falloff curve (e.g., Quadratic or Linear) to control how the density ramps up over distance.

Step 3: Set Up the Compositor Nodes

Once your pass is configured and the image is rendered, switch to the Compositing workspace:

  1. Enable the Use Nodes checkbox at the top of the Compositor.
  2. Locate the Render Layers node, which now contains a Mist (or Depth) output socket.
  3. Add a Mix Color node (Shift + A > Color > Mix Color) and set its blend mode to Mix.
  4. Connect the Image output of the Render Layers node to the A input of the Mix Color node.
  5. Choose a haze color (such as a pale blue, warm gray, or ambient sky tone) for the B input.
  6. Connect the Mist output of the Render Layers node directly into the Factor input of the Mix Color node.
  7. Connect the output of the Mix Color node to the Composite node.

Step 4: Fine-Tune the Effect (Using Map Range or Color Ramp)

To gain precise control over the density and distribution of the haze within the compositor:

  1. Insert a Map Range or Color Ramp node between the Mist (or Depth) output and the Factor input of the Mix Color node.
  2. If using raw Z-Depth, a Map Range node is required: set the From Min to your near distance and From Max to your far distance, remapping them to 0.0 and 1.0.
  3. Adjust the sliders on the Color Ramp or the values on the Map Range node to compress or expand the haze gradient across your scene.