Depth of Field with the mental ray Renderer

Depth of field is a way to enhance the realism of a rendering by simulating the way a real-world camera works. With a broad depth of field, all or nearly all of a scene is in focus. With a narrow depth of field, only objects within a certain distance from the camera are in focus.

Scene rendered using no depth of field

All apples are equally in focus.

Same scene using depth of field to control focus

The middle apple is clearer than the other two.

To render depth-of-field effects with mental ray, ray tracing (the Ray Trace toggle) must be enabled on the Render Setup dialog Renderer panel Rendering Algorithms rollout. You must also enable depth of field for the camera: in the camera's Multi-Pass Effect group, choose Depth Of Field (mental ray) as the depth-of-field type. (If you choose the scanline renderer's Depth Of Field option, the rendering that results can be out of focus.)

The mental ray renderer uses the camera’s target distance and f-Stop parameters to control the depth-of-field effect.

The camera's target distance determines the focus plane. The focus plane is the distance from the camera at which the scene is completely in focus.

Focus plane in relation to a camera

Here it is set to the middle apple, as in the previous renderings.

Focus plane in relation to a camera

Here it is set to the nearest apple, as in the renderings that follow.

The f-stop controls the amount of blurring at distances other than the focus plane distance. In a real-world camera, the f-stop measures the size of the lens’s aperture. The lower the f-stop value, the larger the aperture and the narrower the depth of field. So increasing the f-stop value broadens the depth of field, and decreasing the f-stop value narrows the depth of field.

Decreasing the f-stop to narrow depth of field

Focal plane set at the nearest apple, and f-stop set to 0.1.

Increasing the f-stop to broaden depth of field

Focal plane in same location, f-stop increased to 1.0.

You set the f-Stop in the camera's Depth Of Field rollout. See Depth of Field Parameter (mental ray, iray, and Quicksilver Renderers) .

Note: For Perspective viewports, which have no camera, the Render Setup dialog Renderer panel Camera Effects rollout has explicit Focus Plane and f-Stop settings.