Simulate Shallow Depth of Field Using Lens Blur

Simulating a shallow depth of field in post-processing allows you to isolate a subject and create realistic optical background blur (bokeh) when it was not captured in-camera. Achieving a convincing effect requires more than a simple uniform blur; it demands separating your subject from the background, constructing an accurate depth map, and applying a dedicated lens blur algorithm that mimics physical camera optics.

1. Isolate the Subject

Start by duplicating your original background layer. Use a precise selection tool—such as the Object Selection, Pen, or Quick Selection tool—to outline your main subject. Refine the edges around intricate areas like hair or clothing edges using a edge-refinement brush. Once selected, create a layer mask on the duplicated layer to keep your subject perfectly sharp and separate from the background.

2. Remove the Subject from the Background Layer

Before blurring the background, you must eliminate the foreground subject from the underlying plate to prevent blurred "ghosting" or halo edges around the subject's silhouette. On the bottom layer, make an expanded selection of your subject (expanding by 5 to 10 pixels), then apply Content-Aware Fill or clone stamping to roughly fill in the space behind the subject.

3. Create an Accurate Depth Map

Physical lenses do not blur everything behind a subject equally; blur intensity increases gradually with distance. To emulate this:

  • Add a new blank layer or an Alpha Channel to act as your depth map.
  • Use a black-to-white gradient to represent distance: pure black represents the plane of sharp focus, while white represents the furthest distance requiring the heaviest blur.
  • Paint varying shades of gray across midground elements (such as the ground plane beneath the subject's feet) to ensure a smooth, realistic transition of focus receding into the distance.

4. Apply the Lens Blur Filter

Select the filled background layer and open your software's Lens Blur filter. Set the "Depth Map Source" to the Alpha Channel or layer you created in the previous step. Configure the following parameters:

  • Blur Focal Distance: Click on the point of the image where you want the focus to remain sharp (aligning with the black area of your depth map).
  • Radius: Increase the slider to determine the intensity of the blur.
  • Iris Properties: Select a blade count (such as 7 or 8 blades) and adjust the curvature to shape the bokeh highlights naturally.
  • Specular Highlights: Boost the brightness and threshold to make out-of-focus light sources bloom into natural bokeh discs.

5. Final Edge Refinement

Apply the filter, then reactivate the top, masked subject layer. Zoom in to inspect the boundary between your sharp subject and the blurred background. If any fringing or harsh cutouts appear, soften the mask slightly using a small, soft brush or apply a subtle feather to blend the transition seamlessly.