[Inference.Core] MiDaS Normal Map
Turning depth into a surface-direction ControlNet map
- image
- IMAGE
Depth maps tell you how far away something is. Normal maps tell you which way its surface is facing. They're related - you can derive one from the other - but they condition a ControlNet differently: depth locks spatial arrangement, normals lock surface orientation, which is the thing that actually matters for relighting and material-aware generation. This node produces the normal-map flavor, built on MiDaS - the original depth estimator, the one that shipped with SD 2.0's depth2img and was the default ControlNet depth preprocessor through most of 2022-2023 - but instead of returning MiDaS's depth output directly, it derives surface normals from it.
What the knobs do
Most people will only ever touch one input here: bg_threshold (0–1, default 0.1). It decides how aggressively flat or blown-out regions - sky, overexposed whites, anything without real surface texture - get treated as "no meaningful normal direction." If your background is bleeding strange colors into the normal map where it should just be neutral, raise this first.
a (default roughly 6.28, i.e. 2π, range 0 to about 15.7) is an angle-scaling parameter controlling how the normal vectors get mapped into the RGB values you actually see. The default is effectively "use the full circle," and most workflows never touch it. If your normal map looks unusually compressed or banded, this is the parameter responsible - but confirm everything else is working first before reaching for it, since it's rarely the source of a problem for a typical use case.
resolution (64–2048, default 512) is the standard preprocessor input-resize control shared by every node in this pack.
The single IMAGE output wires into a Normal-type ControlNet, exactly like a depth map wires into a Depth ControlNet.
Where it sits relative to the alternatives
The community's standard normal-map estimator for ControlNet work is Normal BAE, which is what most current workflows default to - it pairs naturally with IC-Light-style relighting pipelines. MiDaS-derived normals, which is what this node gives you, are the older, simpler alternative: not a bad option, but not the first thing to reach for if you have Normal BAE available and no specific reason to prefer MiDaS's particular output. Where MiDaS's own normal derivation is worth using is when you're already running MiDaS elsewhere in a pipeline and want a normal map without adding a second model, or when you specifically want its character over BAE's.
Installing it
Ships as part of the LykosAI Inference Core Nodes pack. Via ComfyUI Manager, search "ComfyUI-Inference-Core-Nodes". Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes
then install.py, or pip install -e .[cuda] (swap for [cuda12], [rocm], or [directml] to match your GPU) and restart. There's no separate normal-map model to download here - it reuses MiDaS's own depth weights and derives normals as a post-processing step, so if MiDaS depth preprocessing already works in your setup, this node will too.
Troubleshooting
If you're getting CPU-speed preprocessing despite having a capable GPU, you likely installed with plain pip install -e . instead of one of the accelerated extras - reinstall with the variant matching your hardware. Beyond that, most quality complaints trace back to bg_threshold needing an adjustment for a specific image's contrast, not a genuine bug.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| aopt | FLOAT | 6.280–15.70796326794897 | — |
| bg_thresholdopt | FLOAT | 0.100–1 | — |
| resolutionopt | INT | 51264–2048 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |