Nodes/Virtuoso Nodes for ComfyUI/Motion Blur with Depth Map
ComfyUI Node

Motion Blur with Depth Map

Directional blur that respects distance

By chrisfreilich·Created 2 years ago·Updated about a year ago· 93
Motion Blur with Depth Map
  • image
  • depth_map
  • IMAGE
angle0
num_layers10
min_blur1
max_blur100

Plain motion blur smears the whole frame in one direction and doesn't care what's in the shot. This node cares. It takes a second image - a depth map - and uses it to vary how much motion blur each part of the picture gets, so a subject and its background can blur by different amounts instead of moving together as one flat smear. That's the difference between "this whole image looks like it was shaken" and "this looks like something in the scene was actually moving relative to something else."

How it works

You feed it your source image plus a grayscale depth map the same general layout. The node splits the depth range into num_layers bands, and for each band applies motion blur at a strength interpolated between min_blur and max_blur - then recombines the layers back into one image. More layers means a smoother gradient of blur across the depth range, at the cost of more compute; per the pack's own docs, cranking this up "can add a lot of time." Per the README's own wording, the darker regions of your depth map get blurred less, and the lighter regions get blurred more - worth internalizing before you wire it up, more on that below.

The inputs and outputs that matter

  • image - the picture you're blurring.
  • depth_map - a grayscale depth image. This node doesn't generate one for you; you need a depth preprocessor upstream (a Depth Anything or MiDaS node, most commonly) feeding this input.
  • angle (0–360, default 0) - direction of the motion streak, in degrees.
  • num_layers (1–100, default 10) - how many depth bands the blur is calculated across. Higher is smoother but slower.
  • min_blur / max_blur (1–100 each) - the blur percentage applied to the darkest and lightest areas of the depth map respectively. min_blur defaults to 1 (near-zero blur on dark areas), max_blur defaults to 100 (full blur on light areas).

Output is a single IMAGE.

How to install it

ComfyUI Manager: search Virtuoso Nodes for ComfyUI, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/chrisfreilich/virtuoso-nodes
pip install -r virtuoso-nodes/requirements.txt

Restart. This node itself needs no model weights, but it's only as good as the depth map you hand it - you'll want a depth estimation node pack (comfyui_controlnet_aux is the common one, or Kijai's ComfyUI-DepthAnythingV2) already installed and producing depth maps in your graph.

Common issues & troubleshooting

The blur is on the "wrong" part of the image. This is the one thing worth knowing going in. Standard depth preprocessors (Depth Anything, most MiDaS variants) output white for close, black for far. This node blurs the lighter areas more. Put those together and a typical depth map will blur your foreground more and leave the background sharper - the opposite of the classic "sharp subject, soft background" look. If that's not what you want, run your depth map through an Invert Image node first (or check whether your depth preprocessor node has its own invert option) before it hits depth_map.

It's slow. num_layers is the dial. Ten is the default and a reasonable middle ground; if a batch run is dragging, drop it to 4–5 layers before you conclude the node itself is the bottleneck.

Blur is barely visible. Check that min_blur and max_blur actually span a meaningful range for your image - if your depth map is mostly one shade (a fairly flat scene), the effect will read as close to uniform regardless of these settings, because there isn't much depth variation to key off.

CategoryVirtuoso/Blur

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
depth_mapIMAGE
angleINT00–360
num_layersINT101–100
min_blurINT11–100
max_blurINT1001–100

Outputs (1)

NameTypeDescription
IMAGEIMAGE