Create Stereoscopic Image From Depth (Experimental)
Turn an image plus a depth map into a 3D/VR frame
- input_image
- depth_map
- IMAGE
This one's a proper novelty in the best sense: give it a flat image and a depth map, and it builds a stereoscopic pair - a left-eye and right-eye view - so the picture reads as 3D on a VR headset or a 3D display. It offsets pixels horizontally based on how far each part of the scene is from the camera, which is exactly the classic technique for faking stereo from a single 2D image. The node's display name flags it as "(Experimental)," so treat it as a fun capability with rough edges rather than a polished pipeline.
Depth maps are one of those quietly powerful things in the Stable Diffusion world - a grayscale image where brightness encodes distance (white close, black far). One of their documented uses is precisely this: split a single image into left- and right-eye views by using the depth map to offset pixels. That's the whole mechanism here, wrapped in a node.
How it works
You feed in the original input_image and a depth_map of the same scene. The node shifts pixels sideways in proportion to their depth - near things move more, far things move less - to synthesize the two eye views, then packs them into a single output frame in your chosen layout. max_disparity sets how far the eyes diverge, which is effectively the strength of the 3D effect. mode picks the layout (side-by-side or over-under), and swap_images flips which eye is which.
The inputs and outputs
input_image(IMAGE) - the flat source picture.depth_map(IMAGE) - a depth map of that same image. You generate this upstream with a depth estimator (Depth Anything, MiDaS, or a depth ControlNet preprocessor).max_disparity(default 1000) - how far the eye views separate; the 3D-strength dial.mode(side-by-side (SBS)/over-under (OU)) - the stereo layout, chosen to match your viewer.swap_images(default false) - swaps left/right, to fix reversed depth.IMAGEoutput - the single stereoscopic frame.
How to install it
Via ComfyUI Manager: Install Custom Nodes, search "JNodes", install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/JaredTherriault/ComfyUI-JNodes
pip install -r ComfyUI-JNodes/requirements.txt
then restart ComfyUI. The node itself downloads nothing - but you'll need a depth-estimation node/model in your graph to produce the depth_map, and that model is a download.
Common issues & troubleshooting
You need a depth map first - the node doesn't make one. The most common stumble: there's no built-in depth estimation here. Run your image through a depth model (Depth Anything is the modern go-to, MiDaS the old standby) and feed its grayscale output into depth_map. Garbage depth in, broken stereo out - the quality of the 3D is only as good as the depth map.
Crank max_disparity too high and your eyes will hate you. Big disparity means big pixel offsets, which past a point stops reading as depth and starts reading as a headache. Start conservative and raise it until the 3D pops without straining. There's no universal number; it depends on the image and your display.
Expect artifacts at depth edges - it's experimental. Shifting pixels apart opens gaps (occlusions) where there's no data to fill, so hard depth boundaries can smear or tear. The node doesn't inpaint those holes. That's inherent to single-image stereo, and doubly so for an experimental implementation.
SBS vs OU has to match your player, and check swap_images. If the 3D looks flat, inverted, or pushes into the screen instead of out, either your viewer expects the other layout or the eyes are reversed. Try the other mode, and toggle swap_images.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| input_image | IMAGE | — | |
| depth_map | IMAGE | — | |
| max_disparity | INT | 1000 | — |
| mode | COMBO | 2 options: side-by-side (SBS), over-under (OU) | |
| swap_images | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |