Nodes/SideBySide_Stereoscope/πŸ‘€ SBS V2 by SamSeen
ComfyUI Node

πŸ‘€ SBS V2 by SamSeen

The main event β€” one flat image in, a 3D image and a depth map out

By SamSeenXΒ·Created 2 years agoΒ·Updated 4 months agoΒ· 61
πŸ‘€ SBS V2 by SamSeen
  • base_image
  • stereoscopic_image
  • depth_map
β—„depth_scale30.0β–Ί
β—„blur_radius3β–Ί
β—„invert_depthfalseβ–Ί
β—„modeCross-eyedβ–Ί
β—„highsodium_optimizationfalseβ–Ί
β—„modelDepth Anything V2 - Smallβ–Ί

This is the node the whole pack is built around. SBS V2 takes any ordinary 2D image, estimates a depth map for it with Depth-Anything, and outputs a side-by-side stereoscopic image plus the depth map itself - no external depth maps, no extra tools, everything in one node. It's the one you reach for first, whether you're making 3D content for a VR headset, a 3D display, or just the classic cross-eyed freeviewing trick.

The workflow is comically short: drop an image into base_image, run it, done. The first run downloads a depth model, then every subsequent run is just: depth estimate, shift pixels, output. Pair it with the pack's SBS Video Uploader / SBS Video Combiner and the same node processes entire videos frame by frame.

How it works

Under the hood it loads a Depth-Anything model through the Hugging Face transformers API (AutoModelForDepthEstimation), runs your image through it, normalizes the result to 0–1, and smooths it with the blur_radius you set. Then the stereo trick: each pixel is shifted horizontally by an amount proportional to its depth value (depth_scale / image_width), with the left and right halves of the output getting mirrored shifts - so your brain fuses them into depth.

The interesting knob is highsodium_optimization. The default algorithm is the original pixel-by-pixel Python loop - correct, but slow. The HighSodium option (named after the contributor who wrote it, PR #16) replaces it with a vectorized NumPy pass that processes whole columns at once, which the README claims runs up to 4x faster. It can produce slightly different results at the edges, so if you're chasing pixel-perfect output, A/B them; if you're converting a video, just turn it on.

The inputs that matter

  • base_image - your flat image (or a batch of frames from the video uploader).
  • depth_scale (default 30, 1–100) - 3D intensity. Caveat: on this V2 node the scale is absolute, not resolution-relative - 30 means roughly a 30/width pixel shift, so the same value feels different at 512px vs 2048px. (The pack's V2.1 node later reworked this into a percentage of image width; don't expect consistent values between them.)
  • invert_depth (default false) - if the 3D looks near/far swapped, flip this. Depth models hand back inverted depth often enough that the VR Panorama node in this pack defaults it to true.
  • mode - Parallel or Cross-eyed. Parallel is the one for 3D displays and headsets; cross-eyed is the no-glasses trick.
  • model - choose between Depth-Anything V2 Small / Base / Large and V3 Small / Base / Large. Default is V2 Small, which is the right call for most people: fast, good edges, and it's what the README's demos use. Large is the quality pick when you have time; switching models downloads another checkpoint.
  • blur_radius (default 3, odd, up to 51) - smooths the depth map before shifting. Higher values give softer, more forgiving 3D; lower keeps edges crisp.

The outputs

Two, both IMAGE:

  • stereoscopic_image - the side-by-side result. Save it or feed it onward.
  • depth_map - the grayscale depth the node generated. White is near, black is far. This is genuinely useful on its own - you can wire it into other tools, or just check whether the depth came out sane before blaming the 3D result.

Install

It's the pack's flagship node, so install the pack:

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

Then restart ComfyUI. Manager users can search "ComfyUI_SSStereoscope". The Depth-Anything model auto-downloads from Hugging Face on first use - the requirements.txt pulls in transformers, timm, and friends, and the depth models land in your HF cache, not your ComfyUI models folder.

Where people get stuck

First run needs internet, and a failed download can leave you staring at a blank depth map - rerun it and watch the console. blur_radius must be odd (the node steps by 2). And the most common "bug" isn't a bug: if your output looks reversed, it's invert_depth; if it looks flat, raise depth_scale. Feed it a batch of video frames and it works, but budget for a depth pass per frame - that's where highsodium_optimization earns its keep.

CategoryπŸ‘€ SamSeen

Inputs (7)

NameTypeDefaultDescription
base_imageIMAGEβ€”
depth_scaleFLOAT30.01–100β€”
blur_radiusINT31–51β€”
invert_depthBOOLEANfalseβ€”
modeCOMBOCross-eyed2 options: Parallel, Cross-eyed
highsodium_optimizationBOOLEANfalseβ€”
modelCOMBODepth Anything V2 - Small6 options: Depth Anything V2 - Small, Depth Anything V2 - Base, Depth Anything V2 - Large, Depth Anything V3 - Small, Depth Anything V3 - Base, Depth Anything V3 - Large

Outputs (2)

NameTypeDescription
stereoscopic_imageIMAGEβ€”
depth_mapIMAGEβ€”