Math set to ‘depth’ seems to give nice results.
Although it’s far more common to render 3D images without Depth-Of-Field (DOF) as it renders quicker and offers some flexibility in compositing. In some situations that isn’t always the case as large ZBlur’s within Nuke can take a heck of a long time to render. In fact depending on your scene and your renderer it’s often quicker to render DOF in 3d than it is to apply it as a post process in 2d.
- Flexibility in compositing. Can adjust effect as needed.
- Quicker to render.
- Can be inaccurate – no physically based parameters (although this is largely dependant on the plugin used. The effect is driven by the artist.
- Large blurs are slow to render.
- Prone to artifacts. Can’t handle certain situations at all without lot’s of hackery.
- No Flexibility in compositing.
- Slower to render.
- Accurate. Physically based parameters.
- Requires more pixel samples in order to avoid noisy renders.
The following render was done at 2048×1556 and was rendered without any DOF. The total render took 83 seconds. The Depth AOV was rendered using a Zmin filter with a filterwidth of 1×1 in order to avoid anti-aliasing in the render.
I also rendered the same image with DOF on.
Unfortunately my plan to show the difference between the two full resolution images was put on hold by Nuke taking far too long to render the full resolution ZBlur. I gave up after 10 minutes so decided to concentrate on a particular region.
The following 1:1 crop demonstrates the difference between Post DOF and Rendered DOF.
Keep in mind that the Nuke time for the Post DOF was only for the crop area your seeing above – it was taking too long to render the full image with Post DOF. As you can see the Post DOF breaks down quite heavily in some places, while the rendered DOF image did take longer to render, it’s much more accurate and the read time of the image is less than a second in Nuke.
- The rendered DOF spent less time ray-tracing and more time spent on sampling the image. This was due to the increase in pixel samples in order to get less noisy results and higher focus factor.
- With pixel samples at 3×3 the DOF render took 57 seconds, faster than the 83 seconds that it took to render the Non-DOF version although the final result was unacceptable. For less extreme blurs pixel samples could be set as low as 6×6.
- Focus Factor parameter in 3Delight helps speed up DOF renders by reducing the shading rate in areas of high blur with very little perceivable difference.
- Despite some noise, the end result is much more visually pleasing than the ZBlur result in Nuke.