Autostereogram Creator (Advanced)
Turning a depth map into an autostereogram
- depth_map
- pattern
- IMAGE
The "AdvancedAutostereogramNode" is the reason the rest of this pack exists, as far as I'm concerned. It's the node that makes actual Magic Eye images - Single Image Random Dot Stereograms (SIRDS) if you want the fancy name - inside ComfyUI. Remember those 90s posters where you'd stare through the picture and a sailboat materialized? That's exactly what this builds, from a depth map and a repeating pattern you supply.
People have wanted this in the SD world for years. The community recipe was always "generate an image, extract a depth map, then hand-tile a pattern over it and pray." This node is that last step made explicit, and it does the algorithm properly.
How it works
The mechanism is the classic stereogram recurrence, straight out of the literature: each output pixel copies its color from a source column in your pattern, shifted by how deep the corresponding depth value says it should be. Concretely, the node walks each row of the depth map, and for pixel x computes a linked pixel at roughly x - eye_separation + separation, where separation scales with the brightness of the depth map at that spot. Bright depth values pop toward you, dark values sit on the screen plane, and the eye-separation value sets the period of the repeating pattern.
Behind the scenes it maintains a per-row "links" array so every pair of pixels your left and right eye would see gets the same pattern color. The pattern tiles vertically by modulo too, so you don't need a perfectly pre-tiled source. It's all NumPy and torch - no GPU op needed, no models.
The inputs that matter
depth_map(IMAGE): a grayscale image where brightness is depth. White = pops out. Anything you can get a depth estimate for works - ComfyUI's Depth Anything or MiDaS preprocessors are perfect, and the standard ControlNet depth preprocessors feed it fine.pattern(IMAGE): the repeating texture that fills the picture. A busy, textured, tileable pattern hides the seams far better than a flat color.eye_separation_pixels(default 100, range 30–400): the pattern period. This is the single knob that decides whether the effect reads. Too small and it's visual static; too big relative to the image width and the illusion breaks.depth_scale_factor(default 0.5, range 0.01–2): how strongly depth pops. The author's tooltip calls 0.3–0.7 the common zone, and that's right.
The single output is an IMAGE tensor in standard ComfyUI form, so wire it straight into a Save Image or Preview Image node.
Install
It ships in the orion4d/illusion_node pack, "ComfyUI Illusion & Pattern Nodes" - all its nodes land in the "illusion" category of the Add Node menu. Easiest route is ComfyUI Manager: search "Illusion" and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/illusion_node.git
Then restart ComfyUI. The whole pack's requirements.txt is just numpy, torch, and Pillow - ComfyUI already ships all three, so there are no extra downloads and no model files to fetch.
Where people get burned
The usual failure is "I get a noisy image and no 3D." That almost always means the depth map is too flat, or the pattern is too uniform to reveal parallax. Give the node a real depth map and a strongly textured pattern, then nudge eye_separation_pixels - a value roughly in the 80–150 range on a 512px image is a sane starting point. Also remember eye_separation_pixels is your viewing-distance knob: it's not a quality slider, it's literally the distance your eyes are pretending to be apart, so changing it changes where the illusion locks in.
It's a niche node, but a real one - there aren't a dozen ways to do this in ComfyUI, and this is the one that works.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| depth_map | IMAGE | — | |
| pattern | IMAGE | — | |
| eye_separation_pixels | INT | 10030–400 | Typical eye separation projected onto the image plane in pixels. Influences pattern period and perceived depth. |
| depth_scale_factor | FLOAT | 0.500.01–2 | Scales the depth effect. Values around 0.3-0.7 are common. Higher values = more 'pop-out'. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |