4
$\begingroup$

In blender's internal renderer DOF was highly faked, complex, and used much resources from the computer.

Cycles DOF does not seem to need anything more than the usual sample setting (and that applies to everything, not just DOF).

I intend to use DOF for quite a few projects, and I was wondering, from a perfectionist perspective, does DOF actually use more resources to render?

$\endgroup$
6
$\begingroup$

The DOF effect itself has a negligible amount of overhead. Even in a very simple test scene I just did (some monkey on a plane) there's only about a 3% difference, and that is an incredibly simple scene with HUGE dof (50cm lens radius. Not 50mm, 50cm). That overhead would normally be overwhelmed by lights, texture lookups, shader calls, etc on a full scene.

But.

Raytraced DOF (and motion blur, for that matter) creates a really insidious kind of noise. It creates a new kind of variance in camera samples. "variance" is where that render noise comes from, it refers to the possible outcomes you can get from launching a ray. For example, a ray might bounce into a light, or it might not. You get sparkly noise when you cast 2 rays and one hits the light, and the other doesn't. By firing a lot more rays the random noise will eventually average out and you get crisp images. There's lot of possible sources of variance, such as which direction a ray will bounce off a glossy surface (reflection noise), whether it will go towards the visible portion of a partially obscured light (soft shadow noise), etc. But normally, you can be assured of one thing: this noise is all in subsamples, like glossy rays or shadow rays. You can be sure that a ray taking off along a particular initial vector from the camera will always either strike a particular object, or miss it.

3D DOF and motion blur break that. They add a random factor to the ray on takeoff that can cause it sometimes hit an object, or sometimes miss it. This averages out to a transparent blur with enough samples. But until then, it's noise, and what might have otherwise been enough samples might not be enough to clear the DOF noise. So you may end up having to increase the sample count beyond what you would've needed otherwise. Additionally, if you are using branched path tracing, you may need to reduce subsample count and increase AA (primary) samples, which results in a less efficient render overall.

That said, 3D DOF has some advantages over post-processed DOF. It correctly handles reflections/refractions, which should blur reflected/refracted objects based on total path length. 2D DOF will rely on the z-buffer and incorrectly blur based on distance from the eye to the mirror/glass. 3D DOF can also correctly handle letting you "see around" out of focus foreground objects, which for 2D blur requires rendering them to a separate layer in order to get the render of the "obscurred" object.

2D DOF also lets you do some weird non-physical tricks like depth of field falling away at different rates in the foreground vs background, plus it can be faster and you can change it after rendering without having to re-render. So it all comes down to the needs of your shot.

$\endgroup$
  • 2
    $\begingroup$ This is a great answer and pretty much explains the issue for me. Thank you very much. $\endgroup$ – Pipsqweek Jul 7 '16 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.