Nodes/SideBySide_Stereoscope/πŸ‘€ SBS V2.1 (External Depth)
ComfyUI Node

πŸ‘€ SBS V2.1 (External Depth)

The SS Stereoscope node that skips the model

By SamSeenXΒ·Created 2 years agoΒ·Updated 4 months agoΒ· 61
πŸ‘€ SBS V2.1 (External Depth)
  • base_image
  • depth_map
  • stereoscopic_image
  • gap_mask
β—„depth_scale5.0β–Ί
β—„blur_radius3β–Ί
β—„invert_depthfalseβ–Ί
β—„modeCross-eyedβ–Ί
β—„gap_fill_modeInpaint (Telea)β–Ί
β—„stereo_layoutSide by Sideβ–Ί
β—„highsodium_optimizationtrueβ–Ί

Most 2D-to-3D tools are a black box: image in, hidden depth estimate, side-by-side out. This node is the one where you own the depth map. The "External Depth" variant of the SBS V2 node in the SideBySide_Stereoscope pack skips the built-in Depth Anything pass entirely - you hand it a base_image and a depth_map, and it does nothing but the stereoscopic warping. That's both a feature and a responsibility.

Why you'd reach for it

The depth map is the 3D effect - it decides how far every pixel shifts between the left and right eye. Letting the node generate it internally is convenient, but it also means accepting whatever model it picked, at whatever cost. Here you pick the source: Depth Anything V2 Large if you want the quality/speed sweet spot, Marigold for weird illustrative input, DepthCrafter for video (Depth Anything on video flickers frame-to-frame, which is a known failure mode), or a map you edited by hand in an image editor. For batch work it's also a straight win - no per-frame depth pass burning GPU time, no model download on first run.

How it works

Bright pixels in the depth map are treated as close, so they shift further between the eyes. One eye keeps the original pixels, the other gets the shifted ones - which eye shifts is what mode controls. The V2.1 release remapped depth_scale to be resolution-relative: 0–100 maps to 0–20% of the image width, so scale 10 is about 2% separation, scale 100 is a 20% max shift. That's a deliberate guard against output-breaking values - push parallax too far and the image tears.

The real trick is the newest one: gap filling. Shifting one eye exposes areas the original camera never saw (disocclusion gaps), and gap_fill_mode decides what happens to them. The default Inpaint (Telea) runs OpenCV's fast inpainting to smooth them over; Stretch is the old smear-the-last-pixel behavior that streaks; None leaves black holes and hands you the gap_mask output so you can inpaint the gaps with a real KSampler pass instead of a guess.

The inputs that matter

Most of these you can leave alone, but four you'll actually touch:

  • depth_map - grayscale, brighter is closer. If you feed it an RGB image the node just uses the first channel, and it auto-resizes to match base_image (NEAREST, so resolution mismatch isn't a problem).
  • depth_scale (0.1–100, default 5) - the intensity of the 3D effect. Start low and creep up.
  • invert_depth - flip this if the effect looks inside-out. Depth models argue about polarity constantly, and "needs inverting" is the pack's own documented experience.
  • mode - Cross-eyed vs Parallel. For freeviewing without a headset you want cross-eyed; for a VR headset or 3D display you want parallel.
  • stereo_layout - Side by Side (default) or Top Bottom; over-under is the layout Quest/Meta headsets are happiest with.
  • highsodium_optimization - on by default. It's the vectorized rewrite (a community PR, roughly 4x faster) and produces slightly different output than legacy; keep it on.

Outputs

Two of them: stereoscopic_image (the finished SBS image, ready to view or wire into the pack's Video Combiner) and gap_mask - a MASK that's white exactly where the shift left holes. That mask is the advanced-workflow unlock: it's the input for generative inpainting if Telea's smooth fill isn't good enough.

Install

Same as the rest of the pack - there's no separate install for this node:

cd ComfyUI/custom_nodes
git clone https://github.com/SamSeenX/ComfyUI_SSStereoscope.git
pip install -r ComfyUI_SSStereoscope/requirements.txt
# restart ComfyUI

Or just search "SideBySide_Stereoscope" in ComfyUI Manager. The good news: this node never downloads a model, because it bypasses Depth Anything entirely. The less-good news: installing the pack pulls in its whole dependency list (torchvision, transformers, timm, opencv-python, scipy, imageio…), all shared with the pack's other nodes.

Where people get burned

  • Inside-out depth - the image looks concave. Flip invert_depth, don't fight it.
  • Streaking at high scale - the parallax limit. depth_scale beyond ~50% of its range starts tearing; back it off.
  • Black holes you didn't ask for - you set gap_fill_mode to "None" and forgot. Either flip it back to Telea or run the gap_mask through an inpainting pass.
  • Soft output - remember depth is being resized with NEAREST; feed the node a depth map at a reasonable resolution rather than expecting it to upscale detail for you.

It's the node I'd reach for in this pack: all the stereo machinery, none of the pack's opinion about how depth should be computed.

CategoryπŸ‘€ SamSeen

Inputs (9)

NameTypeDefaultDescription
base_imageIMAGEβ€”
depth_mapIMAGEβ€”
depth_scaleFLOAT5.00.1–100β€”
blur_radiusINT31–51β€”
invert_depthBOOLEANfalseβ€”
modeCOMBOCross-eyed2 options: Parallel, Cross-eyed
gap_fill_modeCOMBOInpaint (Telea)3 options: Inpaint (Telea), Stretch, None
stereo_layoutCOMBOSide by Side2 options: Side by Side, Top Bottom
highsodium_optimizationBOOLEANtrueβ€”

Outputs (2)

NameTypeDescription
stereoscopic_imageIMAGEβ€”
gap_maskMASKβ€”