Comfy-DepthDiff
A ComfyUI extension with 1 custom node.
Nodes (1)
Comfy-DepthDiff
A single ComfyUI node that turns a source image into a luma/depth-driven Differential Diffusion mask — dark regions get more diffusion, light regions get preserved (or vice versa). Bakes in the model patch, VAE encode, and mask preview.

What it does
Differential Diffusion selectively re-noises regions of a latent based on a grayscale mask. DepthDiff builds that mask from your input image — either directly from luma, or by running Depth Anything V2 first — and applies everything (model patch, latent noise mask) in one node.
Install
Via ComfyUI Manager (recommended): search DepthDiff and click Install.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/spiritform/Comfy-DepthDiff.git
Restart ComfyUI.
Dependencies
Core node has no external Python dependencies — works out of the box.
Optional (only needed for depth_mode):
- Kijai's
comfyui-depthanythingv2must be installed (via ComfyUI Manager or manual clone). - Depth Anything V2 safetensors weights auto-download to
ComfyUI/models/depthanything/from Kijai/DepthAnythingV2-safetensors on first use.
If depth_mode is off, feed a pre-computed depth or luma map into the image input directly and neither is required.
Inputs
model— MODEL (patched with Differential Diffusion internally)image— IMAGE (encoded to latent internally; also the mask source)vae— VAE (used for the internal encode)mask— MASK (optional; gates the final mask, blurred bymask_blur)
Widgets:
depth_mode— if on, runs Depth Anything V2 (Kijai) on the image before extracting lumadepth_ckpt— which Depth Anything V2 safetensors checkpoint to usedepth_max_size— caps the depth pass long-side (default 1024)invert— flip the mask (default true; dark = more diffusion)input_black/input_white— levels remap (0–255)gamma,brightness,contrast— tone shapingimage_blur— edge softness on the depth/luma maskmask_blur— edge softness on the optional input maskstrength— per-pixel clip on the final maskdiff_diffusion_multiplier— global multiplier on when the mask triggers denoising during sampling (1.0 = default, >1 = more aggressive, <1 = more preservation)
Outputs
model— patched MODEL → KSamplerlatent— LATENT withnoise_maskattached → KSamplermask— MASK output for downstream use
Wiring
Load Image ─┐
├─► DepthDiff ─► model ─► KSampler
Checkpoint ─┤ ─► latent ─┘
└── VAE ┘
License
MIT