Nodes/StereoVision Plugin for ComfyUI/๐ŸŒ€ Autostereogram Generator
ComfyUI Node

๐ŸŒ€ Autostereogram Generator

Make Magic Eye Autostereograms in ComfyUI โ€” and Actually See the Hidden Image

By DrMWeigandยทCreated 2 years agoยทUpdated 12 months agoยท 12
๐ŸŒ€ Autostereogram Generator
  • depth_map
  • texture
  • IMAGE
โ—„pattern_div8โ–บ
โ—„invertfalseโ–บ
โ—„depth_multiplier2.0โ–บ
โ—„x_tiles8โ–บ
โ—„y_tiles8โ–บ
โ—„pattern_typerandomโ–บ
โ—„noise_scale1.0โ–บ
โ—„noise_octaves4โ–บ
โ—„color_modergbโ–บ
โ—„clamp_depth_to_firstfalseโ–บ
โ—„clamp_texture_to_firstfalseโ–บ
โ—„output_width0โ–บ
โ—„output_height0โ–บ

Remember Magic Eye? Those wallpaper-looking posters where a 3D shape floats out of the noise if you unfocus your eyes just right? The AutostereogramGenerator node makes those - from a depth map. Feed it a depth map (the same kind you'd give a depth ControlNet or a parallax node) and it renders a flat, textured image with a full 3D surface hidden inside. No VR headset, no anaglyph glasses, no special screen. Just your eyeballs and a willingness to look slightly dazed for ten seconds.

It's one of two nodes in DrMWeigand's StereoVision pack, and it sits at the end of a depth pipeline: Depth Anything v2 or Marigold produces the depth map, this node turns it into the autostereogram. The pack's other node, StereoscopicGenerator, makes side-by-side cross-eyed pairs; this one is the party trick.

How it actually works

Autostereograms are built around a repeating pattern. The node lays down a pattern tile, then copies each subsequent column from a column further left, shifting the copy by an amount proportional to the depth map at that pixel. Because the pattern repeats every pattern_width pixels, when you let your eyes diverge so the left and right eye lock onto repeats one period apart, the pattern lines up everywhere - except where the depth displacement moved it. Your brain reads that misalignment as height. That's the whole trick, and it's also why the node is pure CPU and runs basically instantly: the heavy lifting is a numba-accelerated per-pixel loop, not deep learning. The author made exactly this point on r/comfyui when someone offered to GPU-port it - the real cost is generating the depth map (Marigold for stills, DepthCrafter for video), not this step.

The inputs that matter

The only required input is depth_map, where pixel brightness is the hidden height. Everything else shapes the pattern:

  • pattern_div (default 8) - the pattern width in pixels (image width รท pattern_div). Lower values give wider, easier-to-view patterns; higher values give finer patterns with more detail that are harder to lock onto. If you can't see anything, drop it toward 4.
  • pattern_type - random, perlin, dots, lines, checkers, or waves, with noise_scale and noise_octaves controlling the generated texture and color_mode (grayscale / rgb / complementary) its coloring.
  • depth_multiplier and invert - how strong the pop is, and which way it points (in vs. out).
  • texture (optional) - your own image, tiled x_tiles ร— y_tiles times, becomes the wallpaper. This is how you get a picture hidden inside a picture instead of noise.
  • output_width / output_height - leave at 0 to match the depth map, or set a custom canvas (it letterboxes, filling the edges with the average edge depth).

For batch and video there's clamp_depth_to_first and clamp_texture_to_first, which pin depth and texture to the first frame so the pattern doesn't shimmer across frames. Flip those on if an animated Magic Eye comes out crawling.

The output is a plain IMAGE - wire it into PreviewImage/SaveImage, or into VHS if you want an autostereogram video.

Install

ComfyUI Manager: search "StereoVision". Or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/DrMWeigand/ComfyUI-StereoVision

Then restart ComfyUI. Dependencies (numba, opencv-python, scipy, and friends) are in requirements.txt and Manager installs them; they're all CPU-side. No model files, no API keys.

Where people get burned

Two things trip people up. First, you can't see the image - and 99% of the time that's viewing technique, not the node. Back away from the screen, relax your eyes as if looking through the monitor (parallel viewing; Magic Eye is parallel, unlike the cross-eyed side-by-side of this pack's other node). Bigger patterns are dramatically easier to lock onto, so start at a low pattern_div before chasing detail at 16.

Second, a bad depth map gives a garbled result. Use a clean Depth Anything v2 or Marigold map that matches the scene; and if your subject looks pushed-in instead of popped-out, flip invert.

It's a niche output - nobody strictly needs a Magic Eye - but it's free, instant, and it's the one node that reliably makes visitors say "wait, what?" Which, frankly, is most of the fun.

Category๐ŸŒ€ StereoVision

Inputs (15)

NameTypeDefaultDescription
depth_mapIMAGEโ€”
pattern_divINT8โ€”
invertBOOLEANfalseโ€”
depth_multiplierFLOAT2.00.1โ€“10โ€”
x_tilesINT8โ€”
y_tilesINT8โ€”
pattern_typeCOMBOrandom6 options: random, perlin, dots, lines, checkers, waves
noise_scaleFLOAT1.00.1โ€“10โ€”
noise_octavesINT41โ€“8โ€”
color_modeCOMBOrgb3 options: grayscale, rgb, complementary
clamp_depth_to_firstBOOLEANfalseโ€”
clamp_texture_to_firstBOOLEANfalseโ€”
textureoptIMAGEโ€”
output_widthoptINT0โ€”
output_heightoptINT0โ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEโ€”