Nodes/comfyui-sunflower-nodes/Disparity to Depth View
ComfyUI Node

Disparity to Depth View

The bridge from a disparity map to real 3D geometry

By andygill·Created 2 years ago·Updated 6 months ago· 1
Disparity to Depth View
  • disparity
  • DEPTH_VIEW
  • NORMALS
  • MASK
near2.00
far5.00
field_of_view65
tilt0

If you're coming from stereo 3D - VR captures, side-by-side frames, generated stereo pairs - you've met disparity: the horizontal offset between what the left and right eye see, where closer things shift more. Disparity is inverse depth, which makes it awkward to work with directly. This node is the pack's entry ramp: it converts a disparity map into the DEPTH_VIEW type the rest of the pack renders, and hands you a normal map and a mask along the way.

Mechanically it's the classic stereo math. Turning disparity into depth needs a near and a far plane to map those relative values onto actual distances - that's what near (default 2) and far (default 5) do, in scene units. field_of_view (default 65) and tilt (default 0) define the camera geometry used to derive the normal map from the depth gradient. Feed in a disparity map as a MASK, and out the other side you get the geometry.

The inputs are just those four: disparity, near, far, field_of_view, tilt. The outputs are where it gets interesting:

  • DEPTH_VIEW - the custom type that wires straight into DepthViewToIsometric for rendering.
  • NORMALS - surface orientation, feed it into the same render node as optional shading.
  • MASK - the source disparity as a mask, handy for downstream filtering.

This node is an output node, so you can preview all three straight off it and see what you're working with before you render anything. That's a genuinely useful workflow: disparity in, eyeball the depth and normals, then decide whether the geometry is worth rendering.

Why bother? This is how the pack turns stereo-ish input into renderable shape. In the wider ComfyUI ecosystem it sits right next to the depth-estimation side of things - Depth Anything and friends produce depth maps; this is the 3D-visualization direction, where depth becomes something you can look at and rotate instead of a flat gray image. If your goal is parallax, VR, or bas-relief output, you need a step like this somewhere in the chain.

Two gotchas worth knowing. Polarity first: a disparity map can encode white = near or white = far depending on where it came from, and nothing tells you which. If your rendered geometry is a hole where a hill should be, the polarity is inverted - flip the mask, or swap near and far, and it rights itself. Second: near and far are real distances, not slider theater. A 2-to-5-unit span assumes a specific disparity encoding; widen the gap too far and everything flattens into a featureless slab.

Install via ComfyUI Manager (search comfyui-sunflower-nodes) and restart, or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/andygill/comfyui-sunflower-nodes

Then restart ComfyUI. No models, no weights, no pip installs - it's numpy/torch math through and through. Fair warning: the repo has been quiet since spring 2025 and is currently unreachable on GitHub, so if the clone 404s, grab an archived copy and drop it in custom_nodes the same way.

Categoryimage/transform

Inputs (5)

NameTypeDefaultDescription
disparityMASK
nearFLOAT2.000–100
farFLOAT5.001–1000
field_of_viewFLOAT6530–150
tiltFLOAT0-90–90

Outputs (3)

NameTypeDescription
DEPTH_VIEWDEPTH_VIEW
NORMALSNORMALS
MASKMASK