Depth of Field

The Brazil R/S (and Rio) comes with the ability to render physically correct depth-of-field (DOF). This is the effect of things falling out of focus when they are closer or further away from the camera's focal plane. More info on DOF here. Brazil, in it's physically-correctness, simulates the Bokeh effect of defocussing. This makes out-of-focus bright spots take on the shape of the camera aperture. More info on the Bokeh effect can be found here. That said, let's get down to dealing with how you can use DOF, and then move on to tips for DOF usage and speed.

If you'd like to follow along with your own scene, get something ready. As you can see above, my scene is just some teapots at various distances from the camera. Everything is in focus, from the nearest teapot spout, to the teapot way back against the wall. Having a large range of distance in your scene will make it easier to see the effects of the DOF.

There are two places you can control the DOF effect. There is a full set of controls in the render dialog, and a little set of controls on the Brazil Camera.

Generally, the controls are set up so that you can have your global DOF sampling controls in the render dialog, and your per-camera focal depth and aperture settings on each camera. The camera-level settings override the render dialog settings, as lonf as the camera settings are activated. Otherwise, the render dialog settings will be in effect for any viewport you render.

First off, to get the DOF going, you will need to activate it in the render dialog. Check the 'On' checkbox and DOF will be activated. If you gave your scene a render now, it would most likely be a) slow to render if you had image sampling set above 0/0 b) be grainy and c) not have the right focal point, like so:

To correct this, the first thing we want to do is to set the focal point for our camera. So we want to select the camera, activate the depth of field area, and check the 'show' checkbox. This will make the focal plane appear in the viewports (but not in the camera view). Spin the Focus Distance spinner until the focal plane intersects something around the middle of your scene. I chose the third teapot from the camera in mine.

If you give your scene a render now, you should have a better focal point, with things falling out of focus in front of and behind your middle object:

Changing this focus distance setting will slide the focus back and forth in your scene:

So that is how you determine what is the most in focus. Next we need to determine how blurry everything else gets. If you change the F-Stop setting, it will determine how quickly things fall out of focus before and after your focal plane. Higher numbers will make for less blur, lower numbers for more blur.

As you can see, the middle teapot is always on the focal plane in the three images above, but the amount of blur changes.

The next thing to address is the graininess. There are three settings that control the quality of the DOF (we are seeing the low quality as grain). The Initial Rate, Adapt Levels and Jitter settings all have an effect on the smoothness of the blur. The initial Rate setting is the number of samples to be used per image sample for the blur. The Adapt Levels setting is the number of times the blur will be refined. The jitter setting, much as it is anywhere else it is used, just controls the random placement of the sample, as to avoid any patterns from emerging. Below is my scene, using an F-Stop of 8, so you can see how the quality improves as i change the settings, and also how the render times are affected.

In the above image, as you can see, our DOF is nice and smooth, but there are still anti-aliasing problems on the focal plane. This is because. so far, I have been using image samples of 0/0. The DOF sampling takes care of smoothing out all the blurry areas, but the spot that is in focus is left to the image samples to deal with. Generally you can get away with lower images samples then usual, while using DOF, like the image below, where the sampling is set to 0/1:

There are some controls under the bokeh section, dealing with what image filter to use and settings for that filter. This section mostly just determines how the blurring is done. This is most noticable when you have tiny points of brightness that go out of focus. Some of the image filters, and the flat disc type will make those bright points blur into discs, while the linear fade and exponent types will result in those spots blurring to ring shapes. The invert checkbox will cause the ring ones to turn to discs, and the discs to turn to rings. The invert at focus will cause them to be rings on one side of the focal plane and discs on the other.

Thats pretty much it for how DOF works, so here are a few tips for general usage:

1) You can get away with lower images samples when using dof. You can test out your focal plane settings with the images samples set to 0/0 or even negative numbers, and then slowly increase the maximum number until the aliasing at the focal plane disappears.

2) Be aware that image samples, gi samples and dof samples compound each other. Add into this other features like sub-surface scattering, glossy reflections/refractions or dispersion without taking this compounding into account and you will be looking at some incredibly long render times. Just remember that for each image sample there will be a given number of dof samples, and for those dof samples there will be your given number of gi/sss/glossy samples, etc. When working with dof, you can get away with much lower settings for alot of things because either the dof will multiply the samples for you, or those things will be blurry anyway, covering up low sample rates.

3) Regathering and DOF don't work together. If you've got a photon gi solution and want to then regather and turn DOF on, there are a few problems: 1) you are crazy, that would take forever to render 2) it doesn't work anyway, probaby to crazy-proof the renderer. You would be stuck with either just photon gi and DOF or just QMC gi and DOF, but not photon + QMC. C'est la vie.

Okay, that's all I have to say about Depth of Field in Brazil. Hopefully this was helpful :) Feel free to email me via the contact button at the top with any further questions or comments.

--



All images, elements and content are property of nathan fariss and/or real media digital production. all rights reserved.