Depth of Field with Mental Ray and After Effects
Maya 2012 Tutorial
How to Add Depth of Field to Maya Scenes with After Effects
In photography we use depth of field to make some objects in focus and others blurry. Depth of field is accomplished by camera placement and adjusting the camera's aperture.
You can accomplish the same thing in Maya by activating dept of field in the camera options. For more information, see topic, Depth of Field.
In this example we will render a series of images in Maya and apply the depth of field post production in After Effects.
Create a new project, set your project and save a new scene in the scenes folder. For more information, see topic, Starting a Project.
Add three polygon primitives to the stage by choosing Create > Polygon Primitives > Cone, Cube and Cylinder.
In the top view, use the Move tool (w key) to move the objects so there is at least 10 units spacing between objects in the z direction.
Click the cube, then right-click the cube and choose Assign New Material > Blinn. Repeat the process for the other two objects.
Press the 5 key to see your objects in Smooth Shade view. Click the objects one at a time, open the Attribute Editor, then click the Color rectangle to change the object's color. Change the color for all three objects.
Click the Render Settings icon to open the Render Settings panel. Choose Render Using: Mental Ray.
Click the Quality tab and choose Quality Presets: Production.
Click the Common tab, File Output section and enter <Scene>_<RenderLayer> in the File Name Prefix box. If you right-click the box you can choose Scene and Render Layer from the pull-down menu. Change the Image Format to Targa (tga).
Open the Channel Box/Layer Editor, then click the Render tab in the lower part of the panel.
Click the cube, then click the Create New Layer and Assign Selected Objects icon. A new render layer is created that only includes the cube.
Repeat the process for the cone and once again for the cylinder.
Name each of the layers to correspond with it's content (i.e., cone, cube and cylinder). The new layers should have a green checkmark and the masterLayer displays a red X to indicate it is deactivated.
Choose Render > Batch Render from the Rendering menu set.
The three rendered images, one for each object, can be found in the project's images folder.
Open After Effects and open a new comp by choosing Composition > New Composition. Set the comp size to match your Maya images, then press OK.
Choose File > Import > File to navigate to your project's images folder. Click the first file, then shift click the last file and choose Open.
In the Interpret Alpha dialog box, choose Straight - Unmatted for all three images.
Drag the three images in the correct order from the Project panel to the Comp panel. If the order needs adjusting re-order the layers in the Timeline. The closest object should be the top layer and the furthest object goes on the bottom layer.
Select the middle layer in the Timeline and choose Effect > Blur & Sharpen> Gaussian Blur. Adjust the Blurriness value in the Effect Controls panel.
Repeat the process for the bottom layer in the Timeline.
Step Twenty One
Click the comp in the Project panel and choose Composition > Add to Render Queue.
Step Twenty Two
Open the Render Queue panel, select your project and assign it an Output to: name and location. Press the Render button to render your composite.
Consider Render Passes
With Mental Ray you can take this process several steps further with Render Passes. Render Passes allow you to render separate passes for object properties such as diffuse, specular, reflection, etc. For more information, see topic, Render Passes and Mental Ray.
Can't Find Mental Ray?
If Mental Ray doesn't appear in the Render Settings, Render Using: menu, choose Window > Settings/Preferences > Plug-in Manager. Make sure Mayatomr.bundle is loaded.