Nodes/ComfyUI-Marigold-v2/Marigold V2 Colorize Depth
ComfyUI Node

Marigold V2 Colorize Depth

How you get the Spectral_r picture everyone posts

By visualbruno·Created 29 days ago·Updated 21 days ago· 15
Marigold V2 Colorize Depth
  • raw
  • colored
  • grayscale
◄colormapSpectral_r►
◄near_is_brighttrue►
◄percentile_clip0.0►

What it's for

Depth maps are data, and data makes for bad screenshots. This node renders a Marigold depth prediction in a matplotlib colormap so you can actually see what the model found - the blue-far, warm-near look you see in every Marigold demo is Spectral_r with near_is_bright on. It also hands you a normalised grayscale map alongside, which is the version you'd actually wire into conditioning.

It takes a depth prediction and only a depth prediction. Point it at a normals or albedo raw and it raises, with a message naming the modality it got. That's the right behaviour; a normal map run through a colormap looks like a mistake, not a diagnostic.

If you just want the plain grayscale, you may not need this node at all - Marigold V2 Predict's image output is already the normalised grayscale map with near_is_bright applied. This is the node for when you want the published look, a different ramp, or a separate deliverable image.

How the normalisation works

Depth out of Marigold is affine-invariant: the values are meaningful up to an unknown scale and shift, per image. So before any colour can be applied, each map gets min-max normalised into 0–1 - and the direction handling is the part worth understanding. The checkpoint decides one thing (far_is_high: log and linear depth grow with distance, disparity shrinks) and you decide another (near_is_bright). The node flips the map only when those two disagree, which is why near_is_bright behaves identically whether you loaded a Log-stage2 or a Disparity-base checkpoint. Nice piece of design, and the sort of detail that saves you from a mysteriously inverted map.

The normalisation is also defensive about junk: non-finite values are excluded from the min/max, NaNs get zeroed, and a flat map (high == low) comes back as zeros rather than dividing by zero.

The inputs

raw - the MARIGOLDV2_RAW from Marigold V2 Predict. Depth only.

colormap - eight matplotlib ramps: Spectral, Spectral_r, turbo, viridis, magma, inferno, plasma, gray. The default reproduces the published Marigold visualisations: warm near, blue far, when near_is_bright is on.

near_is_bright - default on. Bright is close. Flip it if the map reads inside-out for your eye.

percentile_clip - default 0, max 20, step 0.1. Clips that percentage off both ends before normalising. This is the fix for the classic depth-map ruiners: a blown-out sky, a specular highlight, or one stray pixel that's wildly closer than everything else, all of which compress the interesting 90% of your range into a flat band. A small value - 0.5 to 2 - usually sharpens the result noticeably without eating real geometry. If you're measuring anything, leave it at 0.

The outputs

colored - the RGB ramp image.

grayscale - the normalised map, still an IMAGE. It's a single-channel value carried as three identical channels, which is exactly what a depth ControlNet wants to be fed. Note that it's display normalised: per-image min-max, so two frames of a video will not share a scale. For anything that needs consistent scale across a set - parallax passes, video, 3D export - save the raw instead and normalise yourself.

Install

ComfyUI Manager, search ComfyUI-Marigold-v2, or:

cd ComfyUI/custom_nodes
git clone https://github.com/visualbruno/ComfyUI-Marigold-v2
../../python_embeded/python.exe -m pip install -r ComfyUI-Marigold-v2/requirements.txt

matplotlib is the dependency this node cares about, and it's in the pack's requirements.txt, so a normal install covers you.

What it's actually good for

The coloured output is the preview and the deliverable. The grayscale output is the one that goes into work, and it's worth being precise about what that work is. Routine depth conditioning - redraw this scene in a new style, keep the layout - is still Depth Anything V2 Large's job on the quality-speed curve. Marigold's edge is elsewhere: illustration, synthetic renders and other inputs where a discriminative model trained on photos sags, and maximum-quality maps when you can afford the pass. Same story downstream of the colouring, where a height field built from these maps has always been Marigold's cleanest standout - printable bas-reliefs, displacement meshes, and the parallax and VR effects people build on top of depth.

Traps

Two, and they're both about feeding it the wrong thing. Wiring a normals raw in gives a hard error rather than a pretty-but-nonsensical picture - good. And wiring the Predict image output in instead of raw gives you a type error at graph validation, because image is an IMAGE and this node has no such input.

One softer trap: percentile_clip is per image, and so is the normalisation. Colourised depth is a rendering of relative distance within that frame, not a heatmap you should compare against the next frame. If you find yourself squinting at two colourised maps trying to work out which room is deeper, that's the cue to go look at the numbers.

CategoryMarigold V2

Inputs (4)

NameTypeDefaultDescription
rawMARIGOLDV2_RAW—
colormapCOMBOSpectral_rSpectral_r with near_is_bright on reproduces the published Marigold look: warm near, blue far.
near_is_brightBOOLEANtrue—
percentile_clipFLOAT0.00–20Clip this percentage from both ends before normalizing, to suppress outliers.

Outputs (2)

NameTypeDescription
coloredIMAGE—
grayscaleIMAGE—