Sharpen Depth
Pulling crisp detail out of soft height maps
- depth
- depth
Depth and height maps come out of extraction models soft. It's not a bug - it's what a generative prior does when it averages over many plausible surfaces. But a soft height map means a soft displacement in your game engine, and Sharpen Depth exists to put the crispness back before you bake it into geometry.
How it works
It's a classic unsharp mask, applied per channel. The node builds a Gaussian blur kernel from the radius slider (kernel size scales as radius * 4), blurs a copy of the depth map, and adds the difference back: sharpened = original + (original - blurred) * strength. That's the same math Photoshop's "unsharp mask" uses - nothing exotic, just reliable.
The strength slider goes 0 to 5, with 1.0 being a sensible starting point. Zero is a passthrough, which is handy when you're toggling the node on and off to A/B your results.
The one depth-specific knob is clamp_output. With it on (default), values stay in 0–1, which keeps the map valid for most downstream uses. Turn it off and sharpening can overshoot past black and white - clipped highlights in the map. That's usually what you don't want, but if you're feeding a 32-bit displacement later where you want the full range preserved, it's there.
What to set
Start at strength 1.0 and radius 1.0. If the result looks crunchy or like it's ringing at the edges of features, lower the strength before you touch the radius - strength is the "how much," radius is the "how far." Bump radius up (think 2–3) when your height map is very low frequency and you want the sharpening to reach across broad slopes rather than just bite at edges.
Installing it
Part of amtarr/ComfyUI-TextureAlchemy. Install via ComfyUI Manager (search "Texture Alchemy") or:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
Restart, then right-click → Add Node → Texture Alchemist → Height. No extra Python packages, no model downloads - the pack runs entirely on ComfyUI's bundled PyTorch/PIL/NumPy.
The honest gotcha
Over-sharpening a height map doesn't just look bad, it produces actual halo artifacts in displacement - raised lips around every crease. If your terrain starts looking like it has double edges, you overshot. And one thing this node deliberately doesn't do: it won't rescue a height map that's fundamentally smooth, because unsharp masking amplifies existing detail, it doesn't invent it. For genuinely empty regions you'd want the detail added procedurally first. As with every node in this pack, expect a log banner in the console on each run - that's the author's style, not a warning.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| depth | IMAGE | — | |
| strength | FLOAT | 1.00–5 | Sharpening strength |
| radius | FLOAT | 1.00.1–10 | Blur radius for unsharp mask |
| clamp_output | BOOLEAN | true | Clamp output to 0-1 range |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| depth | IMAGE | — |