Gaussian Blur with Depth Map
Soft background, sharp foreground, no render engine required
- image
- depth_map
- IMAGE
Plain Gaussian Blur softens an entire image at once. This node adds one thing: it reads a depth map alongside your image and varies the blur strength by distance, so parts of the scene that are "far away" in the depth map blur differently than parts that are "close." It's the cheapest way in this pack to fake a depth-of-field effect without a render engine or a diffusion model that natively understands 3D - you just need a depth map and this node.
How it works
The node divides the depth range into num_layers bands and applies a Gaussian blur to each band, with the actual sigma (blur spread) scaled somewhere between min_blur and max_blur depending on how bright that band is in the depth map, then recombines the bands into a single image. More layers means a smoother transition across depth but more compute - the author's own docs note this "can add a lot of time" as you push it up.
The inputs and outputs that matter
image- the picture to blur.depth_map- a grayscale depth image supplied by an upstream depth estimation node (something like a Depth Anything or MiDaS preprocessor); this node doesn't generate depth data itself.sigma(1–100, default 5) - the base blur spread for this node, distinct from theamountfield on plain Gaussian Blur.num_layers(1–100, default 10) - how many depth bands the blur calculation splits into.min_blur/max_blur(1–100, default 1 / 100) - blur percentage applied to the darkest and lightest regions of the depth map, respectively.
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; the node needs a depth map source in your graph to be useful - comfyui_controlnet_aux or a dedicated Depth Anything node pack are the common ways to generate one if you don't already have that step.
Common issues & troubleshooting
The blur ends up on the wrong part of the scene. This is the thing to check first, and it's the same catch across all three depth-aware blur nodes in this pack: per the README, lighter areas of the depth map get blurred more and darker areas less. Most common depth preprocessors output white for close subjects and black for distant background. Put those together unmodified and you get more blur on your foreground and a sharper background - backwards from the classic "sharp subject, soft background" portrait look. If that's not the effect you got, invert your depth map before feeding it in.
It's slow, especially on a big batch. num_layers is the lever - 10 is the default, and dropping to 4–6 will speed things up noticeably at the cost of a slightly less smooth depth gradient in the blur.
Blur looks weak or barely there. Make sure min_blur and max_blur are actually far apart, and that your depth map has real contrast between near and far regions - a flat, low-contrast depth map won't give this node much to key off, regardless of sigma.
You want sharper, more photographic-looking bokeh instead of a soft Gaussian look. That's Lens Blur with Depth Map - same depth-driven idea, but with shaped highlights from a simulated lens aperture instead of a plain Gaussian falloff.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| depth_map | IMAGE | — | |
| sigma | INT | 51–100 | — |
| num_layers | INT | 101–100 | — |
| min_blur | INT | 11–100 | — |
| max_blur | INT | 1001–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |