Skip to content
SPBokeh Documentation
Buy SPBokeh

Using a depth map in After Effects

Platform
After Effects
Depth map
Required for distance-based focus

A depth map gives different parts of the same image different amounts of blur. SPBokeh reads an external grayscale image and uses it to decide which distances are in focus.

Understand the grayscale values

By default, white is near and black is far. Intermediate grays represent positions between them. If your depth map uses the opposite convention, turn on Depth Invert in the Advanced section.

SPBokeh reads the source layer's RGB luminance, not its transparency, as depth. A grayscale RGB image is the easiest input to work with.

Far Near Default Depth Invert Far Near

Connect the depth layer

  1. Prepare a depth map for the same shot and time range as the original footage.
  2. Bring it into the composition and check its alignment against the footage.
  3. Apply SPBokeh to the image or effect layer you want to process.
  4. Under Focus & Depth, choose the depth source in Depth Layer.
  5. Adjust Focus Distance between 0 (far) and 1 (near) to select the plane that stays sharp.
  6. If the near/far behavior is reversed, use Advanced > Depth Invert.

Depth images with different dimensions can be sampled with alignment adjustments, but a same-size precomposition often makes the relationship easier to check. Cropping, transforms, and upstream effects can change the RGB data that reaches the plugin.

Keep a particular region clear instead

If you don't have a depth map, Mask Layer can use an external grayscale image as a focus map: white is sharp, black is blurred. This is a different mode from true depth. Focus Distance and AE Auto Focus require a valid Depth Layer, and do not turn an ordinary focus mask into distance data.

If both Depth Layer and Mask Layer are assigned and valid, Depth Layer takes priority; the two external inputs are not combined. The independent Built-in Mask can, however, be mixed with depth-driven blur using Influence.

Refine the boundary

Use Matte Expand to expand or erode the brighter regions of the depth data, then Edge Feather to soften the resulting focus boundary. For a bright rim of subject color in the background bokeh, see Advanced transitions & occlusion.