Overview
Disparity to Z applies the geometric relationship between disparity and depth: the larger the disparity, the closer the object. The exact conversion requires the parameters of the stereo rig: the distance between the eyes (interocular), the convergence point and the focal length.
Output: a scalar Z-depth you can use like any other Z (Depth Blur, Fog, Volume Mask, etc.). It gives you 3D-aware effects on live action stereo footage without producing the Z by other means.
Where to find this node
- Effects Library:
Tools > Stereo > Disparity to Z - Quick add: right-click in the Node Editor →
Add Tool > Stereo > Disparity to Z
The disparity → Z formula
In epipolar geometry (parallel cameras), the relationship is:
- Z = (B × f) / d
- Z = depth (camera → object distance), B = baseline (interocular, the distance between the cameras), f = focal length, d = disparity in pixels.
- Consequence
- At a constant disparity, raising B or f increases the perceived depth. With B and f fixed, high disparities correspond to low Z values (close objects).
- Convergence
- The distance at which the optical axes cross. Defines the "screen plane": disparity = 0 on that plane, negative in front of it, positive behind it.
Inputs
- Disparity (orange) - an image containing the disparity map (output of a Disparity node).
- Effect Mask (blue) - optional.
Setup
Stereo → Z-depth workflow:
LeftCam ─┐
├── Disparity → Disparity to Z (real camera params)
RightCam ┘ ↓
Z-depth map → Depth Blur, Fog, etc.
Stereo depth of field in post:
LeftCam ─┐
├── Disparity → Disparity to Z
RightCam ┘ ↓
┌──────────── Depth Blur (Focus distance, Aperture)
└── Beauty L → DOF applied based on Z
↓ MediaOut
Volume Fog on stereo footage:
LeftCam ─┐
├── Disparity → Disparity to Z → World (with camera params)
RightCam ┘ ↓
Volume Fog
↓ MediaOutControls tab
- Interocular (default: 6.5 cm)
- Distance between the two cameras (= baseline B). 6.5 cm is the average distance between human eyes. For specific rigs, measure it physically.
- Convergence (default: 0)
- Distance of the convergence plane (where disparity = 0). Defines the screen plane. Get this value from the rig metadata or the shooting notes.
- Focal Length (default: 35 mm)
- The optical focal length in mm. Critical for precision: a mismatch distorts every Z value. Read it from the EXIF data or the camera notes.
- Sensor Size X / Y (defaults: 35 mm × 24 mm)
- Sensor dimensions. Together with the focal length, they determine the effective angle of view. Full frame = 35×24, Super 35 = 24.89×18.66, etc.
- Output Mode (default: Distance)
- Distance = Euclidean distance, Linear Depth = linear Z component. Choose based on the downstream nodes (Volume Fog prefers Distance, Depth Blur prefers Linear depending on the convention).
Use cases
- DOF in post-production on stereo - fully in-focus stereo footage, add controllable bokeh in post with a Z map derived from the disparity.
- Volume Fog on live action stereo - a 3D-aware atmosphere on real footage shot on a stereo rig.
- 3D compositing in a stereo plate - a Z map to position and correctly occlude added 3D elements.
- Color grading by depth - different grading depending on distance (warm close-ups, cool distance) using the derived Z.
- Generating mattes by depth - a matte of the background or the foreground by thresholding the Z map.
- Clean plate / background removal - combine the Z map + roto to isolate the subjects from the distant background.
Tips
- Exact camera parameters - Interocular, Convergence and Focal Length must match the real shooting values. Otherwise, the Z is distorted. Get them from the rig's spec sheet.
- Check the visualization - the visualized Z output should show a clean gradient from near (bright) to far (dark), or the reverse depending on the convention.
- A clean disparity is essential - artifacts in the disparity map carry over into the Z. Clean up the disparity (suitable Smoothness) before this conversion.
- 32-bit float is mandatory - Z values go far beyond 0-1. In 8/16-bit you lose all precision.
- Convergence = the screen plane - pixels with a disparity of 0 in the source = at the convergence plane in the output. So their Z = the Convergence value of the node.
- Sensor Size for anamorphic - be careful with anamorphic shoots: adapt the Sensor Size to the non-standard ratio, or desqueeze before Disparity.
- For workflows with no camera information, make rough visual estimates, then adjust by comparing against an object of known depth in the viewer.
