Get 30+ hr of DaVinci Resolve courses & 200+ pre-made assets

As little as $15/month for all courses and pre-made assets

Disparity To Z Node

Disparity To Z takes a 3D camera and an image containing a disparity channel as inputs, and outputs the same image but with a newly computed Z channel.

Optionally, this node can output Z into the RGB channels. Ideally, either a stereo Camera 3D or a tracked stereo camera is connected into Disparity To Z. However, if no camera is connected, the node provides artistic controls for determining a Z channel. The depth created by this node can be used for post effects like fogging or depth of field (DoF).

The Z values produced become more incorrect the larger (negative) they get. The reason is that disparity approaches a constant value as Z approaches -infinity. So Z = -1000 and Z = -10000 and Z = -100000 may map to D=142. 4563 and D=142. 4712 and D=142. 4713. As you can see, there is only 0.0001 in D to distinguish between 10,000 and 100,000 in Z. The maps produced by disparity are not accurate enough to make distinctions like this.

Disparity To Z Node Inputs

The three inputs on the Disparity To Z node are used to connect the left and right images and a camera node.

  • Left Input: The orange input is used to connect either the left eye image or the stack image.
  • Right Input: The green input is used to connect the right eye image. This input is available only when the Stack Mode menu is set to Separate.
  • Stereo Camera: The magenta input is used to connect a stereo camera node.

Disparity To Z Node Outputs

Unlike most nodes in Fusion, Disparity To Z has two outputs for the left and right eye.

  • Left Output: This holds the left eye image with a new Z channel, or a Stacked Mode image with a new disparity channel.
  • Right Output: This holds the right eye image with a new Z channel. This output is visible only if Stack Mode is set to Separate.

Disparity To Z Node Setup

Disparity To Z takes a 3D camera and stereo images containing a disparity channel as inputs. The output is an image with a newly computed Z channel.

Disparity To Z Node Controls Tab

In addition to outputting Z values in the Z channel, this tab promotes the color channels to float32 and outputs the Z values into the color channels as {z, z, z, 1}. This option is useful to get a quick look at the Z channel.

Output Z to RGB
Rather than keeping the Z values within the associated aux channel only, they will be copied into the RGB channels for further modification with any of Fusion’s nodes.

Refine Z
The Enable checkbox refines the depth map based upon the RGB channels. The refinement causes edges in the flow to align more closely with edges in the color channels. The downside is that unwanted details in the color channels start to show up in the flow. You may want to experiment with using this option to soften out harsh edges for Z-channel post effects like depth of field or fogging.

HiQ Only
Activating this checkbox causes the Refine Z option to process only when rendering is set to High Quality. You can ensure High Quality is enabled by right-clicking to the left or right of the transport controls in the main toolbar.

Increasing this slider does two things. It smooths out the depth in constant color regions and moves edges in the Z channel to correlate with edges in the RGB channels. Increasing the refinement has the undesirable effect of causing texture in the color channel to show up in the Z channel. You will want to find a balance between the two.

This is the radius of the smoothing algorithm.

Stack Mode
This menu determines how the input images are stacked.

When set to Separate, the Right Input and Output will appear, and separate left and right images must be connected.

Swap Eyes
Enabling this checkbox causes left and right images to be swapped.

Disparity To Z Node Camera Tab

If you need correct real-world Z values because you are trying to match some effect to an existing scene, you should use the External Camera options to get precise Z values back. If any Z-buffer will suffice and you are not that particular about the exact details of how it is offset and scaled, or if there is no camera available, the Artistic option might be helpful.

  • External Mode: An input is available on the node to connect an existing stereo Camera 3D. This can either be a single stereo Camera 3D (i.e., its eye separation is set to non-zero), or a pair of (tracked) Camera 3Ds connected via the Camera 3D > Stereo > Right Camera input.
  • Artistic Mode: If you do not have a camera, you can adjust these controls to produce an “artistic” Z channel whose values will not be physically correct but will still be useful. To reconstruct the Disparity > Z Curve, pick (D, Z) values for a point in the foreground and a point in the background.

Foreground Disparity (Pick from Left Eye)
When the camera Mode is set to Artistic, a Foreground Disparity slider is available. This is the disparity for the closest foreground object. It will get mapped to the depth value specified by the Foreground Depth control. Any objects with disparity outside of the range [ForegroundDisparity, BackgroundDisparity] will have their disparity values clipped to this range leading to flat areas in the Z channel, so make sure that you pick values that enclose the actual disparity range.

Background Disparity (Pick from Left Eye)
When the camera Mode is set to Artistic, a Background Disparity is available. This is the disparity for the furthest background object. It will get mapped to the depth value specified by the Background Depth control. One way to think of this input is as the upper limit to disparity values for objects at -infinity. This value should be for the left eye. The corresponding value in the right eye will be the same in magnitude but negative.

Foreground Depth
This is the depth to which Foreground Disparity will be mapped. Think of this as the depth of the nearest object. Note that values here are positive depth.

Background Depth
This is the depth to which Background Disparity will be mapped. Think of this as the depth of the most distant object.

Falloff controls the shape of the depth curve between the requested foreground and background depths. When set to Hyperbolic, the disparity-depth curve behaves roughly like depth = constant/ disparity. When set to Linear, the curve behaves like depth = constant * disparity. Hyperbolic tends to emphasize Z features in the foreground, while linear gives foreground/background features in the Z channel equal weighting.

Unless there’s a specific reason, choose Hyperbolic, as it is more physically accurate, while Linear does not correspond to nature and is purely for artistic effect.

Disparity To Z Node Settings Tab

The Settings tab in the Inspector is also duplicated in other Stereo nodes. These common controls are described in detail HERE.


About the Author

Justin Robinson is a Certified DaVinci Resolve, Fusion & Fairlight instructor who is known for simplifying concepts and techniques for anyone looking to learn any aspect of the video post-production workflow. Justin is the founder of JayAreTV, a training and premade asset website offering affordable and accessible video post-production education. You can follow Justin on Twitter at @JayAreTV YouTube at JayAreTV or Facebook at MrJayAreTV

Get 30+ hr of DaVinci Resolve courses & 200+ pre-made assets

As little as $15/month for all courses and pre-made assets

Similar Posts

Leave a Reply

Your email address will not be published.