Nodes/ComfyUI-pixel-perfect-depth/Pixel Perfect Depth (Depth Map)
ComfyUI Node

Pixel Perfect Depth (Depth Map)

Depth maps that actually hold edges — Pixel Perfect Depth (Depth Map)

By Apache0ne·Created 8 months ago·Updated 8 months ago· 5
Pixel Perfect Depth (Depth Map)
  • image
  • depth_image
  • ppd_depth
sampling_steps20
model_variantDA2
seed666
colorizetrue
use_fp16true

If you've run depth in ComfyUI before, you know the drill: feed an image to a preprocessor, get a gray gradient that roughly matches the photo, feed that to a ControlNet. Pixel Perfect Depth is a different animal. Instead of a one-shot estimator, it runs an actual diffusion model whose job is depth - a semantics-prompted diffusion transformer that iteratively refines a Depth Anything V2 (or MoGe) prior until the map matches the geometry. It's slower than a preprocessor and it needs two big weights files, but the output is the kind of clean, edge-honest depth map you'd normally only get out of a render engine's Z pass. This node - "Pixel Perfect Depth (Depth Map)" - is the pack's main event, and the one you wire into every other node in it.

What it's for

Two jobs, same node. Feed its depth_image into a depth ControlNet and you get regeneration that respects the scene's layout instead of mushing it. Or pipe its ppd_depth output into the pack's save-node and you're on the road to an actual 3D point cloud from one photo. The reason to pick this over the ten other depth nodes in Manager is the diffusion pass: where a straight Depth Anything map can go soft on glass, wire, hair and fine foreground edges, the DiT refinement tightens those boundaries up. That's the "pixel-perfect" claim, and it mostly holds.

How it works

The pipeline is two stages. A semantics encoder - Depth Anything V2 ViT-L, or MoGe2 if you pick that variant - extracts a feature prior from your image. Then a diffusion transformer (DiT) denoises toward a depth map over however many sampling_steps you give it, using an Euler sampler on a linear 1000-step schedule. More steps, better map, slower run - it's genuinely a diffusion cost, not a "steps are basically free" sampler cost.

The node returns two outputs:

  • depth_image - the display map, normalized 0–1 and (by default) colored with the Spectral colormap. This is what you'll hand to a ControlNet or just look at.
  • ppd_depth - a PPD_DEPTH payload holding the raw float32 depth. It only flows into this pack's other nodes (Unpack Depth, Save Point Cloud), and it's how you keep full precision instead of re-round-tripping through an 8-bit image.

The inputs that matter

  • model_variant - DA2 (Depth Anything v2 semantics) or MoGe2. DA2 is the default and the safer bet; MoGe2 leans on geometry-aware semantics and is worth A/B-ing for scenes with lots of sky or glass.
  • sampling_steps - 20 default. Below ~10 the map gets blotchy; above ~40 you're mostly paying for marginal gains.
  • seed - the diffusion step is seeded, so the same image and seed gives the same map. -1 disables it (random each run).
  • colorize and use_fp16 - leave colorize on unless you want raw grayscale; leave use_fp16 on if you're on CUDA or Apple Silicon (it's forced off on CPU).

Install

This pack doesn't auto-download anything, which is the single biggest gotcha. Via ComfyUI Manager, search for ComfyUI-pixel-perfect-depth. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Apache0ne/ComfyUI-pixel-perfect-depth
cd ComfyUI-pixel-perfect-depth
pip install -r requirements.txt

Then restart ComfyUI. The requirements pull in ppd, open3d, and a pinned git+https://github.com/EasternJournalist/utils3d... build. After that, download the weights from the HuggingFace repo and drop them into ComfyUI/models/ComfyUI-pixel-perfect-depth/ mirroring the repo layout:

ComfyUI/models/ComfyUI-pixel-perfect-depth/
├── DA2/
│   ├── depth_anything_v2_vitl.pth   (~1.3 GB)
│   └── ppd.pth                      (~1.9 GB)
└── MoGe2/  (only if you use the MoGe2 variant)
    ├── model.pt                     (~1.3 GB)
    └── ppd_moge.pth                 (~1.9 GB)

Troubleshooting

The classic failure is a hard error on first run: FileNotFoundError: PPD DA2 checkpoint not found at ... - that's the no-auto-download design working as intended. You haven't placed the weights. Double-check the subfolder name (ComfyUI-pixel-perfect-depth inside your models folder, not the pack's own directory) and that the _vitl.pth and ppd.pth pair are both there; the node needs both to assemble the full pipeline.

First run is slow even after load - it's loading ~3 GB of weights and compiling the transformer, so don't panic at a 30-second pause before the first map appears. If you get a CUDA out-of-memory, drop sampling_steps, toggle use_fp16, or resize your input down first. One honest caveat: the pack's README marks the video nodes as work-in-progress, but this still-image node is the mature core - it's the one you should build on.

CategoryPixelPerfectDepth

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
sampling_stepsINT201–100
model_variantCOMBODA22 options: DA2, MoGe2
seedoptINT666-1–2147483647
colorizeoptBOOLEANtrue
use_fp16optBOOLEANtrue

Outputs (2)

NameTypeDescription
depth_imageIMAGE
ppd_depthPPD_DEPTH