Depth Anything V2 - Relative
The depth map you actually want
- image
- IMAGE
Feed it any image, get back a grayscale depth map - white for what's close to the camera, black for what's far. That map is what you hand a depth ControlNet so a new generation keeps the same spatial layout: foreground stays in front, background stays behind, even if you're redrawing the whole scene in a different style. If you only learn one depth preprocessor in this pack, learn this one. It's the default for a reason.
Why this is the one to reach for
The depth-estimation scene churned for a couple of years - MiDaS, then ZoeDepth, then Depth Anything - and then it just... stopped. Depth Anything V2 Large has been the sensible daily driver since 2024 and nothing has knocked it off. It generalizes to weird scenes, handles glass and reflections better than the old models, and gives you sharp edges, which is exactly what a ControlNet wants. A model that's technically more "accurate" in real-world meters (like Zoe) actually conditions worse, because metric precision comes at the cost of edge crispness. Don't overthink it: this node covers the vast majority of depth-ControlNet work.
How it works and the one real choice
It runs a monocular depth network - one flat image in, an estimated depth map out, no stereo rig or lidar. The only decision that matters is ckpt_name, which picks the model size:
depth_anything_v2_vitl.pth(Large, the default) - the quality/speed sweet spot. Start here.depth_anything_v2_vitg.pth(Giant, 1.3B params) - the ceiling. Sharper detail, but it's slow - think ten-plus seconds an image on a 4090. Use it when you have VRAM and time to burn.depth_anything_v2_vitb.pth/vits.pth(Base / Small) - faster and lighter. Small is genuinely quick, good for preview passes or batch/video work where you're processing a lot of frames.
The other input, resolution (default 512), is the size the preprocessor works at. Match it to your generation resolution rather than leaving it at 512 while you render at 1024 - a mismatch means the map gets rescaled and you lose edge fidelity. (The PixelPerfectResolution node in this same pack exists precisely to compute that number for you.)
The single output is an IMAGE - the depth map. Wire it into a ControlNet Apply node alongside a depth ControlNet model that matches your base checkpoint (SD1.5, SDXL, Flux, Z-Image - each needs its own). One thing worth internalizing: this node makes the hint image, not the conditioning. The actual depth ControlNet model is a separate download.
Installing it
Easiest path is ComfyUI Manager - search ComfyUI's ControlNet Auxiliary Preprocessors, install, restart. Manual works too:
cd ComfyUI/custom_nodes
git clone https://github.com/Fannovel16/comfyui_controlnet_aux
pip install -r requirements.txt
(Portable build: swap in python_embeded\python.exe -s -m pip install -r requirements.txt.) Restart ComfyUI. The depth model weight downloads automatically from HuggingFace the first time you run the node, so the first execution pauses while it fetches - that's normal, not a hang.
Where people get burned
Two things. First, the classic beginner mistake: a great depth map does nothing on its own. If your output ignores the composition entirely, check that you actually loaded a depth ControlNet and wired this node's IMAGE into it - the preprocessor and the ControlNet are two separate pieces. Second, weight discipline: for depth conditioning, 0.4–0.7 gives loose guidance that preserves creative freedom, 0.8–1.1 locks the layout hard. And ending the ControlNet around halfway through the steps (end step ~0.5) lets the model handle its own detail in the back half - that usually looks cleaner than holding depth through the whole sample. Starting at the old 1.0-strength default on a modern union model tends to overcook it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| ckpt_nameopt | COMBO | depth_anything_v2_vitl.pth | 4 options: depth_anything_v2_vitg.pth, depth_anything_v2_vitl.pth, depth_anything_v2_vitb.pth, depth_anything_v2_vits.pth |
| resolutionopt | INT | 51264–16384 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |