In this short tutorial, we will cover the process of setting up and rendering out a 'Z' depth AOV which can then be composited with the beauty render in Nuke to achieve a realistic depth of field effect. The 'Z' depth AOV contains the depth information of the shading points.
That concludes this short tutorial. The benefits of using a Z Depth AOV are obviously speed and flexibility. Being able to make changes to the depth of field in the compositor in real time is a big advantage. Rendering with true depth of field, while looking better in most cases, can require a large number of AA samples to resolve issues with noise. Below is a comparison between rendering true depth of field and rendering the scene without DOF (using a composited 'Z' depth AOV). Even with 8 Camera (AA) samples, there is still some noise in the heavy depth of field areas of the image rendered with true depth of field. In this case, the render with true DOF took about twice as long to render as the image using a Z Depth AOV.
There are limitations to using a 'Z' depth AOV. For example, it is not possible to focus on an object reflected in a mirror (see below):
3d scan model courtesy of Ten24.