DeepStereo: Stereogram Generator
Depth map plus texture equals a Magic Eye you can actually fuse
- depth_map
- texture
- stereogram
This is the node the whole pack is named for. Everything else - the depth estimator, the texture generators, the processors - exists to feed this one: it takes a depth map and a texture and renders an autostereogram, the Magic Eye image that hides a 3D shape inside a repeating pattern. Defocus your eyes, let the repeats lock, and the scene floats out of the wallpaper.
It's a niche ask, but a real one. People have been asking the diffusion community for Magic Eye generation for years, and the reference implementation this pack is built from - SanDiegoDude's standalone DeepStereo CLI - was a community tool before it became ComfyUI nodes. If you've ever stared at a book of Magic Eye posters wishing you could make your own, this is your node.
How it works
The mechanism is the classic constraint-copy stereogram algorithm. Every pixel at column x either copies the pixel from x - separation (where separation is derived from the depth value at that pixel, scaled between min_separation and max_separation) or pulls from the texture. Because the repeats shift by depth, your eyes' fusion reads the shifts as height. The craft is all in how it copies.
You get four algorithm options, and they differ in texture handling:
standard- the plain constraint copy, left to right. Simple, and a good baseline.improved- shifts the texture start per row for better distribution, so pattern repeats don't line up into artifacts.layered- pre-blends the texture's edges into a seamless tile before generating; the choice when your texture isn't tileable.central(default) - propagates outward from a center column instead of the left edge, which tends to fuse more consistently. The README recommends it.
reference_type (left_to_right, right_to_left, center_out) sets the propagation direction; center_out pairs with the central algorithm and has a center_offset (in pixels) if you need to shift the fusion point.
Depth shaping comes from depth_layers (0–50, 0 = continuous) and layer_smoothing (0–1) - the same banding controls as the random-dot generator, with cosine interpolation between layers. stretch_texture (default off) resizes the texture to the depth map's dimensions if they don't match; otherwise the texture tiles.
Required: depth_map, texture, min_separation, max_separation, algorithm, reference_type, depth_layers, layer_smoothing. Output: a single stereogram IMAGE, ready for a Save Image node.
Getting it to work
The README's recommended starting stack: algorithm = central, reference_type = center_out, depth_layers = 50, layer_smoothing = 1.0. If it won't fuse, the usual suspects: pattern width out of sync with max_separation, min_separation not below max_separation (the node raises a ValueError - that's a bug report, not a mystery), or a flat depth map. If it pops the wrong way, invert the depth upstream. And don't skip texture quality - a blurry, low-contrast texture is the single most common reason a render comes out as static.
Installing it
The node is part of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/SanDiegoDude/ComfyUI-DeepStereo
cd ComfyUI-DeepStereo
pip install -r requirements.txt
Restart ComfyUI, or install via ComfyUI Manager (search ComfyUI-DeepStereo). Note the README's install snippet has a placeholder yourusername/... URL - use the real repo above. No extra model downloads; this node just needs a depth map and a texture, both of which the rest of the pack provides.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| depth_map | IMAGE | — | |
| texture | IMAGE | — | |
| min_separation | INT | 3010–200 | — |
| max_separation | INT | 10020–300 | — |
| algorithm | COMBO | central | 4 options: standard, improved, layered, central |
| reference_type | COMBO | center_out | 3 options: left_to_right, right_to_left, center_out |
| depth_layers | INT | 500–50 | Number of distinct depth layers (0 for continuous) |
| layer_smoothing | FLOAT | 1.000–1 | Amount of smoothing between layers |
| stretch_textureopt | BOOLEAN | false | Stretch texture to match depth map size |
| center_offsetopt | INT | 0-200–200 | Offset from center for reference point |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| stereogram | IMAGE | — |