Simulate optical distance blur.
- [Narrator] Arnold accurately simulates camera optics, such as depth of field, or bokeh. In this close-up shot, we can direct viewer attention by de-focusing the foreground or background. In this demo, we'll animate a rack focus effect using the Arnold camera attributes. Let's first do a baseline draft render with no depth of field applied. With focus on the camera two viewport, go up to the menus and choose Arnold, Render.
When that rendering completes, let's store it as a snapshot in the Arnold Renderview, click on the camera icon, and now let's go to the camera attributes, select camera two in the viewport and open the attributes with control A. In the camera's shape note attributes, scroll down a little bit, and open up the Arnold section if necessary, and in the middle here, we have the depth of field section. We can turn on the checkbox to enable DOF, or depth of field, but we won't see any change in the Arnold RenderView yet, because the aperture size is set to zero.
That's the size of the iris that let's light into the virtual sensor, and it's range here is from zero to one centimeter, and if we drag this all the way up to it's maximum of one, then we have a very very large aperture resulting in an extremely blurry image, but we also need to set the focus distance, and that of course is the distance away from the camera at which an object will be perfectly in focus.
We can bring that focus distance value up, and actually the flowers are at about 40 centimeters away, so I can just type in 40 here, and we'll let that finish rendering. When that rendering completes, let's also store it as a snapshot, and it looks like we got pretty good settings to give focus to the flowers in the foreground at 40 centimeters away from the camera's filmback. Here's a version with no depth of field effect in snapshot one, and in snapshot two we see the depth of field effect.
We can go back to a live render by clicking on the little eye icon. Let's animate a rack focus effect. In the timeline, set the current frame to frame 15, and then in the attribute editor, right click on the focus distance name or label and choose Set key from the pop-up dialogue, and the attribute turns bright red indicating that we're parked on a key frame. Now let's go to frame one, scroll back to frame one of the timeline, and now focus distance is shown in pink indicating that there's a curve attached, but we're not currently parked on a key frame.
The matte painting or backdrop object is about three meters away, so let's set the focus distance to 300 units, and then right click, and set key once again, and let's go ahead and let this rendering complete once again. When that rendering completes, we'll once again store it as a snapshot, and we can get a sense of the rack focus effect by selecting these snapshots. Here in snapshot three I've got focus on the background, and in snapshot two focus on the foreground.
I can toggle between these and get a sense of what that rack focus might look like. We'll go back to a live rendering by clicking the eye icon. What we cannot see here is that the focus distance function curve needs to be adjusted for a natural looking rack focus. If we rendered this now, it wouldn't look like a linear transition. We need to create a extreme slow in on the lack key frame, so let's go ahead and open up the graph editor with the camera selected, go into the Windows menu, and choose Animation Editors, Graph Editor, and we see the function curve for a high focus distance displayed.
Select that curve by dragging a rectangle around it, and go into the graph editor menu to curves, and choose weighted tangents. Then, drag a rectangle to select both the key frames up in the toolbar we've got an icon labeled Free Tangent Length, and if that's on then the selected key frames should have stretchy tangent handles. On this last key frame, drag a rectangle with the left mouse button to select that tangent handle, hold down the shift key and use the middle mouse button to drag over to the left, and we're stretching that handle to create an extreme slow in, and likewise with this key frame at the beginning, drag the left mouse button to select that key frame, and then also drag the left mouse button to select the key frame tangent handle.
Once that's highlighted, hold down shift, and use middle mouse button to shorten this tangent handle. We do want a slow out, but we want it to be a very short duration slow out of only a few frames, so we've got that down to actually only one frame slow out, so let's make it slightly longer than that with shift and middle mouse button. Now the function curve is in an unusual-looking state, but that is what we need for situations such as this, where an attribute based on camera distance needs an exponential curve, and that makes it look like a linear transition.
Before we can really render anything, we need to change the render settings, so we'll close the graph editor, go into the Render Settings dialogue, and in the Arnold Renderer tab, we have a sampling attributes. Increase the number of camera samples to six, and the number of diffuse and specular samples to three each, and this should be high enough quality that we get rid of most of the grain, but of course it will take a lot longer to render.
In the next movie we'll look at rendering an image sequence, and that's how to set up a depth of field effect and animate a rack focus with the Arnold camera attributes.
- Arnold rendering concepts
- Lighting with Maya and Arnold lights
- Controlling exposure
- Filtering light with Gobo
- Light attenuation with Decay
- Image-based lighting with Skydome
- Exterior daylight with Physical Sky
- Arnold Standard Surface material attributes
- Mapping material attributes
- Rendering refractions
- Mesh subdivision and displacement at render time
- Shading effects such as ambient occlusion and vertex color
- Camera effects such as fisheye and depth of field
- Animation image sequence rendering