Chapter 12

Rendering for Compositing

The Autodesk® Maya® software offers a number of options for dividing the individual elements of a render into separate passes. These passes can then be reassembled and processed with additional effects using compositing software such as Adobe After Effects, Autodesk Composite, or The Foundry Nuke. In this chapter, you’ll learn how to use the render layers in Maya and render passes with the mental ray® renderer to split rendered images into elements that can then be used in your compositing software.

For best results when working on the project files in this chapter, you should copy the chapter12 project folder to your local drive and make sure that it is the current project by choosing File ⇒ Set Project. Doing so will ensure that links to textures and Final Gathering maps remain intact and that the scenes render correctly. In this c

hapter, you will learn to:

  • Use render layers
  • Use render passes
  • Perform batch renders
  • Use mental ray quality settings

Render Layers

Render layers are best used to isolate geometry, shaders, and lighting to create different versions of the same animation. Render layers can be used to create a balance between efficiency and flexibility. You have an enormous amount of creative flexibility when using render layers. This chapter explains the typical workflow; however, you may develop your own way of using render layers over time.

You can create and manage render layers using the Layer Editor in Render mode (called the Render Layer Editor). You can access the Layer Editor in the lower-right corner of the interface layout, just below the Channel Box.

Besides Render mode, the Layer Editor has Display and Animation modes. These three modes are the three types of layers that you can create in Maya. You change the mode by clicking one of the tabs at the top of the Layer Editor. Figure 12-1 shows the Render Layer Editor with a scene that has two custom render layers and the default render layer.

Figure 12-1 The Render Layer Editor is a mode of the Layer Editor, which is found below the Channel Box on the lower right of the default interface.

c12f001.tif

By default, every Maya scene has at least one render layer labeled masterLayer. All the lights and geometry of the scene are included in masterLayer. When you create a new render layer, you can specify precisely which lights and objects are included in that layer. As you add render layers, you can create alternate lights for each layer, use different shaders on each piece of geometry, render one layer using mental ray and another using Maya Software, use indirect lighting effects on one layer and not on another, and so on. A render layer can be rendered using any camera, or you can specify which camera renders which layer. In this section, you’ll use many of these techniques to render different versions of the same scene.

Creating Render Layers

In this exercise, you’ll render Anthony Honn’s vehicle model in a studio environment and in an outdoor setting. Furthermore, the car is rendered using a different shader on the body for each layer.

Start by opening the carComposite_v01.ma scene from the chapter12scenes folder at the book’s web page (www.sybex.com/go/masteringmaya2014).

The scene is set up in a studio environment. The lighting consists of two point lights that have mental ray Physical Light shaders applied. These lights create the shadows and are reflected in the body of the car. An Area light and a Directional light are used as simple fill lights.

The car itself uses several mia materials for the metallic, glass, chrome, and rubber parts. The body uses a shading network that combines the mib_glossy_reflection shader and the mi_metallic_paint_x shader.

The shader used for the car body is named blueCarBody. You can select it in the Hypershade and graph the input and output connections in the Work Area to see how the shader is arranged. (Select the shader in the Hypershade, and choose Graph ⇒ Input And Output Connections from the Hypershade menu bar.) Figure 12-2 shows the graphed network.

Figure 12-2 The blueCarBody shader is graphed in the Work Area of the Hypershade.

c12f002.tif

The renderCam camera has a lens shader applied to correct the exposure of the image. As you learned in Chapter 10, “mental ray Shading Techniques,” mia materials and physical lights are physically accurate, which means their range of values does not always look correct when displayed on a computer screen. The mia_exposure_simple lens shader is applied to the camera to make sure the scene looks acceptable when rendered.

To create two alternative versions of the scene, you’ll want to use two separate render layers:

  • The first render layer will look exactly like the current scene.
  • The second render layer will use a different shader for the car body and the Physical Sun and Sky network to create the look of outdoor lighting.

Generally, when you start to add render layers, the master layer is not rendered; only the layers that you add to the scene are used for rendering.

The first step is to create a new render layer for the scene:

1. In the carComposite_v01.ma scene, open the Render View window, and create a test render using the renderCam camera. It may take a minute or so to create the render (see Figure 12-3).
2. Set the Layer Editor mode to Render.
3. You can quickly add all the scene elements to a new layer by simply copying the layer:
a. Select the masterLayer label in the Layer Editor.
b. Right-click, and choose Copy Layer.
This creates a duplicate of the layer called defaultRenderLayer1 in the editor using all the same settings. See the upper-left segment of Figure 12-4.
4. In the Layer Editor, double-click the label for the new layer and rename it studioLighting.This is shown in the top-right image in Figure 12-4.

Figure 12-3 The scene shows a typical studio lighting and carComposite_v01.ma shading arrangement for the car.

c12f003.tif

Figure 12-4 Copy masterLayer (top-left image) and rename it studioLighting (top right). Deactivate the Render All Layers option (bottom left), and turn off the masterLayer render option (bottom right).

c12f004.tif
5. In the menu bar for the Render Layer Editor, select Options, and make sure Render All Layers is not activated. This is shown in the bottom-left image in Figure 12-4.
Right now you’re interested in rendering only a single layer at a time. If this option is on, Maya will render all the layers each time you create a test render in the render view.
6. By masterLayer, click the leftmost icon—the clapboard—so that a red X appears. Doing so deactivates this render layer so that it is not renderable. This is shown in the bottom-right image in Figure 12-4.
7. Select the studioLighting layer in the Layer Editor so that it is highlighted in blue.
8. Open the Render View window, and create a test render using the renderCam camera. It should look exactly the same as the render from step 1.
9. Save the scene as carComposite_v02.ma.

Copying a layer is a fast and easy way to create a new render layer. You can instead create an empty layer as follows:

1. Choose Create Empty Layer from the Layers menu in the Layer Editor when in Render mode.
2. Select objects in the scene.
3. Right-click the new layer.
4. Choose Add Selected Objects from the context menu.

Another way to create a new layer is to select objects in the scene, and choose Create Layer From Selected from the Layers menu. A new render layer containing all the selected objects is created.

You can add new objects at any time by right-clicking the render layer and choosing Add Selected Objects. Likewise, you can remove objects by selecting the objects and choosing Remove Selected Objects. You can delete a render layer by right-clicking the layer and choosing Delete Layer. This does not delete the objects, lights, or shaders in the scene, but just the layer itself.

To see a version of the scene up to this point, open the carComposite_v02.ma scene from the chapter12scenes folder at the book’s web page.

An object’s visibility can be on for one render layer and off for another. Likewise, if an object is on a display layer and a render layer, the display layer’s visibility affects whether the object is visible in the render layer. This is easy to forget, and you may find yourself unable to figure out why an object that has been added to a render layer is not visible. Remember to double-check the settings in the Layer Editor’s Display mode if you can’t see a particular object.

You can use the Relationship Editor to see the layers to which an object belongs. Choose Window ⇒ Relationship Editors ⇒ Render Layers.

Render Layer Overrides

To create a different lighting and shading setup for a second layer, you’ll use render layer overrides. An override changes an attribute for a specific layer. So, for example, if you wanted Final Gathering to calculate on one layer but not another, you would create an override in the Render Settings window from the Final Gathering attribute. To create an override, right-click next to an attribute and choose Create Layer Override. As long as you are working in a particular layer that has an override enabled for an attribute, you’ll see the label of the attribute highlighted in orange. Settings created in the master layer apply to all other layers unless there is an override.

This next exercise shows you how to use overrides as you create a new layer for the outdoor lighting of the car:

1. Continue with the scene from the previous section, or open the carComposite_v02.ma scene from the chapter12scenes folder at the book’s web page.
2. In the Outliner, select the vehicle group.
3. Shift+click the ground object.
4. In the Render Layer Editor, choose Layers ⇒ Create Layer From Selected.
5. Select the new layer so that it is highlighted in blue, and rename it outdoorLighting.
If a group such as the vehicle group is added to a render layer, all of its children are part of that layer. If you want to add just a part, such as the wheels, select the geometry (or subgroup) and add that to the render layer rather than the entire group.
Currently this layer has no lighting so, if you render it, the layer will appear dark (the default light in the render settings is off). That’s fine because at this point you want to create a Physical Sun and Sky network for this layer.
6. Make sure that the outdoorLighting layer is selected in the Render Layer Editor. This ensures that you are currently in this layer and that any changes you make to the lighting or shading will appear in this layer.
7. In the Render Layer Editor, click the Render Settings icon (of the three icons, it’s the farthest to the right), which opens the Render Settings window for the current layer.
In the Render Settings window, you’ll notice outdoorLighting is selected in the Render Layer menu at the top. You can use this menu to switch between settings for the different layers.
8. Switch to the Indirect Lighting tab, and click the Create button for the Physical Sun and Sky.
This button creates a series of nodes, including the Sun Direction light, the Physical Sky node, and the mia_exposure lens shader, for all the lights in the scene. It also enables Final Gathering in the Render Settings window.
9. In the Render Settings window, RMB+click the label Final Gathering and choose Create Layer Override (see Figure 12-5). You’ll see that the Final Gathering label turns orange, letting you know this setting has an override for the current layer (outdoorLighting).

Figure 12-5 Create a layer override for Final Gathering in the Render Settings window for the outdoorLighting layer.

c12f005.tif
10. You want Final Gathering only for the outdoorLighting layer. In the Render Settings window, select masterLayer from the Render Layer drop-down menu. Turn off Final Gathering while this layer is selected.
11. Select the studioLighting layer from the Render Layer menu in the Render Settings window. Final Gathering should now be off for this layer as well.
12. Select outdoorLighting, and you’ll see that Final Gathering is enabled and the label is still orange.
This is the basic workflow for creating a render layer override. How do you know which settings can be overridden? Most attributes related to lighting and shading can be overridden on most nodes. You can always right-click next to the attribute layer and see whether the Create Layer Override setting is available.
13. In the Render View window, create a test render, but make sure outdoorLighting is still the selected render layer. The render will take 4 or 5 minutes (depending on your computer’s speed and available RAM).
The render is obviously quite different from the render created for the studioLighting layer (see Figure 12-6).

Figure 12-6 The lighting in the outdoorLighting layer is very different from the lighting in the studioLighting layer.

c12f006.tif
14. Store the render in the Render View window (from the File menu in the Render View window, choose Keep Image In Render View).
15. In Render mode of the Layer Editor, select the studioLighting layer, and create another test render.

Something has gone wrong; the lighting has changed for this layer. Final Gathering is not calculating, but you’ll see that the render takes a long time and the lighting no longer matches the original studioLighting render. This is not because of render layers per se, but because of the Physical Sun and Sky network that was added to the scene. Remember from Chapter 9, “Lighting with mental ray,” that when you add a Physical Sun and Sky network, a number of nodes are added to the scene, including the renderable cameras. Normally this feature saves time and work, but in this case it’s working against the scene.

The easiest way to fix the problem is to create a duplicate render camera. One camera can be used to render the studioLighting layer; the other can be used to render the outdoorLighting layer. You can make sure that the correct lens shaders are applied to both cameras. You can use overrides to specify which camera is available from which layer.

1. Select the renderCam camera in the Outliner. Rename it outdoorCam.
2. Duplicate outdoorCam, and rename the duplicate studioCam.
3. Open the Attribute Editor for studioCam.
4. Switch to the studioCamShape tab, and expand the mental ray section.
You’ll see that there are no lens or environment shaders attached to the studioCam camera. If you switch to the outdoorCam camera, you’ll see the mia_physicalsky1 shader in the Environment Shader slot and the mia_exposure_simple2 shader in the Lens Shader slot. The original renderCam camera had a mia_exposure_simple1 node in the Lens Shader slot, but this was replaced by mia_exposure_simple2 when the Physical Sun and Sky network was added to the scene. The solution here is to reattach the mia_exposure_simple1 node to the lens shader of studioCam.
5. Open the Hypershade window, and switch to the Utilities tab.
6. MMB-drag mia_exposure_simple1 (you can see the full name if you hold the mouse pointer over the icon) down to the Lens Shader slot for studioCam (see Figure 12-7).

Figure 12-7 Attach the mia_exposure_simple1 node to the Lens Shader slot of studioCam.

c12f007.tif
7. In the Hypershade, select the mia_physicalsky1 node on the Utilities tab, and open its Attribute Editor to the mia_physicalsky1 tab.
8. Right-click the check box next to the On attribute, and choose Create Layer Override. The attribute label should turn orange.
9. After adding the override, deselect the check box for this attribute to turn it off for this layer.
10. Create a test render in the Render View window, and make sure that studioCam is chosen as the rendering camera. The render now looks like it did at the start of the section.
11. Save the scene as carComposite_v03.ma.

To see a version of the scene up to this point, open the carComposite_v03.ma scene from the chapter12scenes folder at the book’s web page.


Animated Cameras
You can use a parent constraint to attach the duplicate camera to the original if the original camera is animated. To do this, follow these steps:
1. Select the original camera.
2. Shift+click the duplicate.
3. Switch to the Animation menu set.
4. Choose Constrain ⇒ Parent ⇒ Options.
5. In the options, turn off Maintain Offset, and turn on All for both Translate and Rotate.
Animation constraints are covered in Chapter 5, “Animation Techniques.”

Creating Overrides for Rendering Cameras

Notice that you do not need to add cameras to render layers when you add them to a scene. You can if you want, but it makes no difference. The cameras that render the scene are listed on the Common tab of the Render Settings window.

If you’re rendering an animated sequence using two cameras with different settings as in the carComposite example, you’ll want to use overrides so that you don’t render more images than you need.

1. Continue with the scene from the previous section, or open the carComposite_v03.ma scene from the chapter12scenes folder at the book’s web page.
2. Open the Render Settings window.
3. Make sure that the Render Layer menu at the top of the Render Settings window is set to studioLighting.
4. Switch to the Common tab, and expand the Renderable Cameras rollout.
5. Use the Renderable Camera menu to choose the studioCam camera.
6. Right-click on Renderable Camera, and choose Create Layer Override (see Figure 12-8).

Figure 12-8 Create a layer override for the rendering camera on the studioLighting layer.

c12f008.tif
7. Set the Render Layer drop-down list at the top of the Render Settings window to outdoorLighting.
8. From the Renderable Camera menu, choose outdoorCam.
9. Right-click next to the menu, and choose Create Layer Override. (In some cases, Maya creates the override for you if you already have an override for the same setting on another layer.)
10. Switch between the studioLighting layer and the outdoorLighting layer, and make sure that the correct camera is selected for each layer.
Maya may add the outdoorCam as a renderable camera to the studioLighting layer. If this happens, click the trash can icon next to the outdoorCam to remove it from this layer as a renderable camera.
It is important to take these steps to ensure that the right camera will render the correct layer; otherwise, you may waste time rendering images from the wrong camera.
11. Save the scene as carComposite_v04.ma.

To see a version of the scene up to this point, open the carComposite_v04.ma scene from the chapter12scenes folder at the book’s web page.

After you create the overrides for the cameras, it is still possible to render with either camera in the render view. The overrides ensure that the correct camera is used for each layer during a batch render.

Using Different Shaders on Render Layers

The flexibility of render layers becomes even more apparent when you apply different shaders to the same object on different layers. This allows you to render alternate versions of the same animation.

1. Continue with the scene from the previous section, or open the carComposite_v04.ma scene from the chapter12scenes folder at the book’s web page.
2. In the Render Layer Editor, select the outdoorLighting layer. Open the Hypershade.
3. In the Outliner, expand the vehicle group, and select the carBody subgroup (see Figure 12-9).

Figure 12-9 Apply the stripedCarBody shader to the carBody subgroup.

c12f009.tif
4. In the Hypershade, find the stripedCarBody shader (its icon is the same as for the mib_glossy_reflection shader). Right-click the shader, and choose Assign Material To Selection.
This shader uses a projected texture map to color the surfaces in the carBody group. The projection node is already placed in the carBody group.
5. With the outdoorLighting render layer selected, create a test render in the Render View window. Make sure that the outdoorCam camera is selected as the rendering camera (see Figure 12-10).

Figure 12-10 The outdoorLighting layer uses a different shader to color the body of the car.

c12f010.tif
6. Save the scene as carComposite_v05.ma.

Fixing Broken Texture Links
If textures do not appear on the rendered models, you’ll need to double-check to make sure that they are linked properly. Links can break fairly easily if the scene files are moved or if the project is not set correctly. To fix the link, open the Hypershade window, switch to the Textures tab, and select the broken texture. Open its Attribute Editor, and look at the path to the texture in the Image Name field. Click the folder to open the file browser. Files for this project are found in the sourceimages folder.

The car renders with a different material applied to the body. If you render the studioLighting layer (using the studioCam camera), you’ll see that the car is still blue. The new shader appears only when the outdoorLighting layer is rendered.

You don’t need to create overrides to apply different materials on different render layers; however, you can create overrides for the attributes of render nodes used on different layers (for instance, one shader could have different transparency values on different render layers).

Shaders applied to selected polygons can also differ from one render layer to the next. However, if for your render layers you choose to apply materials on a per-polygon as opposed to a per-object basis, be sure to check your renders, because it is possible to get unexpected results.

To see a finished version of the scene, open the carComposite_v05.ma scene from the chapter12scenes folder at the book’s web page.

Material Overrides

A material override applies a material to all the objects within a particular layer. To create a material override, right-click one of the layers in the Render Layer Editor, and choose Overrides ⇒ Create New Material Override. You can then select a new material to be created from the list.

Render Layer Blend Modes

certobjective.eps

Render layers can use blend modes, which combine the results of the render to form a composite. You can preview the composite in the Render View window. Typically, you render each layer separately, import the render sequences into compositing software (such as Adobe After Effects, Autodesk Composite, or The Foundry Nuke), and then apply the blend modes using the controls in the compositing software. Maya gives you the option of creating a simple composite using render layers, which you can view in the Render View window.

Blend modes use simple algorithms to combine the numeric color values of each pixel to create a composite. A composite is created by layering two or more images on top of each other. The image on top is blended with the image below. If both images are rendered as Normal, then the top image covers the bottom image, except where the top layer is transparent due to alpha. If the blend mode is set to Multiply, then the light pixels in the top image are transparent, and the darker pixels of the top image darken the pixels in the bottom image. This technique is often used to add shadowing to a composite. If the blend mode of the top image is set to Screen, then the darker pixels are transparent, and the lighter pixels brighten the pixels of the lower image. You can use this to composite glowing effects.

The blend modes available in Maya are as follows:

Lighten This mode compares the layered images and uses the lightest pixel value of the two layers to determine the resulting color. For example, the lower-layer image has a pixel in a particular spot with an RGB value of 0, 125, 255, and the pixel at the same location in the top-layer image has an RGB value of 0, 115, 235. The resulting RGB value for that pixel will be 0, 125, 255.
Darken This mode is the opposite of Lighten, and the darker value is used. In the example cited previously, the resulting RGB value for the pixel would be 0, 115, 235.
Multiply The pixel values of the top-layer image are multiplied by the pixel values of the bottom image and then divided by 255 to keep the values within the range of 0 to 255. The lighter pixels in the top-layer image are semitransparent, and the darker values of the top-layer image result in a darkening of the lower image.
Screen A slightly more complex algorithm is used for this mode. The formula is 255 – [(255 – top color RGB pixel value) × (255 – bottom color RGB pixel value) ÷ 255] = blended RGB pixel value. This has the effect of making darker pixels in the top image semitransparent and lighter, resulting in a lightening of the lower image.
Overlay This mode combines Multiply and Screen modes so that the lighter pixels of the top-layer image brighten the bottom-layer image, and the darker pixels of the top-layer image darken the bottom-layer image.

In this exercise, you’ll use blend modes to create soft shadows for the render of the car in the studio lighting scenario.

This scene shows the car in the studio lighting scenario. A single render layer exists already. Using the technique in this exercise, you’ll eliminate the harsh cast shadows that appear on the ground in the rendered image (shown earlier in Figure 12-3) and replace them with soft shadows created using an ambient occlusion shader. First, you’ll remove the shadows cast on the ground by the physical lights in the scene (note that physical lights always cast shadows; there is no option for turning shadows off when you use these lights).

1. Open the carComposite_v06.ma scene from the chapter12scenes folder at the book’s web page.
2. Select the ground object in the Outliner.
3. Open its Attribute Editor, and switch to the groundShape tab.
4. Expand the Render Stats section in the Attribute Editor, and deactivate Receive Shadows (see Figure 12-11).

Figure 12-11 Disable Receive Shadows for the ground surface.

c12f011.tif
Note that, for some attributes, changing a setting on a render layer automatically creates a layer override.
5. Select the studioLighting layer, and create a test render in the Render View window using the renderCam camera (see Figure 12-12).

Figure 12-12 In this version of the render, the ground does not receive cast shadows from the car.

c12f012.tif
6. In the Outliner, Shift+click the vehicle group and the ground surface.
7. In the Render Layer Editor, choose Layers ⇒ Create Layer From Selected. Name the new layer AOShadow.
8. Open the Hypershade window. Make sure the AOShadow layer is selected in the Render Layer Editor.
9. Create two new surface shaders in the Hypershade (from the Hypershade menu bar, choose Create ⇒ Materials ⇒ Surface Shader).
10. Name one of the surface shaders shadowShader and the other whiteMask.
11. In the Outliner, select the vehicle group, and apply the whiteMask shader to this group.
12. Select the ground object, and apply the shadowShader to this surface.
13. Open the Attribute Editor for the whiteMask node, and set Out Color to white.
14. Open the Attribute Editor for the shadowShader.
15. Click the checkered box to the right of Out Color. In the Create Render Node window, select Textures under mental ray. Choose the mib_amb_occlusion texture from the node list (Figure 12-13).

Figure 12-13 Create an ambient occlusion texture for the shadowShader’s Out Color channel.

c12f013.tif
16. Open the Attribute Editor for the mib_amb_occlusion1 node, and set Samples to 64.
17. Make sure the AOShadow is selected in the Render Layer Editor; then create a test render using the renderCam camera.
The car appears as flat white, but you can see the soft shadows created on the ground by the ambient occlusion node (see Figure 12-14). Later in this chapter, you’ll learn more about how ambient occlusion textures create shadows.
18. Now you are ready to preview the composite in the Render View window. In the Render Layer Editor, set the blend mode of the AOShadow layer to Multiply (see Figure 12-15).
Because the car in this render layer is flat white, when the pixels of the AOShadow layer are multiplied by the pixels of the studioLight layer only the soft shadows appear in the composite.
19. In the Render Layer Editor, choose Options ⇒ Render All Layers ⇒ Options. In the Render All Layers Options dialog box, set Keep Image Mode to Composite Layers.
There are three choices in the Render All Layers Options dialog box: Composite Layers, Composite And Keep Layers, and Keep Layers.
Choosing Composite Layers renders both layers and then composites them in the Render View window.

Figure 12-14 The soft shadows created by the ambient occlusion texture appear on the ground while the car is masked in flat white.

c12f014.tif

Figure 12-15 Set the blend mode of the AOShadow layer to Multiply.

c12f015.tif
Choosing Composite And Keep Layers creates the composite, but it also keeps the rendered image of each individual layer available in the Render View window.
Choosing Keep Layers will not composite the layers; instead, it renders all renderable layers and keeps them as individual images in the Render View window.
20. After choosing the Composite Layers option, click Apply And Close.
21. Make sure that Render All Layers is now selected in the Options menu of the Render Layer Editor (see Figure 12-16).

Figure 12-16 Select the Render All Layers option in the Options menu.

c12f016.tif
22. In the Render Layer Editor, make sure the red X appears on the clapboard icon of masterLayer, indicating that this layer will not render. A green check box should appear next to the studioLighting and AOShadow layers, indicating that they will be rendered.
23. Open the Render View window, and create a test render using the renderCam camera. You’ll see the studioLighting layer render first, and then the AOShadow layer will render on top of it. Figure 12-17 shows the composited image.

Figure 12-17 The two images are composited in the Render View window.

c12f017.tif
24. Save the scene as carComposite_v07.ma.

To see a finished version of the scene, open the carComposite_v07.ma scene from the chapter12scenes folder at the book’s web page.

This is a good way to preview basic composites; however, in practice you will most likely want more control over how the layers are composited. To do this, you should use more advanced compositing software such as Adobe Photoshop (for still images) or Adobe After Effects, Autodesk Composite, or The Foundry Nuke (for animations).


realworld.eps
Composite Hardware Particles Using Render Layers
If you have a scene that involves a large number of nParticles, you may want to use hardware rendering to reduce the render time. If the scene also contains geometry that you want to render with Maya Software or mental ray, you can use render layers to composite the hardware-rendered nParticles with the software-rendered geometry in Maya. A workflow for doing this would be as follows:
1. In your scene, create a new render layer and add the geometry to this new layer. Name the layer geometryRL.
2. Create a second render layer above the geometry layer; then add the nParticles and the geometry to this layer. Name the layer nParticlesRL.
3. Open the Render Settings window for geometryRL, and set Render Using to mental ray.
4. Open the Render Settings window for nParticlesRL.
5. Right-click Render Using, and choose Create Layer Override.
6. Set the Render Using menu to Maya Hardware.
7. In the Maya Hardware tab of the Render Settings window, turn on Enable Geometry Mask.
8. In the Render Layer Editor, make sure that both the nParticlesRL and the geometryRL layers are set to Renderable.
9. In the Options menu, turn on Render All Layers.
10. Set the mode of the nParticlesRL layer to Screen.
11. Create a test render of a frame in which nParticles and the geometry are visible.
Using particle sprites (covered in Bonus Chapter 1, “Scripting with MEL and Python,” on this book’s web page) requires hardware rendering, so it’s great to have a render layer set up that allows you to render all of your detailed geometry and particles within a single scene file using two different rendering engines (mental ray and Maya Hardware).

Render Passes

Render passes divide the output created by a render layer into separate images or image sequences. Using render passes, you can separate the reflections, shadows, diffuse color, ambient occlusion, specular highlights, and so on, into images or image sequences, which can then be reassembled in compositing software. By separating things such as the reflections from the diffuse color, you can then exert maximum creative control over how the different images work together in the composite. This approach also allows you to make changes or variations easily or fix problems in individual elements rather than re-rendering the entire image or sequence every time you make a change.

Render passes replace the technique of using multiple render layers to separate things like reflections and shadows in older versions of Maya. (Render passes also replace the layer presets; more on this in a moment.) Each layer can be split into any number of render passes. When render passes are created, each layer is rendered once, and the passes are taken from data stored in the frame buffer. This means that each layer needs to render only once to create all the necessary passes. Render time for each layer increases as you add more passes.


The Frame Buffer
When Maya renders an image, it collects data from the scene and stores it in a temporary image known as the frame buffer. When rendering is complete, the data from the frame buffer is written to disk as the rendered image. The images created by render passes are extracted from the render buffer, which is why the layer needs to render only once to create a number of render passes.

A typical workflow using passes is to separate the scene into one or more render layers, as demonstrated in the first part of this chapter, and then assign any number of render passes to each render layer. When you create a batch render, the passes are stored in subfolders in the images folder of the current project. You can then import the images created by render passes into compositing software and assemble them into layers to create the final composite.

Render passes work only with mental ray; they are not available for any other renderer (Maya Software or Maya Hardware). It’s also crucial to understand that at this point not all materials will work with render passes. If you find that objects in your scene are not rendering correctly, double-check that you are using a material compliant with render passes.

The materials that work with render passes are as follows:

Anisotropic
Blinn
Lambert
Phong
Phong E
Env Fog
Fluid Shape
Light Fog
Particle Cloud
Volume Fog
Volume Shader
Hair Tube Shader
Ocean Shader
Ramp Shader
Hair
Fur
Image Plane
Layered Shader
Shading Map
Surface Shader
Use Background
mi_metallic_paint_x_passes
mi_car_phen_x_passes
mia_material_x_passes
misss_fast_shader_x_passes

Also, each shader does not necessarily work with every type of render pass listed in the render pass interface. For more information about specific shaders, consult the Maya documentation.

Note that the mental ray DGS, Dielectric, mib_glossy_reflection, and mib_glossy_refraction shaders, as well as the other mib shaders, are not supported by render passes. Even if you use a supported shader (such as mi_metallic_paint_x_passes) as a base material for these shaders, it will not render correctly. When using these shaders, you may need to devise an alternate workflow involving render layers and material overrides.

Upgrading Materials for Rendering Passes

The decision to render a scene in passes for compositing is going to affect what type of lighting and materials you use on the surfaces in your scene. As noted earlier, not all materials work with render passes. In addition, light shaders, such as the mia-physical light shader, can behave unpredictably with certain types of passes.

Generally speaking, any of the mental ray shaders that end with the “_passes” suffix are a good choice to use when rendering passes. If you have already applied the mia_material or mia_material_x shader to objects in the scene, you can easily upgrade these shaders to the mia_material_x_passes shader. The same is true for the mi_car_paint, mi_metallic_paint, and misss_fast_shader materials.


Be Consistent with Materials
The best way to minimize errors and confusion when rendering is to keep consistent with your material types: avoid using combinations of mia materials and standard Maya shaders whenever possible within a single render layer.

The following example illustrates how to upgrade the mia_material_x shader to the mia_material_x_passes shader in order to prepare for the creation of render passes.

This scene uses an HDR image to create reflections on the surface of the metal. To render the scene correctly, we will be using the building_probe.hdr image from Paul Debevec’s website at http://ict.debevec.org/~debevec/Probes/. This image is connected to the mentalrayIbl1 node in the helmetComposite_v01.ma scene. For more information on using the mentalrayIbl node, consult Chapter 10.

1. Open the helmetComposite_v01.ma scene from the chapter12scenes folder at the book’s web page.
2. Open the Hypershade window, and select the chromeShader. This is a mia_material_x. Open the Attribute Editor, and scroll down to the Upgrade Shader rollout toward the bottom.
3. Click the Upgrade Shader To mia_material_x_passes button (see Figure 12-18).

Figure 12-18 Upgrade the shader to mia_material_x_passes.

c12f018.tif
4. Repeat this process to upgrade groundShader, metalShader, plasticShader, rubberShader, thickGlass, and thinGlass.
5. Save the scene as helmetComposite_v02.ma.

To see a version of the scene, open the helmetComposite_v02.ma scene from the chapter12scenes folder at the book’s web page.

Rendering Multiple Passes from a Single Render Layer

In this example, you’ll create multiple passes for reflection, specular, depth, and shadow using the space helmet scene:

1. Continue with the scene from the previous section, or open the helmetComposite_v02.ma scene from the chapter12scenes folder at the book’s web page.
2. In the Render Layer Editor, select the helmet layer.
3. Click the Render Settings icon in the Render Layer Editor to open the Render Settings window, and choose the Passes tab.
4. Click the icon at the top of the stack of icons in the upper right. This opens the Create Render Passes window.
5. From Pass List, select the Camera Depth pass, and click the Create button at the bottom of the window.
6. Use the same steps to create Reflection, Shadow, and Specular passes (see Figure 12-19).
The passes have been created, but at the moment they are not associated with a render layer. You can create as many render passes as you like and then associate them with any combination of render layers in the scene—as long as those render layers are rendered using mental ray.
Once the pass is associated with the current layer, it is included in the frame buffer when the scene renders and saved as a separate image after rendering is complete. The Scene Passes and Associated Passes interface is a little confusing at first; just remember that only the passes listed in the Associated Passes section will be rendered for the current render layer. If you switch to another render layer, you’ll see all the passes listed in the Scene Passes section.

Figure 12-19 Render passes are created and listed in the Scene Passes section on the Passes tab for the helmet render layer.

c12f019.tif
7. Close the Create Render Pass window.
8. In the Passes tab of the Render Settings window, Shift+click the depth, reflection, shadow, and specular passes in the Scene Passes section.
9. Make sure that the Render Layer menu at the top of the Passes section of the Render Settings window is set to helmet.
10. Click the clapboard icon with the linked chain (between the Scene Passes and Associated passes sections). This moves the selected scene passes to the Associated Passes section, which means that the helmet render layer will now render the passes you’ve created.
To disassociate a pass from a render layer, follow these steps:
a. Select the pass in the Associated Passes section.
b. Click the clapboard icon with the broken link between the two sections.
This moves the pass back to the Scene Passes section. To delete a pass from either section, follow these steps:
a. Select the pass.
b. Press the Delete key.
11. Double-click the depth pass in the Associated Passes list; this will cause its Attribute Editor to open.
12. Turn on Remap Depth Values, and set Far Clipping Plane to 20 (see Figure 12-20).

Figure 12-20 Edit the settings for the Depth pass in the Attribute Editor.

c12f020.tif
The scene size for this scene is 20 units in Z; when you set Far Clipping Plane to 20, any parts of a surface beyond 20 units are clipped to a luminance value of 1 (meaning they are white).
13. Double-click reflection to open its settings in the Attribute Editor.
14. Raise Maximum Reflection Level to 10.
15. Create a test render from the Render View window using the renderCam camera.
You won’t notice anything special about the render; the render passes have already been saved to disk in a subfolder of the project’s Images folder, but they are not visible in the Render View window.
16. In the Render View window, choose File ⇒ Load Render Pass ⇒ Reflection (see Figure 12-21). Doing so opens the IMF_Display application.
Sometimes this application opens behind the Maya interface, so you may need to minimize Maya to see it. On the Mac, an imf_disp or IMF_display icon appears on the Dock or within the Applications/Autodesk/maya2014/mentalray/bin folder.
17. Save the scene as helmetComposite_v03.ma.

Figure 12-21 Use the File menu in the Render View window to open the render-pass images in IMF_Display.

c12f021.tif

The reflection pass shows only the reflections on the surface of the objects; the other parts of the image are dark. Thus the reflections are isolated. You can view the other passes using the File menu in the Render View window. Figure 12-22 shows each pass.

Figure 12-22 Clockwise from the upper left: Reflection, Shadow, Depth, and Specular render passes as seen in IMF_display. The elements of the passes appear dark because they have been separated and rendered against black.

c12f022.tif

Tone Mapping
Note that render passes are not tone-mapped; in other words, lens shaders applied to adjust the exposure of the image in the render view are not applied to the passes. IMF_display allows you to view the tone-mapped image by choosing the Tone Map option in the View menu. For more about tone mapping and lens shaders, consult Chapters 9 and 10.

The shadow pass will appear inverted in IMF_display. When you import this image into your compositing program, you can invert the colors and adjust as needed to create the effect you need.

To see a finished version of the scene, open the helmetComposite_v03.ma scene from the chapter12scenes folder at the book’s web page.

You can add render passes to a render layer in the Render Layer Editor. To do so, follow these steps:

1. Right-click the layer.
2. Choose Add New Render Pass (see Figure 12-23).

Figure 12-23 You can add render passes to a render layer by right-clicking the layer in the Render Layer Editor.

c12f023.tif
3. Choose the type of pass from the pop-up list.
The pass then automatically appears in the Associated Passes section in the Passes tab of the Render Settings window.

To remove a pass from a render layer, follow these steps:

1. Open the Render Settings window.
2. Switch to the Passes tab for the selected render layer.
3. Click the clapboard icon with the small red X between the Scene Passes and the Associated Passes sections.

Creating an Ambient Occlusion Render Pass

The mental ray renderer has a built-in ambient occlusion pass, which creates ambient occlusion shadowing in a render pass without the use of a custom shader network. Before the introduction of render passes in Maya 2009, the standard practice was to use a shader network to create the look of ambient occlusion, and a separate render layer used this shader as a material override. This can still be done, but in many cases using a render pass is faster and easier.

As explained in Chapter 9, ambient occlusion is a type of shadowing that occurs when indirect light rays are prevented from reaching a surface. Ambient occlusion is a soft and subtle type of shadowing. It’s usually found in the cracks and crevices of objects in diffuse lighting.

To create ambient occlusion shadowing, mental ray uses raytracing to determine how the shading of a surface is colored. When a ray from the camera intersects with geometry, a number of secondary rays are shot from the point of intersection on the surface back into the scene. Imagine all the secondary rays as a hemisphere above each point on the surface that receives an initial ray from the camera. If the secondary ray detects another object (or part of the same object) within a given distance from the original surface, that point on the original surface has the dark color applied (which by default is black). If no other nearby surfaces are detected, then the bright color is applied (which by default is white). The proportion of dark to bright color is determined by the proximity of nearby surfaces.

In this section, you’ll practice creating an ambient occlusion pass for the space helmet scene.

The scene has a single render layer named helmet. This layer is a duplicate of the masterLayer. You can create render passes for the masterLayer, but for the sake of simulating a production workflow, you’ll use a render layer in this demonstration.

1. Open the helmetComposite_v03.ma scene from the chapter12scenes folder at the book’s web page.
2. Open the Render Settings window, and choose the Passes tab. At the top of the Render Settings window, make sure Render Layer is set to helmet.
3. Click the top icon to the right of the Scene Passes section to open the Create Render Passes window.
4. From Pass List, select Ambient Occlusion (see Figure 12-24).

Figure 12-24 Select the Ambient Occlusion preset from the list of available render pass presets.

c12f024.tif
5. Click Create And Close to add the pass to the Scene Passes section.
6. You’ll now see the Ambient Occlusion (AO) pass listed in the Scene Passes section as AO. Select the AO pass, and open the Attribute Editor. (If the pass settings don’t appear in the Attribute Editor, double-click AO on the Passes tab of the Render Settings window.)
The settings for the pass are listed in the Attribute Editor. These include the following:
  • The number of channels used for the pass
  • The bit depth
The available settings may differ, depending on the selected pass preset:
  • When Channels is set to 3, the pass will contain the red, green, and blue (RGB) channels.
  • When Channels is set to 4, an alpha channel is also included along with the RGB channels.
7. Set Number Of Channels to 4 so that the alpha channel is included in the rendered image.
8. As opposed to using the global settings, you are going to tune the look of the ambient occlusion pass in the local AO settings. Scroll down to the lower section of the Attribute Editor, and activate the Use Local AO Settings feature.
9. The Rays attribute adjusts the overall quality of the ambient occlusion shading. Increasing this setting improves quality but also increases render times. Leave this at 64, which is a good setting for testing.
Bright and Dark Colors The bright and dark colors determine how a surface is shaded based on the proximity of other surfaces or parts of the same surface. If you reverse these colors, you’ll see the negative image of the ambient occlusion shadowing. For most compositions, it’s fine to leave these as black and white. The values can easily be edited in compositing software after rendering.
Spread Spread determines the distance of the shading effect across the surface. Think of this as the size of the shadow. Higher values produce tighter areas of shadowing on the surface; lower values produce broader, softer shadows.
Maximum Distance The Maximum Distance attribute determines how much of the scene is sampled. Think of this as the distance the secondary rays travel in the scene as they search out nearby surfaces. If a nearby object is beyond the Maximum Distance setting, then it will not affect how ambient occlusion is calculated because the secondary rays will never reach it. When Maximum Distance is set to 0, the entire scene is sampled; Max Distance is essentially infinite.
One of the best ways to increase efficiency in the scene is to establish a value for Maximum Distance. This decreases the render time and improves the look of the image. Determining the proper value for Maximum Distance often takes a little experimentation and a few test renders. You want to find the value that offers the type of shadowing you need within a reasonable render time.
10. Set Maximum Distance to 4. Leave Spread at 0 (see Figure 12-25).

Figure 12-25 The Use Local AO Settings feature allows you to adjust how the ambient occlusion will look when the AO render pass for the helmet layer is created.

c12f025.tif
At this point, these settings should produce a nice-looking ambient occlusion pass for this scene. Now you need to associate this pass with the helmet render layer. To save some render time for this exercise, the other render passes created earlier in the chapter can be de-associated.
11. On the Passes tab of the Render Settings window for the helmet layer, select AO in the Scene Passes section, and click the icon with the linked chain to move it down to the Associated Passes section.
12. Shift+click the depth, diffuse, reflection, shadow, and specular passes in the Associated Passes section so that they are highlighted in blue.
13. Click the icon with the broken chain to move them back to the Scene Passes section. This means that they will not be calculated when the helmet render layer is rendered (see Figure 12-26).

Figure 12-26 Calculation of the other render passes is disabled by moving them from the Associated Render Pass section up to the Scene Passes section.

c12f026.tif
Even though you have set up the AO layer and associated it with the helmet render layer, the ambient occlusion will not calculate correctly until you enable Ambient Occlusion in the Features section of the Render Settings window. This is an easy thing to forget!
14. Click the Features tab of the Render Settings window.
15. Under Secondary Effects, select the Ambient Occlusion option (see Figure 12-27).
16. Open the Render View window, and create a render using the renderCam camera. You won’t see any ambient occlusion in this render; however, it is being calculated and stored as a separate image.
The pass is stored in a temporary folder in the project’s Images folder. If the scene uses layers, each layer has its own subfolder where the passes are stored.

Figure 12-27 Turn on Ambient Occlusion on the Features tab of the Render Settings window.

c12f027.tif
17. To see the Ambient Occlusion pass, use the File menu in the Render View window. Choose File ⇒ Load Render Pass ⇒ AO. The image opens in a separate image view window (see Figure 12-28).

Figure 12-28 The ambient occlusion pass as it appears in IMF_display

c12f028.tif
18. Save the scene as helmetComposite_v04.ma.

To see a finished version of the scene, open the helmetComposite_v04.ma scene from the chapter12scenes folder at the book’s web page.

Render Pass Contribution Maps

Render pass contribution maps can be used to customize the render passes further for each layer. A contribution map specifies which objects and lights are included in a render pass. By default, when you create a render pass and associate it with a particular render layer, all the objects on the layer are included in the pass. Using a contribution map, you can add only certain lights and objects to the render pass. The whole point is to give you even more flexibility when rendering for compositing. This exercise demonstrates how to set up contribution maps.

1. Open the minigunComposite_v01.ma scene from the chapter12scenes folder at the book’s web page. This scene contains a model of a minigun, a simple backdrop, some directional lights, and the surfaces in the scene.
This scene uses an HDR image—building_probe.hdr image from Paul Debevec’s website at http://ict.debevec.org/~debevec/Probes/—to create reflections on the surface of the metal. This image is connected to the mentalrayIbl1 node in the scene. Select this node in the Outliner, open its Attribute Editor, and use the Image Name field to link to the image on your disk. For more information on using the mentalrayIbl node, consult Chapter 10.
2. In the Outliner, expand the turret object.
3. Select the right_mount1 node.
4. In the Render Layer Editor, right-click the miniGun layer and choose Pass Contribution Maps ⇒ Create Pass Contribution Map And Add Selected (see Figure 12-29).

Figure 12-29 Create a render pass contribution map from the selected objects in the Outliner.

c12f029.tif
5. A small arrow is added to the miniGun render layer label. Click this label to expand the layer.
6. You’ll see the contribution map listed as passContributionMap1. Double-click this, and change the name to rightGun (see Figure 12-30).

Figure 12-30 Rename the new map rightGun.

c12f030.tif
7. Repeat steps 2 through 5 for the left_mount group. Name the new contribution map leftGun.
8. Select the miniGun render layer, open the Render Settings window, and switch to the Passes tab.
9. Click the Create New Render Pass icon (the topmost icon to the right of the Scene Passes section), and add Reflection and Specular passes.
10. Select both the reflection and specular passes in the Scene Passes section.
11. Click the linked chain icon to move them to the Associated Passes section.
12. Below the Associated Passes section, you’ll see the Associated Pass Contribution Map section. Set the Associated Pass Contribution Map drop-down menu to rightGun.
13. Select the reflection pass in the Associated Passes section, and click the linked chain icon below this section to copy the reflection pass preset to the associated pass contribution map.
This means that only the objects in the rightGun contribution map (the right_mount1 group) appear in the Reflection pass created for the miniGun layer.
14. Repeat steps 12 and 13, but this time set the Associated Pass Contribution Map drop-down menu to leftGun, and move the Specular pass down to the Passes Used By Contribution Map section (see Figure 12-31).
15. Open the Render View window, and create a render using the renderCam camera. Once again, the render looks the same as if you had not added any render passes.
16. When the image has finished rendering, use the File menu in the Render View window to load the specular and reflection passes.
Notice that, in these passes, only one part of the gun appears. In the Specular pass, the left_mount group appears; in the Reflection pass, the right_mount1 group appears (see Figure 12-32). The rest of the gun and the backdrop are absent from each pass. Although this is not a practical application of contribution maps, it demonstrates clearly that the point of a contribution map is to specify exactly which objects appear in a render pass.
17. Save the scene as minigunComposite_v02.ma.

To see a version of the scene up to this point, open the minigunComposite_v02.ma scene from the chapter12scenes folder at the book’s web page.

Figure 12-31 Associate the Specular pass with the leftGun contribution map.

c12f031.tif

Figure 12-32 After you render the image, the Reflection and Specular passes show only the objects added to the contribution map for each pass.

c12f032.tif

Lights and Contribution Maps

Lights can also be included in contribution maps. If no lights are specified, all the scene lights are added. In the minigun scene, the directional light is the only light that casts shadows; the other two lights have shadow casting turned off. You can use pass contribution maps to create a shadow pass just for this light.

1. Continue with the scene from the previous section, or open the minigunComposite_v02.ma scene from the chapter12scenes folder at the book’s web page.
2. In the Outliner, Shift+click ground and directionalLight1.
3. In the Render Layer Editor, right-click the miniGun render layer, and choose Pass Contribution Maps ⇒ Create Pass Contribution Map And Add Selected.
4. Double-click passContributionMap1, and rename it groundShadow.
5. Open the Render Settings window, and switch to the Passes tab.
6. Select Reflection and Specular in the Associated Passes section, and click the broken chain icon to move them to the Scene Passes section. Doing so prevents the passes from being included in the render.
7. Click the Create New Render Pass button, and add a Raw Shadow pass to the Scene Passes section.
8. Move shadowRaw from the Scene Passes section to the Associated Passes section. (Make sure miniGun is the currently selected render layer when you do this.)
9. Set Associated Pass Contribution Map to groundShadow. Select shadowRaw from the Associated Passes section. Use the linked chain icon below the Associated Passes to copy shadowRaw into the Passes Used By Contribution Map section (see Figure 12-33).
10. Double-click the shadowRaw pass to open its Attribute Editor.
11. In the Attribute Editor, disable Hold-Out (see Figure 12-34).
The Hold-Out setting creates a geometry mask for geometry that is not included in the render pass. By disabling this, you’ll see only the ground surface and the cast shadow in the render.
12. Open the Render View window, and create a test render from the renderCam camera (see Figure 12-35). As before, you can then view the pass by using the Render View’s File ⇒ Load Render Pass menu command.

Figure 12-33 Associate the shadowRaw preset with the groundShadow contribution map.

c12f033.tif

Figure 12-34 In the settings for shadowRaw, disable the Hold-Out option.

c12f034.tif

Figure 12-35 The groundShadow contribution map shows only the directionalLight, the ground, and the shadow cast by the gun geometry.

c12f035.tif
13. Save the scene as miniGun_v03.ma.

In the composite, the shadow pass should be inverted and color-corrected. When creating a shadow-pass contribution map, you may want to include just the shadow-casting lights. In some cases, including all the lights can produce strange results.

To see a finished version of the scene, open the miniGun_v03.ma scene from the chapter12scenes folder at the book’s web page.

Render Pass Sets

Render pass sets are simply a way to organize large lists of render passes on the Passes tab of the Render Settings window. You can create different groupings of the passes listed in the Scene Passes section, give them descriptive names, and then associate the set with the render layer or the associated contribution maps. If you have a complex scene that has a large number of passes, you’ll find it’s easier to work with the pass sets than with all of the individual passes.

You can create a render pass set as you create the render passes or add them to the set later. In the Create Render Passes window, select the Create Pass Set box, and give the pass set a descriptive name (see Figure 12-36). The new pass set appears in the Scene Passes section in the Render Settings window along with all the newly created passes (see Figure 12-36). To associate a render layer with the new pass set, you only have to move the pass set to the Associated Passes section. All the passes included with the set will be associated with the layer even though they do not appear in the Associated Passes section.

Figure 12-36 You can create a pass set in the Create Render Passes window using the options at the bottom.

c12f036.tif

To verify which passes are included in the set, open the Relationship Editor for render passes (Window ⇒ Relationship Editors ⇒ Render Pass Sets). When you highlight the pass set on the left, the passes in the set are highlighted on the right. You can add or remove passes from the set by selecting them from the list on the right of the Relationship Editor (see Figure 12-37).

Figure 12-37 Associating the set with the current render layer associates all of its contained passes with the layer. You can use the Relationship Editor to add and remove passes from the set.

c12f037.tif

You can add a new set on the Passes tab of the Render Settings window by clicking the Create New Render Pass Set icon. You can then use the Relationship Editor to add the passes to the set. A render pass can be a member of more than one set.

Setting Up a Render with mental ray

Rendering is the process of translating a Maya animation into a sequence of images. The images are processed and saved to disk. The rendered image sequences can then be brought into a compositing software, where they can be layered together, edited, color-corrected, combined with live footage, and have additional effects applied. The composite can then be converted to a movie file or a sequence of images for distribution or imported to editing software for further processing.

Generally, you want to render a sequence of images from Maya. You can render directly to a movie file, but this usually is not a good idea. If the render stops while rendering directly to a movie file, it may corrupt the movie, and you will need to restart the whole render. When you render a sequence of images and the render stops, you can easily restart the render without re-creating any of the images that have already been saved to disk.

When you set up a batch render, you can specify how the image sequence will be labeled and numbered. You also set the image format of the final render, which render layers and passes will be included and where they will be stored, and other aspects related to the rendered sequences. You can use the Render Settings window to determine these properties or perform a command-line render using your operating system’s terminal. In this section, you’ll learn important features of both methods.

Batch rendering is also accomplished using render-farm software, such as Backburner, which is included with Maya. This allows you to distribute the render across multiple computers. Consult the help documents on how to use Backburner, since this subject is beyond the scope of this book.


Color Profile Management
In Maya 2014 you can specify a color profile if you need to match a specific color space in your compositing software or if you need to match footage that requires a specific setting. A color profile can be assigned to individual textures and render passes. Many nodes throughout Maya now support the assignment of color profiles. For example, when you create a file texture node for use in a shader, you’ll see a drop-down menu that gives you options for assigning a color profile (underneath the File Name field in the File node’s Attribute Editor).
It is crucial to understand that, unless you enable Color Management on the Common tab of the Render Settings window, any color profiles you assign to textures or render passes will not work.

File Tokens

File tokens are a way to automate the organization of your renders. If your scene has a lot of layers, cameras, and passes, you can use tokens to specify where all the image sequences will be placed on your computer’s hard drive, as well as how they are named.

The image sequences created with a batch render are placed in the images folder of the current project or whichever folder is specified in the Project Settings window (see Chapter 1, “Working in Autodesk Maya,” for information regarding project settings). Tokens are placed in the File Name Prefix field found on the Common tab of the Render Settings window. If this field is left blank, the scene name is used to label the rendered images (see Figure 12-38).

By default, if the scene has more than one render layer, Maya creates a subfolder for each layer. If the scene has more than one camera, a subfolder is created for each camera. For scenes with multiple render layers and multiple cameras, Maya creates a subfolder for each camera within the subfolder for each layer.

You can specify any folder you want by typing the folder names into the File Name Prefix field. For example, if you want your image sequences to be named marshmallow and placed in a folder named chocolateSauce, you can type chocolateSauce/marshmallowin the File Name Prefix field. However, explicitly naming a file sequence lacks the flexibility of using tokens and runs the risk of allowing you to overwrite file sequences by mistake when rendering. You can see a preview of how the images will be named in the upper portion of the Render Settings window (see Figure 12-39).

Figure 12-38 The File Name Prefix field on the Common tab of the Render Settings window is where you specify the image name and tokens.

c12f038.tif

Figure 12-39 A preview of the image name appears at the top of the Common tab of the Render Settings window.

c12f039.tif

The whole point of tokens is to allow you to change the default behavior and specify how subfolders will be created dynamically for a scene. To use a token to specify a folder, place a slash after the token name. For example, to create a subfolder named after each camera, type <camera>/ in the File Name Prefix field. To use a token to name the images, omit the slash. For example, typing <scene>/<camera> results in a folder named after the scene containing a sequence of images named camera.iff.

Here are some common tokens:

<Scene> This token names the images or subfolder after the scene name.
<Camera> This token names the images or subfolders after the camera. For example, in a scene with two cameras named renderCam1 and renderCam2, <Scene>/<Camera>/<Camera> creates a single folder named after the scene, within which are two subfolders named renderCam1 and renderCam2. In each of these folders is a sequence named renderCam1.ext and renderCam2.ext.
<RenderLayer> This token creates a subfolder or sequence named after each render layer. If there are passes associated with the layer, then the pass names are appended to the layer name. For example, if you have a layer named spurtsOfBlood and an associated specular pass, the folder or image sequence would automatically be named spurtsOfBlood_specular.
<RenderPass> This token creates a subfolder or sequence named after the render pass. Since render passes are available only for mental ray renders, this token applies only when using mental ray.
<RenderPassType> This token is similar to <RenderPass> except that it abbreviates the name of the render pass. A reflection pass, for example, would be abbreviated as REFL.
<RenderPassFileGroup> This token adds the name of the render-pass file group. The pass group name is set in the Attribute Editor of the render-pass node (see Figure 12-40). Render pass file groups are assigned by mental ray, but you can create your own name for the group by typing it in the Pass Group Name field of the render pass node.

Figure 12-40 You can set the render pass group name in the Attribute Editor of the render pass node.

c12f040.tif
<Extension> This token adds the file format extension. It is usually added to the end of the filename automatically, but you can also use this token to label a folder based on the image format.
<Version> This token adds a custom label specified by the Version Label field in the Render Settings window (see Figure 12-41).

Figure 12-41 The <Version> token adds the label specified in the Version Label field in the Render Settings window.

c12f041.tif

Note that the capitalization of the token name does matter. If you had a scene named chocolateSauce that has a render layer named banana that uses a specular and diffuse pass with two cameras named shot1 and shot2 and you wanted to add the version label v05, the following tokens specified in the File Name Prefix field

<Scene>/<RenderLayer>/<Camera>/<RenderPass>/<RenderPass>_<Version>

would create a file structure that looks like this:

chocolateSauce/banana/shot1/specular/specular_v05.#.ext
chocolateSauce/banana/shot1/diffuse/diffuse_v05.#.ext
chocolateSauce/banana/shot2/specular/specular_v05.#.ext
chocolateSauce/banana/shot2/diffuse/diffuse_v05.#.ext

Tokens for OpenEXR Files
The OpenEXR format can create multiple additional channels within a single image. Each channel can contain an image created from a render pass. If a scene has one or more render passes and you choose the OpenEXR image format, you can use the Frame Buffer Naming field to specify the name of each pass. This feature is available only when OpenEXR is chosen as the file format and the scene has one or more render passes. You can use the automatic naming setting or enable the Custom option in the Frame Buffer Naming drop-down menu. You can then use the Custom Naming String field to choose the token you want to use.
c12uf003.tif

Use underscores or hyphens when combining tokens in the folder or image name. Avoid using periods.

You can right-click the File Name Prefix field to access a list of commonly used token keywords. This is a handy way to save a little typing.

Specifying Frame Range

For multiframe animations, you have a number of options for specifying the frame range and the syntax for the filenames in the sequence. These settings are found on the Common tab of the Render Settings window. To enable multiframe rendering, choose one of the presets from the Frame/Animation Ext drop-down list in the File output rollout. When rendering animation sequences, the safest choice is usually the name.#.ext option. This names the images in the sequence by placing a dot between the image name and the image number and another dot between the image number and the file extension. The Frame Padding option allows you to specify a number of digits in the image number, and it will insert zeros as needed. So a sequence named marshmallow using the Maya IFF format with a Frame Padding of 4 would be marshmallow.0001.iff.

new.eps

The Frame Range settings specify which frames in the animation will be rendered. The By Frame setting allows you to render each frame (using a setting of 1), skip frames (using a setting higher than 1), or render twice as many frames (using a setting of 0.5, which renders essentially at half speed). You can also set Skip Existing Frames to have Maya automatically find frames that have already been rendered and skip over them.

It is possible to render backward by specifying a higher frame number for the Start Frame value than the End Frame value and using a negative number for By Frame. You would then want to use the Renumber Frames option so that the frame numbers move upward incrementally.

The Renumber Frames option allows you to customize the labeling of the image sequence numbers.

Renderable Cameras

The rendering cameras are specified in the Renderable Cameras list. To add a camera, expand the Renderable Cameras list and choose Add Renderable Camera (see Figure 12-42). To remove a rendering camera, click the trashcan icon next to the renderable camera. As noted earlier in the chapter, you can use a layer override to include a specific camera with a render layer.

Figure 12-42 You can add and remove renderable cameras using the Renderable Camera menu.

c12f042.tif

Each camera has the option of rendering alpha and Z-depth channels. The Z-depth channel stores information about the depth in the scene. This is included as an extra channel in the image (only a few formats, such as Maya IFF and OpenEXR, support this extra channel). Not all compositing software supports the Maya Z-depth channel. You may find it easier to create a camera depth pass using the custom passes (passes are described earlier in this chapter). The render depth pass can be imported into your compositing software and used with a filter to create depth-of-field effects.

File Formats and the Frame Buffer

When Maya renders a scene, the data stored in the frame buffer is converted into the native IFF format and then translated to the file type specified in the Image Format menu. Thus if you specify the TIFF format, for example, Maya translates the TIFF image from the native IFF format.

Many compositing packages (such as Adobe After Effects, Autodesk Composite, and The Foundry Nuke) support the IFF format, so it’s generally safe to render to this file format. The IFF format uses four 8-bit channels by default, which is adequate for most viewing purposes. If you need to change the file to a different bit depth or a different number of channels, you can choose one of the options from the Data Type menu in the Framebuffer section of the Quality tab. This is where you will also find the output options, such as Premultiply (see Figure 12-43).

Figure 12-43 Specify bit depth and other output options using the Framebuffer settings on the Quality tab of the Render Settings window.

c12f043.tif

Render passes use the secondary frame buffer to store the image data. You can specify the bit depth of this secondary buffer in the Attribute Editor for each render pass.

A complete list of supported image formats is available in the Maya documentation. Note that Maya Software and mental ray may support different file formats.


Image Size Settings
The Image Size settings are discussed in Chapter 2, “Virtual Filmmaking.”

Starting a Batch Render

When you are satisfied that your animation is ready to render, and all the settings have been specified in the Render Settings window, you’re ready to start a batch render. To start a batch render, set the main Maya menu set to Rendering and choose Render ⇒ Batch Render ⇒ Options. If you are rendering with mental ray, you can specify memory limits and multithreading, as well as local and network rendering.

One of the most useful options is Verbosity Level. This refers to the level of detail of the messages displayed in the Maya Output window as the render takes place. (This works only when using Maya with Windows.) You can use these messages to monitor the progress of the render as well as diagnose problems that may occur while rendering. The Progress Messages setting is the most useful option in most situations (see Figure 12-44).

Figure 12-44 Detailed progress messages for each frame can be displayed in the Output window.

c12f044.tif

To start the render, click the Batch Render (or the Batch Render And Close) button. As the batch render takes place, you’ll see the Script Editor update (see Figure 12-45). For detailed information on the progress of each frame, you can monitor the progress in the Output window.

Figure 12-45 The Script Editor shows the progress of the batch render.

c12f045.tif

To stop a batch render, choose Render ⇒ Cancel Batch Render. To see how the current frame in the batch render looks, choose Render ⇒ Show Batch Render.

When the render is complete, you’ll see a message in the Script Editor that says Rendering Completed. You can then use FCheck to view the sequence (File ⇒ View Sequence) or import the sequence into your compositing software.


Monitoring a Render in the Script Editor
The Script Editor is not always completely reliable when it comes to monitoring the progress of a render. If the messages stop updating as the render progresses, it may or may not indicate that the render has stopped. Before assuming that the render has stopped, use your computer’s operating system to browse to the current image folder and double-check to see whether images are still being written to disk. This is especially true when using Maya on a Mac.

Command-Line Rendering

A batch render can be initiated using your operating system’s command prompt or terminal window. This is known as a command-line render. A command-line render takes the form of a series of commands typed into the command prompt. These commands include information about the location of the Maya scene to be rendered, the location of the rendered image sequence, the rendering cameras, the image size, the frame range, and many other options similar to the settings found in the Render Settings window.

Command-line renders tend to be more stable than batch renders initiated from the Maya interface. This is because when the Maya application is closed, more of your computer’s RAM is available for the render. You can start a command-line render regardless of whether Maya is running. In fact, to maximize system resources, it’s best to close Maya when starting a command-line render. In this example, you can keep Maya open.

In this exercise, you’ll see how you can start a batch render on both a Windows computer and a Mac. You’ll use the solarSystem_v01.ma scene, which is a simple animation showing two planets orbiting a glowing sun.

Open the solarSystem_v01.ma scene from the chapter12scenes folder at the book’s web page.

This scene has a masterLayer render layer, which should not be rendered, and two additional layers:

  • The solarSystem layer contains the sun and planets, which have been shaded. It uses the mental ray renderer. If you open the Render Settings window to the Passes tab, you’ll see that this scene uses two render passes: diffuse and incandescence.
  • The second layer is named orbitPaths. It contains Paint Effects strokes that illustrate the orbit paths of the two planets (see Figure 12-46).

Figure 12-46 The solarSystem_v01.ma scene has been prepared for rendering.

c12f046.tif

On the Common tab of the Render Settings window, no filename prefix has been specified, and a frame range has not been set. Maya will use the default file structure when rendering the scene, and the frame range will be set in the options for the command line.

Windows Command-Line Render

The first example starts a command-line render using Windows 7:

1. Click the Windows Start menu button. In the Search Programs And Files field, type Command Promptorcmd. Click the Command Prompt icon that appears at the top of the search. (Note that you may need to RMB-click and choose Run As Administrator if the system security settings are restrictive.)
2. Use Windows Explorer to browse to the path of your scenes folder: right-click the Start button, and choose Open Windows Explorer.
3. Open the scenes folder in your current project where you placed the solarSystem_v01.ma scene.
4. RMB-click the Explorer address bar, and choose Copy Address As Text to copy the path to the scenes folder to the clipboard.
5. At the command prompt, type cd .... and press Enter. Doing so goes back two directories and sets the command prompt to the root folder.
6. Type cd and then a space; right-click the command line and select Paste. This pastes the path to the scenes folder in the command prompt.
7. Press the Enter key to set the current folder to the scenes folder (see Figure 12-47).

Figure 12-47 Set the command prompt to the current folder where the solarSystem_v01.ma scene is stored (the exact folder path will look different on your machine).

c12f047.tif

When starting a batch render, you can either specify the path to the scenes folder in the command-line options or set the command prompt to the folder that contains the scene.

To start a batch render, use the render command in the command prompt, followed by option flags and the name of the scene you want to render. The option flags are preceded by a hyphen. The flags are followed by a space and then the flag setting. For example, to start a scene using the mental ray renderer, you would type render -r mr myscene.ma. The render command starts the batch renderer, the -r flag specifies the renderer, and mr sets the -r flag to mental ray. The command ends with the name of the scene (or the folder path to the scene if you’re not already in the folder with the scene).

If render is not recognized as a command, and the command line produces an error, the render executable was not given a proper global variable at the time of installation. You can sidestep this error by executing the render command from the Maya program bin folder. For example, in the Command Prompt window, navigate to the C:Program FilesAutodeskMaya2014in folder before launching the batch render.

There are many options, but you don’t need to use them, except if you want to specify an option that’s different from what is used in the scene. If you want all the layers to render using mental ray regardless of the layer setting in the scene, then you specify mental ray using the -r mr flag. If you omit the -r flag, Maya uses the default renderer, which is Maya Software. If you have a scene with several layers that use different renderers (as in the case of the solarSystem_v01.ma scene), you would type -r file. This sets the renderer to whatever is specified in the file, including what is specified for each layer.

Other common flags include the following:

-s <float> sets the start frame. (It replaces <float> with the starting frame; for example, -s 120 would set the start frame to 120. A float is a number with a decimal point.)
-e <float> sets the end frame.
-x <int> sets the X resolution of the image. (An integer is a whole number without a decimal point.)
-y <int> sets the Y resolution of the image.
- cam <name> sets the camera.
-rd <path> specifies the folder for the images. (If this is not used, the folder in the project settings is used.)
-im <filename> sets the name of the rendered image.
-of <format> sets the image format.

There is a complete list of the flags in the Maya documentation. You can also print a description of commands by typing render -help. To see mental ray–specific commands, type render -help -r mr.

For example, if you want to render the scene using renderCam1, starting on frame 1 and ending on frame 24, type the following in the command prompt (see Figure 12-48):

render -r file -s 1 -e 24 -cam renderCam1 solarSystem_v01.ma

Figure 12-48 Enter the render command with options and the scene name in the Command Prompt window.

c12f048.tif

You’ll see the render execute in the command prompt. When it’s finished, you can use FCheck to view each sequence. In the Images folder, you’ll see two directories named after the layers in the scene. The orbitPath folder has the Paint Effects orbit paths rendered with Maya Software. The solarSystem folder has the rendered sequence of the planets and sun as well as subdirectories for the diffuse, incandescence, and MasterBeauty passes. (The MasterBeauty pass is created by default when you add passes to a scene.)

Let’s say you want to render only the orbitPaths layer using renderCam2 for the frame range 16 to 48. You want to specify Maya Software as the renderer. You may want to name the sequence after the camera as well. Type the following into the command prompt (use a single line with no returns):

render -r sw -s 16 -e 48 -rl orbitPaths -cam renderCam2 ↵
-im solarSystemCam2 solarSystem_v01.ma

Mac Command-Line Render

For a Mac, the Maya command-line render workflow is similar except that, instead of the command prompt, you use a special Terminal window that is included when you install Maya. This is an application called Maya Terminal.term, and it’s found in the ApplicationsAutodeskMaya 2014 folder. It’s probably a good idea to add this application to the Dock so that you can easily open it whenever you need to run a batch render.

You need to navigate in the terminal to the scenes folder that contains the scene you want to render:

1. Copy the solarSystem_v01.ma scene from the book’s web page to the scenes folder of your current project on your computer’s hard drive.
2. In the Finder, open the current project folder.
3. Start the Maya Terminal application, and type cd at the prompt.
4. In the Finder, drag the scenes folder from the current project on top of the Maya Terminal. This places the path to the scenes folder in the Terminal.
5. Press the Enter key. The Terminal window is now set to the project’s scenes folder, which contains the solarSystem_v01.ma scene.

The commands for rendering on a Mac are the same as they are for Windows. From here, you can take up with step 6 from the previous exercise.

Creating a Batch Script

It’s possible to create a text file that can initiate a series of batch renders for a number of different scenes. Doing so can be useful when you need a machine to perform several renders overnight or over a long weekend. This approach can save you the trouble of starting every batch render manually. This section describes how to create a batch script for Windows and Mac.

Windows Batch Render Script

To create a batch script for Windows, follow these steps:

1. Move the scenes you want to render into the renderScenes folder of the current project. Give them a name that distinguishes them from the original scenes in the scenes folder just to avoid confusion.
2. Create a new plain-text file using Notepad.
3. In the text file, type the render commands exactly the same way you would initiate a batch render. Use a new line for each render. For example,
render -r file -s 20 -e 120 -cam renderCam1 myScene.mb
render -r file -s 121 -e 150 -cam renderCam2 myScene.mb
render -r file -s 1-e 120 -cam renderCam1 myScene_part2.mb
4. Save the scene as a BAT file, and save it in the same folder as the scenes you want to render, usually the renderScenes folder. The file can be named anything, but it should end in .bat. Make sure that the format is plain text—for example, weekendRender.bat.
5. When you are ready to render, double-click the batch script (for example, weekendRender.bat), as shown in Figure 12-49.

Figure 12-49 An example of a batch script file

c12f049.tif

You’ll probably want to close Maya to maximize system resources for the render. Maya will render each scene in the order it is listed in the batch file. Be very careful when naming the files and the image sequences so that one render does not overwrite a previous render. For example, if you render overlapping frame sequences from the same file, use the -im flag in each batch render line to give the image sequences different names.

Mac Batch Render Script

A few extra steps are involved in creating a Mac batch render script, but for the process is similar to the Windows workflow:

1. Move the scenes you want to render into the renderScenes folder of the current project. It’s a good idea to give the scenes names that distinguish them from the original scenes in the scenes folder just to avoid confusion.
2. Create a new plain-text file using TextEdit.
3. In the text file, type the render commands exactly the same way you would initiate a batch render. Use a new line for each render. For example,
render -r file -s 20 -e 120 -cam renderCam1 myScene.mb
render -r file -s 121 -e 150 -cam renderCam2 myScene.mb
render -r file -s 1-e 120 -cam renderCam1 myScene_part2.mb
4. Save the scene as a batch file, and save it in the same folder as the scenes you want to render, usually the renderScenes folder. The file can be named anything, but it should end in .batch. Make sure that the format is plain text, for example weekendRender.batch.
5. In the Maya Terminal window, navigate to the location of the batch file (in the renderScenes folder of the current project).
6. Convert the batch file to an executable by typing chmod 777weekendRender.batch.
7. In the Maya Terminal window, navigate to the location of the batch file, and type ./weekendRender.batch.

The scenes will render in the order in which they are listed in the batch file.

mental ray Quality Settings

The quality of your render is determined by a number of related settings, some of which appear in the Render Settings window and some of which appear in the Attribute Editor of nodes within the scene. Tessellation, antialiasing, sampling, and filtering all play a part in how good the final render looks. You will always have to strike a balance between render quality and render time. As you raise the level of quality, you should test your renders and make a note of how long they take. Five minutes to render a single frame may not seem like much until you’re dealing with a multilayered animation that is several thousand frames long. Remember that you will almost always have to render a sequence more than once as changes are requested by the director or client (even when you are sure it is the absolute final render!).

In this section, you’ll learn how to use the settings on the Quality tab as well as other settings to improve the look of the final render.


Always Test Short Sequences
A single rendered frame may not reveal all of the quality problems in a scene. Remember to test a short sequence of rendered frames for problems such as flickering or crawling textures before starting a full batch render.

Tessellation and Approximation Nodes

At render time, all the geometry in the scene, regardless of whether it is NURBS, polygons, or subdivision surfaces, is converted to polygon triangles by the renderer. Tessellation refers to the number and placement of the triangles on the surface when the scene is rendered. Objects that have a low tessellation will look blocky when compared to those with a high tessellation. However, low-tessellation objects take less time to render than high-tessellation objects (see Figure 12-50). Tessellation settings can be found in the shape nodes of surfaces. In Chapter 3, “Modeling I,” the settings for NURBS surface tessellation are discussed. The easiest way to set tessellation for NURBS surfaces is to use the Tessellation controls in the shape node of the surface. Additionally, you can set tessellation for multiple surfaces at the same time by opening the Attribute Spreadsheet (Window ⇒ General Editors ⇒ Attribute Spread Sheet) to the Tessellation tab.

You can also create an approximation node that can set the tessellation for various types of surfaces. To create an approximation node, select the surface and choose Window ⇒ Rendering Editors ⇒ mental ray ⇒ Approximation Editor.

Figure 12-50 The sphere on the left has a low-tessellation setting. The sphere on the right was rendered with a high-tessellation setting.

c12f050.tif

The editor allows you to create approximation nodes for NURBS surfaces, displacements (when using a texture for geometry displacement), and subdivision surfaces.

To create a node, click the Create button. To assign the node to a surface, select the surface, and select the node from the drop-down menu in the Approximation Editor; then click the Assign button. The Unassign button allows you to break the connection between the node and the surface. The Edit button allows you to edit the node’s settings in the Attribute Editor, and the Delete button removes the node from the scene (see Figure 12-51).

Figure 12-51 The Approximation Editor allows you to create and assign approximation nodes.

c12f051.tif

You can assign a subdivision surface approximation node to a polygon object so that the polygons are rendered as subdivision surfaces, giving them a smooth appearance similar to a smooth mesh or subdivision surface. In Figure 12-52, a polygon cube has been duplicated twice. The cube on the far left has a subdivision approximation node assigned to it. The center cube is a smooth mesh. (The cube is converted to a smooth mesh by pressing the 3 key. Smooth mesh polygon surfaces are covered in Chapter 4, “Modeling II.”) The cube on the far right has been converted to a subdivision surface (Modify ⇒ Convert ⇒ Polygons To Subdiv). When the scene is rendered using mental ray, the three cubes are almost identical. This demonstrates the various options available for rendering smooth polygon surfaces.

Figure 12-52 Three duplicate cubes are rendered as smooth surfaces using an approximation node, a smooth mesh, and a subdivision surface.

c12f052.tif

When editing the settings for the subdivision approximation node, the Parametric Method option is the simplest to use. You can use the N Subdivisions setting to set the smoothness of the render. Each time you increase the number of subdivisions, the polygons are multiplied by a factor of 4. A setting of 3 means that each polygon face on the original object is divided 12 times.

Unified Sampling

new.eps

Unified Sampling offers a simplified approach to your primary sampling settings. Instead of setting individual antialiasing and sampling settings, Unified Sampling uses a single Quality slider. The Quality slider employs enhanced sampling to avoid a lot of the common artifacts. For instance, Unified Sampling removes moiré patterns in your render.

Another advantage to Unified Sampling is the ability to use progressive rendering with the Interactive Photorealistic Render (IPR). When in IPR Progressive Mode the rendered image starts with a low sample rate and is refined with more samples until it achieves the final result. The amount of sampling is derived from your Unified Sampling quality.

Progressive rendering allows you to see an initial preview of your render. Although low quality, the initial rendering provides quick feedback for your render settings, light position, and other attributes that would otherwise take minutes to hours to render. Detecting problems in your render early on enables you to stop the render before wasting time on calculating expensive antialiasing or other quality settings that may not have any bearing on your current refinements. You can further refine your IPR render time with the following options:

Subsample Size Increasing Subsample Size raises the amount of undersampling in your IPR render. Higher undersampling values speed up the rendering of your initial preview.
Max Time This option puts a time limit on how long you want the render to take. The value is measured in seconds. A setting of 0 removes any time limit, causing the render to continue until it reaches its final quality.

Filtering

Filtering occurs after sampling as the image is translated in the frame buffer. You can apply a number of filters, which are found in the menu in the Multi-Pixel Filtering section of the Render Settings window’s Quality tab. Some filters blur the image, whereas others sharpen the image. The Filter Size fields determine the height and width of the filter as it expands from the center of the sample across neighboring pixels. A setting of 1×1 covers a single pixel, and a setting of 2×2 covers four pixels. Most of the time, the default setting for each filter type is the best one to use.

Box Filter Applies the filter evenly across the image’s height and width.
Triangle and Gauss Filters Adds a small amount of blurring to the pixels, whereas Mitchell and Lanczos both sharpen the image.
Jitter Option Reduces flickering or banding artifacts. Jittering offsets the sample location for a given sample block in a random fashion.
Sample Lock Option Locks the sampling pattern. This reduces flickering by forcing mental ray to sample the scene the same way for each frame. It can be useful in animated sequences and when using motion blur. If Sample Lock does not reduce flickering, try Jitter as an alternative.

The Bottom Line

Use render layers Render layers can be used to separate the elements of a single scene into different versions or into different layers of a composite. Each layer can have its own shaders, lights, and settings. Using overrides, you can change the way each layer renders.
Master It Use render layers to set up alternate versions of the space helmet. Try applying contour rendering on one layer and Final Gathering on another.
Use render passes Render passes allow you to separate material properties into different images. These passes are derived from calculations stored in the frame buffer. Each pass can be used in compositing software to rebuild the rendered scene efficiently. Render pass contribution maps define which objects and lights are included in a render pass.
Master It Create an Ambient Occlusion pass for the minigun scene.
Perform batch renders Batch renders automate the process of rendering a sequence of images. You can use the Batch Render options in the Maya interface, or choose Batch Render from the command prompt (or Terminal) when Maya is closed. A batch script can be used to render multiple scenes.
Master It Create a batch script to render five fictional scenes. Each scene uses layers with different render settings. Set the frame range for each scene to render frames 20 through 50. The scenes are named myScene1.ma through myScene5.ma.
Use mental ray quality settings Controlling the quality of your renders is a joint venture between using approximation nodes and render settings. Unified Sampling offers a simplified approach to adjusting the quality of your renders. Combine this with progressive IPR, and you can quickly refine your renders.
Master It Set up an IPR render of the helmetComposite_v04.ma scene. Focus in on half of the helmet and force the render to last only 20 seconds. Adjust the quality for the best results.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset