Nodes/anaglyphTool-Comfyui/Anaglyph Tool (CUDA)
ComfyUI Node

Anaglyph Tool (CUDA)

Red-cyan 3D from any image, at video speed

By Cryptyox·Created about a year ago·Updated 6 months ago· 9
Anaglyph Tool (CUDA)
  • image
  • depthmap
  • IMAGE
invert_depthmaptrue
divergence2.0
zero_parallax_depth0.50

AnaglyphTool is the flagship of the anaglyphTool-Comfyui pack - the reason the pack exists. The author (Timon on GitHub as Cryptyox, and r/comfyui's InfiniteRotatingFish) wanted to turn ComfyUI output into old-school red-cyan 3D you view with cheap paper glasses. FishTools had an anaglyph node, but it was blurry and slow. So he wrote his own, vectorized on the GPU, and it's fast enough to make the whole video-to-anaglyph pipeline practical. His benchmark: 500 480p frames in about half a second on a 3090, with batch size as the main lever.

You give it an image (or a batch of frames) and a depth map, and it returns a red-cyan anaglyph. That's the entire job, done as a single IMAGE → IMAGE edge in your graph. Where it shines is video: split a clip into frames with VideoHelperSuite, run a per-frame depth estimator, and feed the whole batch in one pass. It's also a great depth-check - if you've ever wondered whether a depth map is any good, the anaglyph will tell you fast.

How it works

The depth map gets normalized per frame to 0–1; a color depth map is just averaged to grayscale first. invert_depthmap is on by default because estimators store depth in one of two conventions, and flipping it is the one-click fix when your 3D looks inside-out. Then it computes a per-pixel horizontal shift from zero_parallax_depth and divergence, warps the image twice with bilinear grid_sample (one view shifted left, one right), and composites: red channel from the right-eye view, green and blue from the left. That's literally the anaglyph recipe, minus any Photoshop futzing.

The inputs that matter

  • divergence (−10 to 10, default 2) - the strength of the effect. Crank it for pop; keep it modest or the image tears at the edges.
  • zero_parallax_depth (0 to 1, default 0.5) - the depth that sits on the "screen plane." Closer stuff pops out, further stuff recedes. Push toward 1 to float the whole scene in front of the screen.
  • invert_depthmap (default true) - flip it first if things look inverted.

The output is a single IMAGE - the anaglyph. Wire it to a Preview or SaveImage node. The depth map quality is the ceiling on what you get, so use a good estimator; the author recommends Depth Anything V2 for stills and Depth Anything TensorRT for video.

Installation

Install via ComfyUI Manager (search "anaglyph" - the pack shows up as anaglyphTool-Comfyui), or the old-fashioned way:

cd ComfyUI/custom_nodes
git clone https://github.com/Cryptyox/anaglyphTool-Comfyui
pip install -r requirements.txt

That requirements file is literally just torch. No model downloads, no heavy dependencies - the pack doesn't estimate depth for you; you supply the depthmap from any depth estimator. Restart ComfyUI and the node appears under ImageProcessing/GPU/Stereo. One caveat worth knowing up front: the license is CC BY-NC-SA 4.0, so non-commercial.

Troubleshooting

  • Output looks like noise / no 3D - you need red-cyan glasses. Without them an anaglyph is just a noisy double exposure. This trips up everyone once.
  • "Inside out" - toggle invert_depthmap.
  • Flat - raise divergence, and check your depth map actually has range.
  • Batch mismatch error in the console - image and depthmap must have the same batch size; the node checks and returns the input untouched if they don't.
  • Depth map at a different resolution - it auto-resizes to match the image, but you'll get cleaner edges if you match resolutions first.
  • Console spam - it prints debug lines on every run, including "Target device forced to: cuda." Normal. Related: it forces CUDA, and the CPU fallback is described in the code as "not under development" - don't expect speed without an NVIDIA GPU.
CategoryImageProcessing/GPU/Stereo

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
depthmapIMAGE
invert_depthmapBOOLEANtrue
divergenceFLOAT2.0-10–10
zero_parallax_depthFLOAT0.500–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE