Nodes/ComfyUI-Depth-Pro/Metric Depth to Relative
ComfyUI Node

Metric Depth to Relative

Turning meters into a 0–1 map your ControlNet will actually follow

By spacepxl·Created 2 years ago·Updated 2 years ago· 209
Metric Depth to Relative
  • depth
  • depth
per_imagetrue
inverttrue
gamma1.00

If you run this pack's Depth Pro node and pipe its metric_depth straight into a depth ControlNet, you will be confused and a little disappointed. The output barely conditions anything, the preview looks wrong, and you'll wonder what the hype was about. This node is the fix for that, and the pack's own README calls it out by name: the raw model output is metric depth in meters, and to make it useful for ControlNet it has to be remapped into a 0–1 relative range. That's literally all this node does.

It's the same lesson the community learned with ZoeDepth back in 2023 - metric precision is not what conditioning wants; sharp, normalized relative relationships are. Depth Anything outputs are relative by default, which is why it "just works" as a preprocessor. Depth Pro doesn't, so it needs a hand. This is that hand.

How it works

Three steps, all visible in the source. First it applies the inverse transform 1 / (1 + depth) - a near object at 0.5 m becomes 0.67, something at 100 m becomes a hair above 0. That's the depth relationship compressed into the 0–1 space. Then it min-max normalizes so the closest thing is 1 and the farthest is 0. Then, depending on your toggles, it may flip the result and apply a gamma curve.

Inputs that matter

  • depth - the metric_depth IMAGE from the Depth Pro node.
  • invert (BOOLEAN, default on) - and here's the naming trap. On means don't flip: you get the conventional white-is-close map that nearly every depth ControlNet expects. Turn it off and you get black-is-close. Leave it on unless you have a specific reason to flip.
  • per_image (BOOLEAN, default on) - normalize each frame of a batch independently. Leave it on for video or multi-image runs; a single global min/max across wildly different frames wrecks the per-frame contrast.
  • gamma (FLOAT, default 1.0) - brightness bias. Values above 1 brighten and fatten the mid-tones, below 1 darken. The defaults are good for most uses; reach for gamma when your depth map reads too washed-out or too crushed.

The single output, depth, is an IMAGE in the 0–1 range. That's the one to wire into your depth ControlNet or to preview to see what the model actually saw.

Install and gotchas

It ships in the same pack, so:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Depth-Pro

or search ComfyUI-Depth-Pro in ComfyUI Manager, then restart. Requirements are timm>=0.9.16 and numpy<2.

Two things trip people up. First, if you're running ControlNet, remember it's not enough that the map is 0–1 - the typical depth ControlNet guidance is weight 0.4–0.7 for loose composition-preserving work, up to 0.8–1.1 for strict layout matching. Second, if your depth map looks "inverted" relative to what you expected, don't assume a bug - check the invert toggle before you blame the model.

CategoryDepth-Pro

Inputs (4)

NameTypeDefaultDescription
depthIMAGE
per_imageBOOLEANtrue
invertBOOLEANtrue
gammaFLOAT1.000.01–100

Outputs (1)

NameTypeDescription
depthIMAGE