The "Z-Depth Bokeh Blur" preset adds a group of nodes that uses the camera's focus distance as the reference and blurs areas away from it. This example places the Suzanne in front about 23m from the camera and the large blue Suzanne in the back about 80m away.
Starting scene demonstrated on a Suzanne in front and a blue Suzanne in the back
Steps
Set the camera's "Focus Distance" under "Depth of Field" to the distance to the object you want in focus (about 23m here).
Open the "Compositing" workspace at the top of the screen to show the Compositor.
Select the "Smart Composite" tab in the Sidebar (N key).
Open the "Effects / Presets" section header.
In the "Preset to Add" list, choose "Z-Depth Bokeh Blur", then click "Apply Selected Effect".
Render again (F12) and check the result.
For more blur, lower the F-stop of the "SCS Aperture Defocus" node inside the Frame and render again.
Follow the changes on screen
BeforeBefore adding Z-Depth Bokeh Blur. The outline of the blue Suzanne in the back is also crisp.Right After ClickingThe result after applying "Z-Depth Bokeh Blur" and rendering again. The blue Suzanne in the back is blurred.Open the ApertureThe result with the F-stop of "SCS Aperture Defocus" set to 0.3. The back is blurred even more.