Depth of Field HQ Blur

The depth of field HQ effect performs a gradient blur on regions of the image based on their deviation from a specified distance from the camera.

In the image below, the effect is applied in the right picture. Notice that the cube and same-distance floor are in focus while the closer cone and farther sphere are blurred.


Focus distanceThe distance from the camera where the content is in perfect focus.
Depth of fieldThe distance around the Focus Distance where items are fully in focus. The focus then fades away to fully blurred by the same distance on both the near and far sides.
Debug focus renderingAllows you to see exactly how the focus variables work.


For this effect to work well, you need to adjust the Clipping start and Clipping end properties of the camera for the layer to frame the content. You ideally want the largest possible value for Clipping start and the smallest possible value for Clipping end. Next, adjust the properties of the effect for the desired result.

For example, a Focus distance of 100 and a Depth of field of 20 means that everything that is between 90 and 110 units away from the camera will be entirely in focus, items at a distance of 70-90 and 110-130 units will experience variable blurring, and everything closer than 70 or farther than 130 will be entirely blurred.

To make it easier to set up this effect, enable Debug focus rendering. When enabled, the scene view switches to a mode showing the amount of blur to be applied. Anything completely fogged in white is entirely blurred, anything that is fully black is entirely in focus, and shades of grey represent varying amounts of blur in between. It is far easier to turn on this mode and adjust the values in the inspector palette until the content you want is bracketed, compared to performing distance calculations and entering numbers.

Available under certain Qt licenses.
Find out more.