Nodes/Dobidop ComfyStereo/StereoDiffusion
ComfyUI Node

StereoDiffusion

Stereo That Hallucinates the Missing Pixels

By Dobidop·Created 2 years ago·Updated 3 months ago· 56
StereoDiffusion
  • image
  • depth_map
  • model
  • clip
  • vae
  • stereo_pair
  • left_image
  • right_image
scale_factor5.0
directionuni
deblurfalse
pipeline_modeFast (Warp + Inpaint)
guidance_scale3.0
num_inference_steps20
seed1337
null_text_optimizationtrue
denoise_strength0.60
model_idrunwayml/stable-diffusion-v1-5
inpaint_model_idrunwayml/stable-diffusion-inpainting
prompt

The plain geometric warp in StereoImageNode has a hard limit: when you shift pixels for the second eye, background that was hidden in the original has to come from somewhere, and geometry can't invent it. This node is the "somewhere." It runs the StereoDiffusion method from the CVPR 2024 paper of the same name (Wang et al.) - a training-free technique that uses a diffusion model to generate stereo-consistent content instead of just smearing pixels around. Where the warp node gives you fast, geometric 3D with visible gaps at high divergence, this gives you clean stereo with the missing regions plausibly filled in. The tradeoff is time, VRAM, and a ~4 GB model download on first run.

How it works

Two modes, and you pick per use case:

  • Standard (DDIM) - the full paper pipeline. It does DDIM inversion of the source image, then runs the sampler with bilateral neighbor attention, which lets the left and right latent streams cross-attend to each other so the two views stay consistent. Null-text optimization (on by default) improves reconstruction quality at the cost of roughly a 2–3 minute pre-pass on a modern GPU.
  • Fast (Warp + Inpaint) - the pragmatic mode and the default. It geometrically warps the image using the depth map, then only AI-inpaints the gap regions. Fast enough to work with turbo and LCM models, and it's what you'd reach for when you want to iterate.

direction toggles uni vs bi attention (bi is slower, more consistent), and scale_factor is the disparity strength - the stereo equivalent of divergence.

The inputs that matter

  • image and depth_map - same conventions as StereoImageNode: grayscale depth, white close / black far.
  • pipeline_mode - Standard (DDIM) for quality, Fast (Warp + Inpaint) (default) for speed.
  • scale_factor (1.0–20.0, default 5) - how strong the stereo effect is.
  • guidance_scale and num_inference_steps - CFG and steps. The tooltips are your cheat sheet here: standard mode wants steps 30–100 and guidance 3–10; turbo models want guidance 0.0 and 1–8 steps; LCM wants 1.0–2.0.
  • seed (default 1337) - reproducibility.
  • null_text_optimization, denoise_strength, and prompt - the first two are mode-specific refinements; the prompt optionally guides the Fast-mode inpainting, so describe the scene if you want better gap filling.

The model wiring

Plug a MODEL/CLIP/VAE from a Load Checkpoint node and it runs natively in ComfyUI's pipeline. Fast mode prefers an inpainting checkpoint (9-channel UNet); standard mode takes any SD1.x/SD2.x model. No checkpoint connected? It falls back to model_id / inpaint_model_id (both default to runwayml's stable-diffusion-v1-5) and downloads from HuggingFace - that's the ~4 GB first-run hit.

Here's the trap: this is SD1.x/SD2.x only. SDXL and FLUX are "planned" per the README, not supported. Feed it an SDXL checkpoint and it won't behave. If your workflow is SDXL-centric, the geometric StereoImageNode plus an inpaint pass is the realistic alternative.

Outputs

  • stereo_pair - the combined side-by-side image.
  • left_image and right_image - the two eye views separately, so you can inspect or process each one.

Install

ComfyUI Manager → "ComfyStereo", or:

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

The diffusers, transformers, accelerate, einops, scikit-image dependencies are in that same requirements file. You want a CUDA GPU with 8 GB+ VRAM (16 GB recommended) and PyTorch 2.0+.

Troubleshooting

  • Out of memory - cut num_inference_steps and give other apps the boot. Fast mode is far friendlier than standard.
  • Black output - the depth map is bad. Confirm it's a valid grayscale map; a flat or all-zero depth kills the whole method.
  • "Burned" look - guidance too high. The README suggests 3–5 to avoid that fried appearance.
  • Slow - that's null-text optimization doing its thing. Turn it off for ~3x speed and accept lower reconstruction fidelity.

It's the slowest and heaviest node in this pack, and it's also the only one that produces stereo that looks like it was shot, not warped.

Categoryimage/stereo

Inputs (17)

NameTypeDefaultDescription
imageIMAGE
depth_mapIMAGE
scale_factorFLOAT5.01–20Controls the strength of the stereo effect (disparity)
directionCOMBOuniuni: unidirectional attention, bi: bidirectional attention
deblurBOOLEANfalseAdd noise to unfilled regions to avoid blurring
pipeline_modeCOMBOFast (Warp + Inpaint)Standard: DDIM inversion (high quality, slow). Fast: Warp image with depth, then AI-inpaint only the gap regions (fast, works with turbo/LCM models)
guidance_scaleFLOAT3.00–20CFG scale. Standard mode: 3-10. Turbo models: 0.0. LCM: 1.0-2.0
num_inference_stepsINT201–100Number of inference steps. Standard DDIM: 30-100 (default 50). Fast inpainting: 20-30. Turbo/LCM: 1-8
seedINT13370–18446744073709550000Random seed for reproducible results
null_text_optimizationoptBOOLEANtrueEnable null-text optimization for better reconstruction (Standard mode only)
denoise_strengthoptFLOAT0.600.1–1How much noise to add before denoising (Fast mode). Lower = preserve original more, Higher = more model creativity for filling gaps
modeloptMODELComfyUI MODEL input. Fast mode: use inpainting model (9ch UNet). Standard mode: use any SD1/SD2 model.
clipoptCLIPCLIP from Load Checkpoint
vaeoptVAEVAE from Load Checkpoint
model_idoptSTRINGrunwayml/stable-diffusion-v1-5Fallback HuggingFace model ID (Standard mode, when no ComfyUI model connected)
inpaint_model_idoptSTRINGrunwayml/stable-diffusion-inpaintingFallback inpainting model ID (Fast mode, when no ComfyUI model connected)
promptoptSTRINGOptional text prompt to guide inpainting (Fast mode). Describe the image content for better gap filling.

Outputs (3)

NameTypeDescription
stereo_pairIMAGE
left_imageIMAGE
right_imageIMAGE