Nodes/ComfyUI-DeepStereo/DeepStereo: Depth Map Processor
ComfyUI Node

DeepStereo: Depth Map Processor

Depth maps are the whole game in Magic Eye images — here's how to tune yours

By SanDiegoDude·Created about a year ago·Updated about a year ago· 3
DeepStereo: Depth Map Processor
  • depth_map
  • processed_depth_map
invertfalse
contrast1.0
brightness0.00
blur_radius0
clip_min0.00
clip_max1.00

An autostereogram encodes height as horizontal pixel offset. Bright pixel in the depth map, further the pattern is shifted, closer the object appears when your eyes lock. Which means the depth map is the sculpture - and a flat, muddy, or noisy map produces a flat, muddy Magic Eye no matter how good the texture is. DepthMapProcessor is the fine-tune stage you drop between whatever made the depth and the stereogram node.

The pack's own MiDaS node already has contrast, brightness, and gamma built in, so this one earns its keep when your depth comes from somewhere else: a Depth Anything map via comfyui_controlnet_aux, a ControlNet preprocessor output, or a hand-painted map. It also lets you decouple "generate depth" from "tune depth," so you can leave the estimator alone and tweak the map freely without re-running the model.

How it works

Feed it a depth_map (IMAGE) and it applies adjustments in a fixed order: brightness, then contrast, then clipping, then inversion, then a Gaussian blur. The order matters if you're chasing a specific look, but for normal use just think of it as five independent levers:

  • brightness (−1 to 1, default 0) - shifts everything brighter or darker. Because depth is relative, this effectively re-centers the scene.
  • contrast (0.1 to 3, default 1) - pivots the range around mid-gray. Crank it when your map is compressed into a narrow brightness band; the effect is a stronger 3D pop.
  • clip_min / clip_max (0 to 1) - cut values outside the band, then renormalize back to the full range. That's the sneaky powerful one: clipping the top and bottom and re-stretching is a poor-man's histogram stretch that rescues washed-out maps.
  • invert - flips near and far. This is your fix when the stereogram looks like it's punched into the screen instead of popping out.
  • blur_radius (0 to 50, Gaussian) - smooths the map. Handy for hiding banding artifacts when you used a low depth_layers count in the stereogram node, or for softening noisy edges.

The single output is processed_depth_map, which wires straight into the depth_map input of StereogramGenerator or RandomDotStereogramGenerator.

Where people get burned

The classic failure: generate, fuse, and the image is inverted - you see a crater where the nose should be. That's invert. The second most common: the object floats inside a barely-3D blob, which usually means the map's values are bunched together. Raise contrast or pull clip_min/clip_max inward to stretch the range. If depth looks right but the surface is noisy, blur_radius at 2–5 tames it without killing the shape.

Installing it

It's part of the ComfyUI-DeepStereo 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 by searching ComfyUI-DeepStereo. No extra models are needed - this node is pure math on the map you already have, which is why it's the cheap place to fix problems.

CategoryDeepStereo/Utility

Inputs (7)

NameTypeDefaultDescription
depth_mapIMAGE
invertoptBOOLEANfalse
contrastoptFLOAT1.00.1–3
brightnessoptFLOAT0.00-1–1
blur_radiusoptINT00–50
clip_minoptFLOAT0.000–1
clip_maxoptFLOAT1.000–1

Outputs (1)

NameTypeDescription
processed_depth_mapIMAGE