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

Stereogram Tool (CUDA)

Magic Eye, but from an actual depth map

By Cryptyox·Created about a year ago·Updated 6 months ago· 9
Stereogram Tool (CUDA)
  • depthmap
  • pattern_image
  • color_image
  • IMAGE
invert_depthmaptrue
divergence_factor0.50
eye_separation_percent10.0
zero_parallax_depth1.00
pattern_tile_factor1

StereogramTool is the third and strangest node in the anaglyphTool-Comfyui pack: it builds autostereograms - the "Magic Eye" posters of 90s mall culture - from a depth map and a repeating pattern. No glasses, no crossing your eyes; you unfocus your gaze and a 3D scene materializes inside the texture. The author ported the algorithm from DrMWeigand's ComfyUI-StereoVision (he asked permission in the announcement thread) and rewrote it to run on the GPU. That closes out the pack's trio of no-glasses-viewable 3D formats: red-cyan anaglyph, cross-eye pairs, and autostereogram.

Why you'd bother

Honestly? Half novelty, half genuinely useful. An autostereogram is one of the fastest ways to see whether a depth map is any good - edges, holes, and sudden depth jumps show up as glitches in the repeating pattern that your eye catches immediately. If your workflow already computes a depth map for parallax or ControlNet, this is a zero-cost sanity check that also makes a great party trick on a generated scene.

How it works

You feed it a depthmap and a pattern_image (a small high-frequency texture - noise, dots, fine detail). It tiles the pattern, then walks the image left-to-right, column by column: for each pixel it computes a separation from eye_separation_percent scaled by local depth relative to zero_parallax_depth, then copies the color from the linked pixel to its left. Your two eyes lock onto corresponding features that sit at the depth the map claims, and the scene pops. Fair warning: this one isn't as fully vectorized as its siblings - there's a Python loop over image columns - so it's GPU-backed but won't hit the anaglyph node's 500-frames-in-half-a-second video numbers. For stills it's plenty.

The inputs

These differ from the other two nodes - no image, but a pattern instead:

  • pattern_image (required) - your texture. Fine detail works best; smooth blobs give the brain nothing to fuse.
  • divergence_factor (0.1 to 2, default 0.5) - scales how much depth changes the separation.
  • eye_separation_percent (1 to 25, default 10) - simulated eye distance as a percentage of image width. The default is a sane start; higher gets harder to fuse.
  • zero_parallax_depth (default 1.0 here, not 0.5!) - the depth that sits exactly on the poster plane. The default keeps the pattern itself as the background and pops everything else forward.
  • pattern_tile_factor (1 to 16, default 1) - tile the pattern horizontally before use; raise it if your texture is narrower than the output.
  • invert_depthmap (default true) - flip it if the scene recedes instead of pops.
  • color_image (optional) - multiplies the result by an image's colors, handy if you want recognizable hues under the 3D.

Installation

Same pack as AnaglyphTool - ComfyUI Manager (search "anaglyph") or:

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

Just torch, no model downloads. Restart and it's under ImageProcessing/GPU/Stereo.

Troubleshooting

  • Can't see the 3D - this is the hardest part of autostereograms, not the node. Hold it at arm's length, look through the image as if focusing on something far away, and slowly bring it closer. Give it a full minute before giving up.
  • Flat poster - check invert_depthmap and that your depth map has real range.
  • Double vision that won't lock - drop eye_separation_percent toward 5 and divergence_factor toward 0.3.
  • Looks like static - your depth map is probably noisy; for video depth, use a temporally-stable estimator like DepthCrafter instead of per-frame models.
  • Pattern looks stretched - raise pattern_tile_factor.
CategoryImageProcessing/GPU/Stereo

Inputs (8)

NameTypeDefaultDescription
depthmapIMAGE
pattern_imageIMAGE
invert_depthmapBOOLEANtrue
divergence_factorFLOAT0.500.1–2
eye_separation_percentFLOAT10.01–25
zero_parallax_depthFLOAT1.000–1
pattern_tile_factorINT11–16
color_imageoptIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE