Extensions/Comfy-DepthDiff
ComfyUI Extension

Comfy-DepthDiff

A ComfyUI extension with 1 custom node.

By spiritform·Created 12 days ago·Updated 8 days ago· 1
spiritform/Comfy-DepthDiff
Nodes1
On cloudLocal install
Categoryconditioning/depthdiff
Stars1
Updated8 days ago
Readme

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.

DepthDiff node

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):

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 by mask_blur)

Widgets:

  • depth_mode — if on, runs Depth Anything V2 (Kijai) on the image before extracting luma
  • depth_ckpt — which Depth Anything V2 safetensors checkpoint to use
  • depth_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 shaping
  • image_blur — edge softness on the depth/luma mask
  • mask_blur — edge softness on the optional input mask
  • strength — per-pixel clip on the final mask
  • diff_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 → KSampler
  • latent — LATENT with noise_mask attached → KSampler
  • mask — MASK output for downstream use

Wiring

Load Image ─┐
            ├─► DepthDiff ─► model ─► KSampler
Checkpoint ─┤              ─► latent ─┘
    └── VAE ┘

License

MIT