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.
- Open the View Layer Properties tab in the Properties editor.
- Expand the Passes panel, then expand the Data subpanel.
- 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:
- 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.
- Go to the World Properties tab and expand the Mist Pass panel.
- Set the Start value to where the haze should begin relative to the camera.
- Set the Depth value to the distance where the haze reaches full opacity.
- 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:
- Enable the Use Nodes checkbox at the top of the Compositor.
- Locate the Render Layers node, which now contains a Mist (or Depth) output socket.
- Add a Mix Color node (Shift + A > Color > Mix Color) and set its blend mode to Mix.
- Connect the Image output of the Render Layers node to the A input of the Mix Color node.
- Choose a haze color (such as a pale blue, warm gray, or ambient sky tone) for the B input.
- Connect the Mist output of the Render Layers node directly into the Factor input of the Mix Color node.
- 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:
- Insert a Map Range or Color Ramp node between the Mist (or Depth) output and the Factor input of the Mix Color node.
- 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.
- 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.