ComfyUI Node

modaux: midas

MiDaS as a ControlNet preprocessor

By madtunebk·Created 2 years ago·Updated 2 years ago· 17
modaux: midas
  • image
  • IMAGE
detect_resolution512
image_resolution512

Depth conditioning is what you reach for when you want composition to survive a regeneration - the couch stays in front of the window, the figure stays closer than the wall - without caring about the exact edges. This node, modaux: midas from the ControlNet Auxiliar pack, turns any image into the grayscale depth map that makes that work. It's the boring, reliable option, and in a discipline full of flashy upgrades, boring reliability is genuinely valuable.

What it actually does

The node wraps MidasDetector from controlnet-aux==0.0.7, using the DPT-Hybrid variant. MiDaS is the monocular depth estimator that Intel released years ago and that became the default ControlNet depth preprocessor for most of 2022–2023 - the model behind SD 2.0's depth2img. On the first run it downloads the weights from the lllyasviel/Annotators repository on Hugging Face into your cache (there's no manual model-download step, and no separate ComfyUI models folder to babysit). Every run after that is fast, and it's light on VRAM compared to the diffusion-based depth models.

The output is a single-channel-looking grayscale map: white for things near the camera, black for things far away. That map is exactly what a depth ControlNet expects.

The inputs, all three of them

  • image - the reference photo or render.
  • detect_resolution (default 512, range 256–1024) - the resolution MiDaS actually estimates depth at. Higher costs more time and VRAM.
  • image_resolution (default 512) - the size the depth map is resized back to, to match your generation.

That's the entire list. Unlike some preprocessors there are no fancy toggles here, which is fine - the model's a and bg_th gamma tweaks from the underlying library are real but rarely worth touching, and this pack keeps them hidden. The output IMAGE wires straight into a ControlNet Apply node. On SD 1.5 that's control_v11f1p_sd15_depth; on SDXL's xinsir union and the Z-Image/Flux 2 unions, the "depth" mode consumes this map directly.

The honest take on MiDaS in 2026

The depth-estimation field has moved on. Depth Anything (v1, then v2 and v3) is the modern default for ControlNet preprocessing - trained on tens of millions of unlabeled images, sharper, and more robust to weird scenes. If you already have a Depth Anything preprocessor installed, you'll get better maps from it than from MiDaS.

But there's a reason the old guard survives. The canonical community A/B test was blunt about it: "Zoe Depth vs MiDaS Depth. Spoiler alert: Use MiDaS." ZoeDepth's theoretically more accurate metric depth came at the cost of blurrier edges, and for ControlNet work the sharper MiDaS map conditioned better. MiDaS is the same story relative to its fancier contemporaries - it's fast, it's light, it produces clean relative depth with crisp object boundaries, and it's already downloaded and working. If your workflow is "I need a depth map, not a research project," this node is the unglamorous workhorse.

Install and gotchas

Same as every node in this pack - ComfyUI Manager, search "ControlNet Auxiliar", or:

cd ComfyUI/custom_nodes
git clone https://github.com/madtunebk/ComfyUI-ControlnetAux.git
cd ComfyUI-ControlnetAux
pip install -r requirements.txt   # timm, controlnet-aux==0.0.7, mediapipe

Restart, then run the node once and let the ~hundreds of MB of weights download. Two things to keep in mind: keep working resolutions around 512 (the README's own guidance, and the models are tuned there), and remember MiDaS gives you relative depth - it tells you what's closer than what, not distances in meters. For ControlNet that's all you need. For actual 3D geometry work, you want a metric-depth model instead.

CategoryControlNet Auxiliar

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
detect_resolutionINT512256–1024
image_resolutionINT512256–1024

Outputs (1)

NameTypeDescription
IMAGEIMAGE