Aller au contenu

Defocus Node

By Kriss Norde

Defocus simulates a real photographic lens blur, with bokeh (the aperture shape showing in light sources) and blooming (a halo on the highlights). Far more photorealistic than a simple Blur.

Overview

A standard Gaussian blur softens the image evenly, but it is mathematical, not photographic. A real out-of-focus camera produces bokeh (aperture shapes visible on every point of light) and blooming (a halo around the highlights). Defocus reproduces both phenomena.

Two modes are available: Gaussian (fast, no bokeh shape) and Lens (slower, with a configurable aperture shape). Lens mode is what really sets this node apart.

Where to find this node

  • Effects Library: Tools > Blur > Defocus
  • Quick add: right-click in the Node Editor → Add Tool > Blur > Defocus

Inputs

  • Input (orange) - required. The 2D image to defocus.
  • Effect Mask (blue) - optional. A mask to limit the defocus to an area.

Setup

MediaIn → Defocus → Merge 2D → Saver

For a Z-depth driven DOF, prefer the DOF of the Renderer 3D (in a 3D scene) or use Z Blur / Depth Blur for 2D compositing based on a Z channel.

Controls tab

Filter (default: Gaussian)
Processing mode:
  • Gaussian - simple and fast, no bokeh shape. Equivalent to a classic Blur + bloom.
  • Lens - physically realistic, with the aperture shape visible on the highlights. Slower.
Lock X/Y
Applies the defocus evenly on both axes (default). Unchecking it allows an asymmetric defocus (oval rather than round).
Defocus Size
Strength of the defocus. Affects both the blur and the extent of the bloom.
Bloom Level
Strength of the halo (blooming). Controls the energy of the bright pixels that "spill" around them.
Bloom Threshold
Brightness threshold above which a pixel triggers the bloom. Low = bloom everywhere, high = bloom only on the brightest highlights (sun, neon lights, speculars).
Lens options (Lens mode only)
When Lens mode is active: Lens Type (bokeh shape), Angle, Sides (number of aperture blades), Shape. Lets you reproduce specific apertures (hexagon = 6 sides, octagon = 8…).
Clipping Mode
Frame, Domain or None - same logic as on the Blur node.

Gaussian vs Lens: which one to choose?

Gaussian mode
Fast (almost identical to a standard Blur). Ideal for general defocus where the bokeh is not visible (a scene without point highlights, a uniform background).
Lens mode
Slower, but produces real bokeh (each point of light becomes an enlarged aperture shape). Essential when the scene contains visible point lights (string lights, metallic reflections, specks of light). Without bokeh, these elements look dull once defocused.

Rule: Lens as soon as points of light are visible in the image. Gaussian for quick defocus of a uniform background.

Bloom: blooming and image flaring

Blooming is the effect where highlights "spill" onto their surroundings when they are out of focus (think of the bokeh of string lights). Defocus simulates it automatically.

Key settings:

  • High Bloom Threshold (e.g. 0.85) → only the really bright pixels bloom. A cinematic result (isolated street lamps at night).
  • Low Bloom Threshold (e.g. 0.2) → almost the whole image blooms. An unrealistic, "overexposed" result.
  • Bloom Level sets the strength of the halo after thresholding.

Defocus vs Blur: what is the difference?

Blur
A purely mathematical operation. It evens out neighboring values. The result is "mathematically correct" but not photographic. No bokeh, no bloom. Much faster.
Defocus
An optical simulation of a real lens. Produces bokeh (in Lens mode) and blooming. A photorealistic, cinematic result. Slower.

Rule: Blur for technical processing (masks, stylization), Defocus for anything that must look "like a real camera".

Use cases

  • 2D fake DOF - a blurred background with bokeh on the lights behind the subject. Lens mode, hexagon Shape, high Threshold. Far more believable than a simple Blur.
  • Title background - string lights blurred with Defocus give the classic glowing bokeh of movie titles.
  • Vintage lens simulation - choose an odd number of Sides (5, 7) to reproduce an old camera aperture with its particular aberrations.
  • Compositing a 3D element over a blurred plate - match the defocus of the plate by copying the Threshold/Size values of the Defocus applied to the CGI element.
  • Stylized dreamy look - moderate Defocus + low Bloom Threshold = a dreamlike mood with an overall halo across the shot.

Tips & pitfalls

  • Lens mode is slower but worth it - the visual difference is huge as soon as there are points of light.
  • Start with a high Threshold - see what blooms, then lower it gradually. The other way around = bloom everywhere, hard to calibrate.
  • Huge Defocus Size = long render - unlike the Fast Gaussian Blur, Defocus is not constant-time. Think twice before going to 200+.
  • For a depth-driven DOF, the Renderer 3D (in 3D) or Z Blur (in 2D with a Z channel) is a better fit. Defocus has no notion of depth - it applies evenly.
  • Asymmetric bokeh - an old lens does not produce perfectly round bokeh. Uncheck Lock X/Y or play with Angle in Lens mode to reproduce that look.
  • For a subtle but convincing effect, Defocus Size 2-5 px + moderate Bloom = a pro look without the "photoshopped" feel.