Nodes/ComfyUI-Leputen-Utils/Height Map Adjust
ComfyUI Node

Height Map Adjust

Set the black and white points on a height map — and mean it

By lilquail·Created 9 months ago·Updated 9 months ago· 1
Height Map Adjust
  • image
  • IMAGE
levels_in_min0.00
levels_in_max1.00
offset0.00

Height maps are fussy about range in a way regular images aren't. A displacement map that peaks at 0.6 instead of 1.0 displaces 40% less than your engine's material preset assumes, and a height map that starts at 0.1 instead of 0 lifts the whole surface off its base. Height Map Adjust gives you the two controls that actually matter for that: an explicit black point and white point, plus an offset to shift the whole range.

It's the node you run on every height/displacement map before it goes into a saver - especially right after an AI-generated one, since DeepBump's Normal to Height output rarely lands on exactly the range your engine wants.

How it works

It's a levels operation on the input's values:

  • levels_in_min (0–1, default 0) sets the new black point - everything at or below this remaps to 0.
  • levels_in_max (0–1, default 1) sets the new white point - everything at or above remaps to 1.
  • offset (−1 to 1, default 0) shifts the entire remapped range up or down afterward.

Values between the points get stretched (or compressed) linearly across the full 0–1 range, and everything is clamped so the output stays a valid grayscale map. With defaults it's a pass-through; set levels_in_min to 0.2 and suddenly the buried low end of your map becomes usable depth.

Inputs and outputs

  • image - the grayscale height map.
  • levels_in_min, levels_in_max, offset - the three controls above.

Output is a single IMAGE, same dimensions, remapped.

Install

Part of ComfyUI-Leputen-Utils:

cd ComfyUI/custom_nodes
git clone https://github.com/lilquail/ComfyUI-Leputen-Utils

Restart ComfyUI, find it under Leputen-Utils → Image. Plain tensor math - no extra deps, works everywhere.

Troubleshooting

  • levels_in_min >= levels_in_max errors - the source code rejects that combination because the remap would be division by a flat range. If you need to invert a height map, that's not what this node is for.
  • Displacement too strong/weak in-engine - almost always a range problem, not a scaling problem. Check what your engine expects (e.g., 0–1 with black = base plane) and set the points to match, rather than tuning the material multiplier to compensate.
  • AI-generated height looks gray and lifeless - run it here before judging it. levels_in_min ≈ the map's actual low end and levels_in_max ≈ its high end turns a washed-out 0.3–0.7 map into a full-range one, and the detail was there all along.
  • Offset too far - values clamp at 0/1, so a big positive offset just flattens the top end into a plateau. Keep offsets small and prefer the level points.

One small preference: most of the time you'll set levels_in_min/levels_in_max from the histogram and leave offset alone. Offset is for the "the whole surface should sit higher/lower" case - parallax base height, for instance. Using it as a general brightness knob is how you get clipped plateaus.

CategoryLeputen-Utils/Image

Inputs (4)

NameTypeDefaultDescription
imageIMAGEThe input height map image (grayscale tensor) to adjust.
levels_in_minFLOAT0.000–1Sets the new black point for the height map.
levels_in_maxFLOAT1.000–1Sets the new white point for the height map.
offsetFLOAT0.00-1–1Shifts the entire range of the height map up or down.

Outputs (1)

NameTypeDescription
IMAGEIMAGE