Chapter 11

Autodesk Maya Rendering

Rendering is the last step in creating your CG work. It’s the process by which the computer calculates the surface properties, lighting, shadows, movement, and shape of objects, and it saves a sequence of images. Although the computer does all the thinking at this point, you still need to set up your cameras and the render to get exactly what you want.

This chapter will show you how to render your scene using the Autodesk® Maya® Software renderer and mental ray® for Maya, and how to create reflections and refractions. In this chapter, you’ll use a wine bottle and a still life from previous chapters, and you’ll animate a camera to render a sequence.

Learning Outcomes: In this chapter, you will be able to
  • Set up your scenes for output through rendering
  • Choose resolutions, image formats, and other settings for rendering
  • Create and edit cameras
  • Render with motion blur and know how to differentiate between the types of motion blur
  • Set up and use mental ray
  • Render in layers and compose them back together
  • Set render layer overrides settings for specific needs
  • Use Final Gathering in mental ray renders for indirect lighting workflows
  • Properly use Ambient Occlusion to create detail in crevices and for contact shadows
  • Apply an HDRI map as a lighting source
  • Apply a displacement map to create finer detail in a model

Rendering Setup

When your lighting scene from the previous chapter is complete, you’ve had a celebration smoothie for your hard work, and you’re ready to start a render, you’ll need to set up how you want it rendered. Although this is the last part of the CG process, from now on you should be thinking about rendering throughout your production. When you create models and textures with the final image in mind and you gear the lighting toward showing off the scene elegantly, the final touches are relatively easy to set up.

Decide which of the render engines included with Maya you’ll use: Maya Software, Maya Hardware (or Hardware 2.0), mental ray for Maya (the most popular and what you started using in the previous chapter), or Maya Vector. Each engine has its own particular workflow and can yield entirely different results, although mental ray and Maya Software are close in appearance if you don’t use the special features of mental ray. The choice of a rendering method depends on the final look you want and sometimes on the number of machines and licenses with which you can render. Maya Software rendering comes with an unlimited number of licenses, which means you can render on any machine you have (with Maya installed), although you can work with the Maya application only on as many machines for which you have licenses. There are also third-party developers in the CG field that have created other render engines that plug right into Maya, such as V-Ray® for Maya, Maxwell, and Pixar’s RenderMan® for Maya.

No matter which renderer you use, the lighting and general setup are fairly common across the board. Even then, it’s a good idea to choose your render engine as you begin creating your scene. It’s best to begin with basic mental ray to pick up the fundamentals of lighting, texturing, and rendering before you venture into mental ray special features or try other renderers.

Regardless of the type of render, you need to specify a set of common attributes in the Render Settings window. Choose Window ⇒ Rendering Editors ⇒ Render Settings to open the Render Settings window. Figure 11-1 shows on the left the Render Settings window for the Maya Software renderer and its tabs: the Common tab and the Maya Software tab. You use the options in this window’s Common tab to set up all your rendering preferences, including the resolution, file type, frame range, and so forth.

Figure 11-1: The Render Settings window

c11f001.tif

The Common tab contains the settings common to all the rendering methods, such as image size. The Maya Software tab gives you access to render-specific attributes, such as quality settings, raytracing settings, motion blur, and so on.

If you switch the Render Using pull-down menu from the default Maya Software setting to mental ray, you’ll notice several tabs: Passes, Features, Quality, Indirect Lighting, and Options, as shown on the right in Figure 11-1. These tabs give you access to all the settings for the incredibly powerful mental ray renderer.

You may notice that some of the render engines like mental ray may not show up in the Render Settings window right away. In this case, the renderers’ respective plug-ins must be loaded first. I’ll discuss this further in the section “mental ray for Maya” later in this chapter.

Choosing a Filename

Rendered images are identified by a filename, a frame number, and an extension, in the form name.#.ext—for example, stillife.0234.tif.

In the File Name Prefix text box, enter the image sequence name. If you don’t enter anything in this text box, Maya automatically names your rendered images after your scene file (stillife in the example). This is the preferred naming convention; using it, you can immediately identify the scene file from which a particular image file was rendered.

In the Frame/Animation Ext drop-down list box, select name.#.ext to render out a sequence of files. If you leave this setting at the default of name.ext, only a single frame will render, no matter what the animation range is in the Time slider.


Name.#.ext is perhaps the most commonly used convention, as opposed to name.ext.# or name.#, because it allows you to identify the file type easily in Windows. Although Mac OS X isn’t as picky about the order of the number and extension, most Mac compositing software applications (such as After Effects and Shake) want filenames that end in the three-letter extension. Therefore, it’s best for both Mac and Windows users to employ the name.#.ext format.

The extension portion of the image name is a three-letter abbreviation for the type of file you’re writing to disk to ensure that you can identify the file type.

Image Format

In the Image Format drop-down list box, select the type of image file you want to render. Maya will add the appropriate extension to the filename.

The image format you choose depends on your own preference and your output needs. For example, Joint Photographic Experts Group (JPEG) files may be great for the small file sizes preferred on the Internet, but their color compression and lack of alpha channel (a feature discussed later in this chapter) make them undesirable for most professional CG work beyond test renders.

It’s best to render a sequence of images rather than a movie file for two reasons. First, you want your renders to be their best quality with little or no image compression. Second, if a render fails during a movie render, you must re-render the entire sequence. With an image sequence, however, you can pick up where the last frame left off.

The best file type format to render to is Tagged Image File Format (TIFF). This format enjoys universal support, has little to no compression, and supports an alpha channel. Almost all image-editing and compositing packages can read Targa- and TIFF-formatted files, so either is a safe choice most of the time. For more on image formats, see Chapter 1, “Introduction to Computer Graphics and 3D.”

Frame Range

Maya defaults to the range 1–10, which you may need to change to render your entire sequence. You must choose a naming convention other than Name (Single Frame) to access the frame range. This is a common oversight when people first try to render their animations and see that only a single frame renders.

Enter the Start Frame and End Frame attributes for part of the sequence or the entire sequence. By specifying new start and end frames, you can render different portions of a sequence or pick up where a previous render left off.

The By Frame attribute specifies the intervals at which the sequence will render. For example, if you want to render only the odd-numbered frames, set the Start Frame attribute to 1, and set the By Frame attribute to 2. If you want to render only even-numbered frames, set Start Frame to 2, set By Frame to 2, and so on. Typically, you leave By Frame set to 1 so that Maya renders each frame.

The Frame Padding attribute and slider have to do with the way an operating system, such as Windows or Mac OS X, orders its files by inserting leading zeros in the frame number. For example, if Frame Padding is set to 4, the filename contains three leading zeros; therefore, frame 8 is name.0008.tif as opposed to name.8.tif (which is set to a padding of 1).

Large sequences of files are easier to organize if they all have a frame padding of at least 3. Figure 11-2 shows an image sequence without padding and with padding. The files without padding aren’t shown in numeric order.

Figure 11-2: Images rendered without frame padding (left). Frame padding makes file sequences easier to organize (right).

c11f002.tif

Camera and Channels

Under the Renderable Cameras heading, you choose the camera to render, and enable the Alpha and Depth channels.

Image files are composed of red, green, and blue channels. Each channel specifies the amount of the primary additive color (red, green, or blue, respectively) in the image. (See Chapter 1 for more on how computers define color.) Some file formats save a fourth channel, called the alpha channel. This channel defines the image’s transparency level. Just as the red channel defines how much red is in an area of the image, the alpha channel defines how transparent the image is when layered or composited on another image. If the alpha channel is black, the image is perfectly see-through. If the alpha channel is white, the image is solid and opaque. The alpha channel is also known as the matte. An object with some transparency like tinted glass will render with a gray alpha channel, as shown in Figure 11-3.

Figure 11-3: This wine bottle’s transparency renders with a gray alpha channel.

c11f003.tif

The alpha channel can be displayed in the Render View window. As discussed later in this chapter, your test renders also display in this window.


To view an image’s alpha channel in the Render View window, click the Display Alpha Channel icon (c11g001.tif). To reset the view to RGB (full-color view), click the Display RGB Channels icon (c11g002.tif).

Most renders have the alpha channels selected, so leave the Alpha Channel (Mask) check box selected at all times, as shown in Figure 11-4. Note, however, that JPEG, Graphics Interchange Format (GIF), and Windows bitmap files don’t support alpha channels, regardless of whether the Alpha Channel (Mask) check box is selected.

Figure 11-4: Output an alpha channel.

c11f004.tif

Only a few file formats, such as Maya IFF, support the depth channel. This grayscale channel resembles the alpha channel but conveys depth information—that is, the distance of an object from the camera. The Depth Channel (Z Depth) setting is typically used when compositing images.

Setting Resolution

The Width and Height attributes set the pixel size of the image to be rendered, a.k.a. the image resolution. In the Image Size section of the Render Settings window, you can select a resolution from the Presets drop-down list. The commonly used resolution for professional broadcast is 1920×1080 High Definition, which appears as HD 1080in the Presets list. To composite Maya CG into a home-shot digital video (DV) movie, you use the standard DV resolution of 720×480 to render your scene, but you must enter that resolution manually in the Width and Height fields. (For more on resolutions, see Chapter 1.)

The Device Aspect Ratio and Pixel Aspect Ratio attributes adjust the width of the image to accommodate certain professional output needs; you do not need to adjust them here.


Make sure your Pixel Aspect Ratio attribute is set to 1 before you render, especially HD resolutions, unless you need to render CCIR 601/Quantel NTSC or DV for television needs; otherwise, your image may look squeezed or widened compared to any live-action footage you use to composite.

The higher your resolution, the longer the scene will take to render. With large frame sequences, it’s advisable to render tests at half the resolution of the final output or less to save time. In addition to turning down the resolution for a test, you can use a lower-quality render.

Selecting a Render Engine

Maya allows you to select a render engine in the Render Settings window. Although mental ray for Maya is most commonly used, the other rendering methods give you flexibility in choosing a final look for your project.

Maya Software

Maya Software, the default software rendering method, can capture just about everything you want in your scene, from reflections to motion blur and transparencies. You can use the software rendering method in a couple of ways.

Using Raytracing

Raytracing, a topic introduced in Chapter 10, “Autodesk Maya Lighting,” is used to incorporate two optical effects into a rendering that the default software rendering method can’t handle. Raytracing traces rays of light from each light source to every object in the shot and then traces the light’s reflection from the object to the camera’s lens. This allows true reflections and refractions to appear in the render as well as highly defined shadows (for more on shadows, see Chapter 10).

True Reflections True reflections occur when every object in the scene is viewed in a reflective surface, as a reflection of course. You can also have objects with reflections explicitly turned off through the Render Stats section in the Attribute Editor in case you don’t want a particular reflection, which is common. Although it’s possible to simulate reflections in Maya Software using reflection maps, true reflections can be generated only through raytracing. (In Chapter 7, “Autodesk Maya Shading and Texturing,” the TableLamp project shows how to apply reflection maps.)
Refractions Refractions occur when light bends as it passes through one medium into another medium of different density. For example, a pencil in a glass of water appears to be broken. The light bouncing off the pencil refracts as it travels from the water into the air, bending a bit during the transition. That displaces the view of the pencil under the water, making it seem broken.

You saw in the previous chapter that raytracing is also a vital component of mental ray for Maya as well as the Maya Software renderer.

As with raytraced shadows, raytraced reflections need to be enabled. To do so, click Raytracing in the Raytracing Quality section of the Maya Software tab in the Render Settings window. Unlike raytraced shadows, however, raytraced reflections need not be explicitly turned on through the lights.

As soon as raytracing is enabled, any reflective surface receives a true reflection of the objects and environment in the scene. Even objects with reflection maps reflect other objects in addition to their reflection maps. For more on reflection maps, see the section “Reflections and Refractions” later in this chapter.

Render Quality

With software rendering, the render quality depends most noticeably on anti-aliasing. Anti-aliasing is the effect produced when pixels appear to blur together to soften a jagged edge on an angled line. Increasing the anti-aliasing level of a render produces an image that has smoother angles and curves. The Render Settings window contains presets that specify this level and a few others to set the quality of your render. Follow these steps:

1. In the Render Settings window, make sure Maya Software is selected in the Render Using drop-down list, and click the Maya Software tab.
2. In the Anti-aliasing Quality section, select either Preview Quality or Production Quality from the Quality preset drop-down list.

Figure 11-5 shows the fruit still life from Chapter 10 rendered with the Preview Quality preset and the same image with the Production Quality preset.

Figure 11-5: With Preview Quality (left), the edges of the fruit are jagged. With Production Quality (right), the jaggedness is gone.

c11f005.tif

Of course, the higher the quality, the longer the render will take. As you become more experienced, you’ll be better able to balance uncompromised quality with efficient render times.

Maya Hardware and Hardware 2.0

The hardware rendering method uses your graphic card’s processor to render the scene. Hardware renders are similar to what you may see when you play a 3D video game.

This method results in faster render times, but it lacks some of the features and quality you get from a software render. In Figure 11-6, the first image shows a wine bottle as rendered through hardware. The render time is blazingly fast, but the quality suffers. The second image shows the software render of the same frame. Hardware rendering becomes a good way to test-render a scene, although only some video cards fully support Maya Hardware rendering.

Figure 11-6: The hardware-rendered wine bottle (left) lacks some subtleties. The software-rendered wine bottle shows better specularity and surface detail (right).

c11f006.tif

To use the Maya Hardware renderer, in the Render Settings window, make sure Maya Hardware is selected in the Render Using drop-down list. To specify hardware quality, select a level from the Number Of Samples drop-down list on the Maya Hardware tab.

mental ray for Maya

mental ray for Maya has become a standard for rendering through Maya, supplanting the Maya Software renderer because of its stability and quality results. The mental ray for Maya rendering method can also let you emulate the behavior of light even more realistically than the other rendering methods, as you saw in the previous chapter’s Physical Sun and Sky exercise. Based on raytracing, mental ray takes the concept further by adding photon maps to the light traces. That is, it projects photon particles from lights and records their behavior and trajectory. The end result allows the phenomena of light caustics and bounce, also known as global illumination.

The mental ray for Maya renderer can be an advanced and intricate rendering language with shaders and procedures all its own. This chapter briefly covers one of the popular mental ray methods called Final Gather using an HDR lighting dome. To use mental ray, you still need to be experienced with the basics of lighting and rendering. At its base, mental ray will give you results similar to those of Maya Software, without any of the bells and whistles enabled.

Maya Vector

Vector rendering lets you render your objects with an illustrated or cartoon look. You can render “ink” outlines of your characters to composite over flat-color passes. Figure 11-7 shows the fruit still life rendered with Maya Vector. This rendering method is different from the Maya toon-shading feature, which is briefly covered in Chapter 12, “Autodesk Maya Dynamics and Effects.”

Figure 11-7: The fruit still life as a vector render

c11f007.tif

Maya Vector can output animated files in Adobe Flash format for direct use in web pages and animations, as well as Adobe Illustrator files and the usual list of image formats. To specify the attribute settings for Maya Vector, you use the Maya Vector tab in the Render Settings window (see Figure 11-8).

Figure 11-8: The Maya Vector rendering settings

c11f008.tif

In the Fill Options section, click the Fill Objects check box, and select the number of colors for each object to set the look of the render. If you want the renderer to include an outline of the edges of your geometry, in the Edge Options section, click the Include Edges check box and set the line weights.

Previewing Your Render: The Render View Window

The Render View window automatically opens when you test-render a frame, as you’ve already seen in your work through this book. To open it manually, choose Window ⇒ Rendering Editors ⇒ Render View. Your current scene renders in the Render View window. Figure 11-9 shows the important icons in this window.

Figure 11-9: The Render View window

c11f009.eps
Redo Previous Render Renders the last-rendered view panel.
Render Region Renders only the selected portion of an image. To select a portion of an image, click within the image in the Render View window, and drag a red box around a region.
Snapshot Grabs a snapshot of the currently selected modeling panel and inserts it as a background in the Render View. You can more easily do a render region this way.
Open Render Settings Window Opens the Render Settings window (also known as the Render Globals window in previous versions of Maya).
Display RGB Channels Displays the full color of the image.
Display Alpha Channel Displays only the alpha matte of the render as a black-and-white image.
Display Real Size Resets the image size to 100 percent to make sure the image displays properly. When the Render View window is resized or when you select a new render resolution, the image renders to fit the window, and the image is resized if needed. If your render looks blocky, make sure the Render View window is displaying at real size before adjusting the options in the Render Settings window.
Select Renderer Lets you select the rendering method. This is the same as selecting it in the Render Settings window.
Information Readout At the bottom of the Render View window is a readout of information about the frame rendered. This information tells you the resolution, renderer used, frame number, render time, and camera used to render. This readout is a huge help in comparing different render settings and different frames as you progress in your work, especially when you keep images in the buffer (as explained later).

Saving/Loading an Image

Although you typically use the Render View window to test a scene, you can also use it to save single frames by choosing File ⇒ Save Image to save in any image formats supported in Maya. Likewise, choose File ⇒ Open Image to display any previously rendered image file in this window. If your task in Maya is to create a single frame, this is the best way to render and save it.

Keep/Remove Image

The Render View window is a prime place to see adjustments to various parts of your scene. You can store images in its buffer by clicking the Keep Image icon. When you do, a scroll bar appears at the bottom of the window, and you can scroll through any saved images. This is handy for making a change, rendering it, and scrolling back and forth between the old saved image and the new render to make sure the change is to your liking. You can store a number of images in the buffer. For a faster way to preview changes, use IPR rendering, as discussed next.

IPR Rendering

As you saw in Chapter 7, a fast way to preview changes to your scene is to use Maya Interactive Photorealistic Rendering (IPR). After you IPR-render a view panel, specify the region you want to tune by dragging a box around that area of the image in the Render View window. Maya updates that region every time you make a shader or lighting change to the scene. Figure 11-10 shows the decorative box as an IPR mental ray render as the color and specular levels are being fine-tuned against a wireframe snapshot of the model.

Figure 11-10: IPR rendering lets you fine-tune your textures and lighting with near-real-time feedback.

c11f010.tif

IPR is perfect for finding just the right lighting and specular levels. It will, however, register raytracing elements such as refractions and true reflections only if the scene is set to render through mental ray for Maya. Overall, IPR quality is fairly close to that of a full render while still allowing you to watch your tuning in near real time.

Reflections and Refractions

As you saw in Chapter 7, creating a “faked” reflection with a map for an object is pretty simple. To generate true reflections without the use of maps, however, you’ll need to enable raytracing in either Maya Software or mental ray for Maya. With raytracing, Maya reflects any objects in the scene that fall in the proper line of sight.


Raytracing with mental ray
Enabling raytracing in mental ray is as simple as checking the Raytracing box in the Render Settings window on the Features tab.

Raytraced Reflections

To enable raytraced reflections, use a material with a Reflections attribute, such as a Phong, and open the Render Settings window. Choose Maya Software, and on the Maya Software tab, click the Raytracing check box in the Raytracing Quality section. (See Figure 11-11.)

Figure 11-11: Enabling raytracing in Maya Software rendering

c11f011.tif

The sliders control the quality of the render by specifying how many times to reflect or refract for any given object. Setting Reflections to 2, for example, enables an object’s reflection in a second object to appear as part of its reflection in a third object.

The first image in Figure 11-12 shows the still life reflecting onto the surface of its table. In this case, Reflections is set to 1. If you increase Reflections to 2, however, you’ll see the reflections of the pieces of fruit in each other also reflecting in the surface of the table.

Figure 11-12: Reflections set to 1 (left); Reflections set to 2 (right)

c11f012.eps

Notice the difference in the reflections of the fruit in the table between the two renders. Raytraced reflections can consume valuable render resources and time, so it’s a good idea to make your scene efficient.

You can control the number of reflections on a per-object basis as opposed to setting limits on the entire scene through the Render Settings window. To access a shader’s reflection limits, select the shader in the Hypershade, and open the Attribute Editor. In the Raytrace Options section, drag the Reflection Limit slider to set the maximum number of reflections for that shader. The lower value (either this value or the Reflections value in the Render Settings window) dictates how many reflections are rendered for every object attached to that shader. The default shader reflection limit is 1, so make sure you change the Reflections value as well as each shader’s value if you want more than one level of reflection.

Furthermore, you may not want some objects to cast reflections in a scene with raytraced reflections. To specify that an object doesn’t cast reflections, select the object in a Maya panel, and open the Attribute Editor. In the Render Stats section, clear the Visible In Reflections check box.

Rendering Refractions

Refractions are also a raytraced-only ability. Refractions require that an object be semitransparent so that you can see through it to the object (or objects) behind it being refracted. To control refractions, use the shader.

To enable refractions, select the appropriate shader in the Hypershade, and open the Attribute Editor. In the Raytrace Options section, click the Refractions check box. Now you need to set a refractive index for the shader and a refraction limit, similar to the reflection limit.

The refractive index must be greater or less than 1 to cause a refraction. Typically, a number within 0.2 of 1 is perfect for most refraction effects. The first image in Figure 11-13 is raytraced with a refractive index of 1.2 on the wine bottle and glasses; the second image has a refractive index of 0.8 on both bottle and glasses.

Figure 11-13: Refractive index of 1.2 (left render); refractive index of 0.8 (middle render); setting the refraction quality in the Render Settings and the shader (right two windows)

c11f013.tif

You can specify whether an object is visible in a refracting object by clicking or clearing the Visible In Refractions check box in the Render Stats section of the object’s Attribute Editor.

When rendering refractions, make sure the Refractions attribute under Raytracing Quality in the Maya Software tab of the Render Settings is set to at least 2 or higher; otherwise, your refraction may not appear properly. For mental ray, it is the Refractions attribute found under the Raytracing heading on the Quality tab, as shown in Figure 11-13 (right). You will also need to set the Refraction Limit found under the Raytrace Options heading in the Attribute Editor for the refractive shader in question.

Using Cameras

Cameras capture all the animation fun in the scene. The more you know about photography, the easier these concepts are to understand.

The term camera, in essence, refers to the perspective view. You can have as many cameras in the scene as you want, but it’s wise to have a camera you’re planning to render with placed to frame the shot and a different camera acting as the perspective work view so you can move around your scene as you work. The original persp view panel fits that latter role well, although it can be used as a render camera just as easily.

You can also render any of your work windows to test-render orthogonal views of your model the same way you render a perspective view.

Creating a Camera

The simplest way to create a new camera is to choose Panels ⇒ Perspective ⇒ New, as you’ve seen in a previous exercise. This creates a new camera node in Maya and sets that active panel to its view.

You can select a camera and transform it (move it, rotate it, scale it) just as you would select and transform any other object in Maya to be animated or positioned. Furthermore, you can move a camera and rotate it using the Alt/Option key and mouse button combinations.

For example, click inside a new Maya Scene Perspective window to make it active. Select that view’s camera by choosing View ⇒ Select Camera. The camera’s attributes appear in the Channel Box. Try moving the view around using the Alt/Option key and mouse button combinations. Notice how the attributes change to reflect the new position and rotation of the camera. You can animate the camera—for example, zoom in or out or pan across the scene—by setting keyframes on any of these attributes.

Camera Types

You can create three types of nonstereo cameras for your scene: Camera; Camera And Aim; and Camera, Aim, And Up (also known as single-node, two-node, and three-node cameras, respectively). To create any of these cameras, choose Create ⇒ Cameras. You can also change the type of these cameras at any time through the Attribute Editor. The other two options for creating cameras are Stereo Camera and Multi Stereo Rig to allow for a stereoscopic effect, although they aren’t covered in this book.

The single-node camera (Camera) is the most common (see Figure 11-14). This camera consists of a single camera node that you move and rotate as you would any other object for proper positioning. The persp view panel’s camera is a single-node camera.

Figure 11-14: A single-node camera

c11f014.tif

The two-node camera (Camera And Aim) consists of the camera node and an aim node. You use the aim node to point the camera as opposed to rotating it to orient it properly. This is useful for animating a camera following an object. You animate the movement of the aim node to follow your object much as you’d follow a car around a racetrack. The camera pivots to follow its aim point and, hence, the object. (See Figure 11-15.)

Figure 11-15: A two-node camera

c11f015.tif

The three-node camera (Camera, Aim, And Up) has a camera node, an aim node, and an up node. The additional up node is to orient the camera’s up direction. This gives you the ability to animate the side-to-side rotation of the camera as well as its aim direction. (See Figure 11-16.)

Figure 11-16: A three-node camera

c11f016.tif

Camera Attributes

As an example, set your project to Lighting, and download the still_life_render_v02.mb scene from the Lighting project on the book’s web page, www.sybex.com/go/introducingmaya2014. You’ll see a green box in the persp view panel that displays the resolution (set to 640×480) and the name of the camera (camera1).

Special attributes control the function of camera nodes. To set these attributes, follow these steps:

1. With camera1 selected, open the Attribute Editor (press Ctrl+A or choose View ⇒ Camera Attribute Editor).
2. At the top of the window, select the type of camera controls you want. The Controls attribute sets the type of camera from single- to two- to three-control nodes. Figure 11-17 shows the Attribute Editor for the persp camera.

Figure 11-17: The Attribute Editor for the persp camera

c11f017.tif

Focal Length

The Focal Length attribute specifies the length of the lens. The lower the focal length (a.k.a. short lens), the wider the view. At very low numbers, however, the image is distorted, as you can see in the comparison in Figure 11-18. The higher the focal length, the closer the subject seems to the camera.

Figure 11-18: Different focal lengths

c11f018.eps

Although adjusting the Focal Length attribute of a camera zooms in and out, it isn’t the same as moving the camera closer to your subject using the Alt+right-click procedure to zoom in view panels (which is called trucking the camera). Focal-length zooming can create optical distortions, such as can be created with a fish-eye lens.

If you need to match some CG element in Maya to a photograph or video that you’ve imported as an image plane, set your camera’s focal length to match that of the real camera used for the background photo.

Clipping Planes

All cameras in Maya have clipping planes that restrict the amount of information that can be seen through them. The clipping plane is defined by the Near Clip Plane and Far Clip Plane attributes. These set the minimum and maximum distances, respectively, of the clipping plane. Any object or portion of an object that passes beyond these distances won’t show in the window and should not render.

If you notice objects disappearing as you move your camera and create a scene, it may be because of the clipping plane. Increase the Far Clip Plane attribute, and the objects should reappear in the view.

Film Back

The Film Back attributes concern the type of output you’ll be dealing with after your renders are finished and you’re ready to put your animation on tape, DVD, film, or what have you.

Film Gate Defines the aspect ratio of your camera’s view. Images that are output to HD television have an aspect ratio of 1:1.78, which funnily enough does not have a preset in the Film Gate drop-down list. For an HD camera output, simply set Film Aspect Ratio to 1.78. For standard-definition TV output, simply select 35mm TV Projection from the Film Gate drop-down list. (For more on aspect ratios, see Chapter 1.)
Fit Resolution Gate Allows you to align footage you may have imported as an image plane to match up CG properly to live action.

Overscan

Found in the Display Options section for the camera’s Attribute Editor, Overscan lets you resize the view without changing the film gate that will render. For example, the scene on the left in Figure 11-19 is set up with an Overscan setting of 1.3, allowing you to see more than what will render, which is defined by the outline box. The scene on the right in Figure 11-19 is set up with an Overscan setting of 2, which increases even more how much you see in the camera1 panel but doesn’t change the view when rendered.

Figure 11-19: Overscan settings define how much you can see of your scene in the camera but not how much renders in the image.

c11f019.tif

You can turn the green box in the panel on and off through the camera’s Attribute Editor. Also in the Display Options section are Display Film Gate and Display Resolution check boxes, shown in Figure 11-20. Ideally, these two green boxes should align perfectly in the view pane. If the resolution box (the solid green line) doesn’t line up with the film gate box (the dashed green line), change your film gate selection to match the resolution’s aspect ratio in the Render Settings window. A resolution of 640×480, for example, has an aspect ratio of 1.33, the same as the 35mm TV Projection film gate currently selected for this scene.

Figure 11-20: Camera display options

c11f020.tif

Environment

In the Environment section, you’ll find attributes to adjust the background color that renders and to create an image plane, as shown in Figure 11-21.

Figure 11-21: Adjusting the camera’s environment and creating camera image planes

c11f021.tif

If you want to use a solid color as the camera’s background when you render, click the color swatch next to Background Color to change the background color in your renders using the Color Chooser. The slider allows you to control the value, or brightness, of the current color. Neither changes the background color of your view panels, however.

Camera Image Planes

A camera image plane isn’t like the reference planes you used for modeling the red wagon in Chapter 6, “Practical Experience.” In this case, an image plane is created to be a background specific for that particular camera or view panel, but it’s typically also used as a reference, much like the planes you created and mapped in Chapter 6. Camera image planes are useful when you’re matching your scene to existing footage or an image. For example, if you need to animate a flying saucer into a home video of a family gathering, you would import the video as an image sequence into Maya through a perspective camera to be able to line up your UFO properly to zap your cousins.

You can import an image plane by clicking the Create button in the Environment section of the Attribute Editor (see Figure 11-21) or directly through a view panel’s menu, as you’ll see in the next exercise.

In this exercise, you’ll learn how to import a sketch of an axe into the Front view panel for a modeling assignment. (You won’t actually model the axe, however.) The image, a sketch of a simple axe design, is to be used as a template for outlining the model. You can find the file Axe_outline_1.tif in the Sourceimages folder of the Axe project on the companion web page; it’s shown in Figure 11-22.

Figure 11-22: An image to import as a camera image plane

c11f022.tif

Follow these steps:

1. Choose File ⇒ New Scene.
2. Import the sketch of the axe into Maya as a camera image plane for the Front view panel. In your Front window, choose View ⇒ Image Plane ⇒ Import Image.
3. Point to Axe_outline_1.tif in the Axe project’s Sourceimages folder and load it. The sketch displays in your Front window and as a selected plane in the Perspective window (see Figure 11-23). You should see the image plane’s attributes in the Attribute Editor. At first, the plane looks a little small in your view panels, but you can adjust the size of the image plane in the Attribute Editor under the Placement Extras heading using the Width and Height attributes. Just make sure that the Maintain Pic Aspect Ratio box is checked. In Figure 11-23, the Width and Height settings have been adjusted to 25.0×17.325.

Figure 11-23: Importing a camera image plane into the Front view panel

c11f023.tif

Now you’d be ready to trace the outline of the axe easily in the Front view panel, if you were going to model the axe.


If you can’t see the image plane, click Show in the view panel, and make sure Cameras is checked.

Image Plane Sequence

A movie file or a sequence of files can also be brought in to animate or to track motion (a.k.a. matchmoving) as a camera image plane. It’s generally best to use a frame sequence, however. When you bring in an image for an image plane, check the Use Image Sequence box in the image plane’s Attribute Editor window, as shown in Figure 11-24. Maya will automatically load the image to correspond to the frame number in the scene. For example, at frame 29 in your Maya animation, Maya loads frame 29 of your image sequence. But your image file sequence must be numbered correctly (such as filename.###.tif). You can import an image plane into any perspective view in exactly the same way.

Figure 11-24: Importing a sequence of image files as a camera image plane

c11f024.tif

If the clutter of seeing a camera image plane in the other windows bothers you, under Image Plane Attributes in the Attribute Editor, change the radio button selection next to Display from In All Views to Looking Through Camera. This setting removes the image plane from the other windows.

Motion Blur

Motion blur is an optical phenomenon that occurs when an object moves quickly in front of a camera: the object looks blurred as it crosses the frame. Maya Software rendering renders motion blur in two ways—2D blur or 3D blur—although neither will render as reflections.

  • In the 2D blur process, Maya calculates after the frame is rendered. Any objects moving in the frame are blurred with a 2D filter effect. The 2D blur is effective for most applications and faster than 3D blur.
  • The 3D blur process is calculated while a frame of the sequence is rendering. Every motion blur–enabled object is blurred with typically better results than 2D blur but at a cost of a much longer render time.

I’ll briefly cover motion blur in mental ray for Maya later in the chapter.

To enable motion blur for the Maya Software renderer, open the Render Settings window. In the Motion Blur section on the Maya Software tab, click the Motion Blur check box. Then, choose 2D or 3D blur.

Typically, you control the amount of blur rendered for 2D and 3D by setting the Blur By Frame attribute—the higher the number, the greater the blur. Using additional controls, however, you can increase or decrease the 2D blur effect in the render. The Blur Length attribute affects the streakiness of the blur to further increase or decrease the amount of motion blur set with the Blur By Frame attribute.


Setting a camera’s Shutter Angle attribute (in the camera’s Attribute Editor in the Special Effects section) also affects the amount of blur rendered—the higher the number, the greater the blur.

Batch Rendering

So far, you’ve used single-frame rendering numerous times to see a scene in the Render View window. But how do you start rendering an animation sequence to disk? This is called batch rendering in Maya, whichever renderer you use. To batch-render an entire scene, follow these steps:

1. Open the Render Settings window.
2. Choose Maya Software to use to render, enter the start and end frames of your animation, and select your image format. Select your quality and resolution settings. Finally, set the camera you want to render in the Renderable Camera attribute.

Be sure to select name.#.ext in the Frame/Animation Ext drop-down list to render a sequence of files. Remember, if you leave the default setting, which is name.ext, only a single frame renders.

3. In the main Maya window under the Rendering menu set, choose Render ⇒ Batch Render optionbox.png to open the Batch Render Animation dialog box (or the Batch Render Frame box when rendering a single image). Figure 11-25 shows the Maya Software rendering batch options on top, and the bottom image shows the batch options for mental ray rendering.

Figure 11-25: The Batch Render Frame dialog box for Maya Software (top) and mental ray rendering (bottom)

c11f025.tif
4. If you have a multiprocessor, hyperthreading, or dual-core machine, select how many CPUs you would like to use to render your scene. A value of 0 will use all processors on the machine.
5. Click Batch Render to render the frame range you specified in the Render Settings window. The render occurs in the background, and you see progress updates in the Command line at the bottom of your Maya screen and in the Script Editor window if you open it.

To see a frame as the batch render progresses, choose Render ⇒ Show Batch Render. To cancel a batch render, choose Render ⇒ Cancel Batch Render.

When you batch render, your image files are written to the Images folder of the current project. Make sure your project is properly set; otherwise, your files will end up in an unexpected folder. You can always see the render path and the image name at the top of the Render Settings window, as shown in Figure 11-26.

Figure 11-26: The Render Settings window shows you where the images will be rendered.

c11f026.tif

Rendering the Wine Bottle

In this section, you’ll set up and render an animated camera to move over 25 frames of a wine bottle still life.

Set your current project to the Lighting project downloaded from the book’s web page, and then load still_life_render_v01.mb. You’ll adjust your render settings and some shader properties to make the wine bottle look more like glass.

Selecting Render Settings Options

Set your resolution and quality settings in the Render Settings window.

1. Open the Render Settings window, and select Maya Software. Click the Maya Software tab.
2. From the Quality drop-down list, select Production Quality. Doing so presets the appropriate settings to produce a high-quality render.
3. Click the Common tab. Set Frame/Animation Ext to name.#.ext, set Start Frame to 1, set End Frame to 25, and set Frame Padding to 2.
4. From the Image Format drop-down list, select TIFF.
5. Make sure Renderable Camera is set to camera1. In the Image Size section, set Presets to 640×480.

Setting Up the Scene

Now, set up some of the objects in the scene. The wine bottle has been imported into the still life scene, and three wine glasses have been added. All the lights are in place, as is the camera.

Start by setting up this scene to raytrace to get true reflections and refractions.

1. Turn on refractions for the Glass shaders. In the Hypershade, select the Glasses material, and open the Attribute Editor. In the Raytrace Options section, click the Refractions check box, and set Refractive Index to 1.2. Set Reflection Limit to 2. Select the Wine_Bottle material, and repeat the previous steps.
2. You need to change your lights’ shadows to raytraced shadows. Remember that semitransparent objects cast solid shadows unless shadows are raytraced, so the glasses and wine bottle will cast shadows as if they were solid and not glass. In the Outliner, select spotLight1. In the Attribute Editor, in the Shadows section, enable Use Ray Trace Shadows. Repeat these steps for the remaining two shadow-casting lights: spotLight4 and spotLight3. Figure 11-27 shows the three shadow-casting lights in the scene in white.

Figure 11-27: Shadow lights

c11f027.tif
3. Open the Render Settings window, and turn on raytracing in the Raytracing Quality section. Set Reflections to 2.

You can’t select all three lights at once to turn on raytraced shadows in the Attribute Editor. Any adjustments you make in the Attribute Editor affect only the most recently selected object, not multiple selections.

Setting Up the Camera

Next, you’ll set up the camera to render the scene.

1. Open the camera’s Attribute Editor through the camera1 panel (choose View ⇒ Camera Attribute Editor).
2. Select the Display Film Gate option in the Display Options section to turn on a dashed green box in the camera1 panel. Enable the Display Resolution option. Notice that the two boxes aren’t aligned.
3. Because the resolution is 640×480, you’ll use a 1.33 aspect ratio. Select 35mm TV Projection from the Film Gate drop-down list. The two green boxes now align. Although it’s not absolutely necessary to match the resolution with the film gate, it’s definitely good practice to do so, especially if you’ll later insert CG in live-action videos.
4. As soon as you change the film gate, the framing of the scene changes. You must move the camera out to frame the entire still life. If you try to use the Alt key and mouse button combinations to zoom out, you’ll notice that you can’t move the camera in this scene: the movement attributes for the camera have been locked to prevent accidental movement that would disrupt the shot.
5. To unlock the camera, choose View ⇒ Select Camera. The camera’s attributes appear in the Channel Box. Some are grayed out, signifying that they’re locked and can’t be changed. Highlight the locked attributes, and right-click Unlock Selected in the Channel Box.
6. Create an animated camera move to pull out and reveal the still life slowly over 25 frames. Set your Range slider to 1 to 25 frames. Go to frame 1. The camera1 view should be similar to that shown in Figure 11-28. Select all three Translate and Rotate channels in the Channel Box, and right-click Key Selected to set keyframes for the first camera position.

Figure 11-28: The camera view at the beginning of the animation

c11f028.tif
7. Zoom (actually, truck) the camera out by pressing Alt+right-click to a wider framing to reveal the entire still life. Highlight the Translate and Rotate channels again in the Channel Box, and set keyframes for them. (See Figure 11-29.)

Figure 11-29: Pull out the camera.

c11f029.tif

Scrub your animation, and you’ll see a pullout revealing the full scene.


You can lock the camera to prevent accidentally moving the view after you set your keyframes, especially if Auto Keyframe is on. Select the Translate and Rotate attributes in the Channel Box, and right-click Lock Selected.

Batch Rendering and Playing Back the Sequence

Now, you’re ready to render out the 25-frame sequence. Choose Render ⇒ Batch Render.

Because you’re raytracing this scene at full resolution, this render could take 20 minutes or longer. To chart the progress of the render, open the Script Editor by clicking its icon on the Help line or by choosing Window ⇒ General Editors ⇒ Script Editor.

To see the frames play back, you’ll need a program that can load the images in sequence and play them back for you. You can also import the image sequence into a compositing or editing program, such as Adobe After Effects or Premiere, to play back as a clip and edit as you like.

You can also use FCheck, a frame viewer that is included with Maya. This small and surprisingly powerful program plays back your images in real time so that you can judge your finished animation. To use FCheck, follow these steps:

1. In Windows, choose Start ⇒ All Programs ⇒ Autodesk ⇒ Autodesk Maya 2014 ⇒ FCheck to open the FCheck window, as shown in Figure 11-30.

Figure 11-30: FCheck, shown here with a sample image, plays back your rendered sequence.

c11f030.tif
2. Choose File ⇒ Open Animation.
3. In the file browser, find your Images folder in your project, and click the first frame of the sequence you want to play back. FCheck loads the images frame by frame into RAM and then plays them back in real time. Just set your playback speed and use the DVD controls to play back your sequence.

mental ray for Maya

You had some experience with mental ray rendering in the previous chapter as you lighted using Physical Sun and Sky, which automatically used Final Gather to render. In this part of the chapter, I’ll discuss mental ray options to begin to scratch the surface of this incredibly powerful renderer.

First, if you haven’t done so already, be sure that mental ray is loaded. When you first start up, mental ray for Maya may not load because it’s considered a plug-in. Choose Window ⇒ Settings/Preferences ⇒ Plug-in Manager to open the Plug-in Manager, shown in Figure 11-31. Make sure both the Loaded and Auto Load check boxes for Mayatomr.mll (or Mayatomr.bundle for Mac users) are checked so that mental ray for Maya loads by default.

Figure 11-31: Use the Plug-in Manager to load mental ray for Maya.

c11f031.tif

To render with mental ray, open the Render Settings window, and change the Render Using drop-down menu selection to mental ray, as shown in Figure 11-32 (shown with the Features tab selected). The Render Settings window now has the Common tab along with five other mental ray–specific tabs: Passes, Features, Quality, Indirect Lighting, and Options.

Figure 11-32: The Render Settings window for mental ray, showing the Features tab

c11f032.tif

mental ray Quality Settings

As with the Maya Software renderer, the primary quality settings for the mental ray renderer center on anti-aliasing. However, mental ray for Maya offers you finer control over how you set the quality levels through the Render Settings window. Under the Anti-Aliasing Quality ⇒ Raytrace/Scanline Quality heading on the Quality tab, you’ll find these attributes:

Sampling Mode (Under the Renderer Heading) This drop-down menu sets the type of sampling mental ray performs in the render. Sampling is the number of times mental ray reads and compares the color values of adjacent pixels in order to smooth the resulting render to avoid jagged lines. The choices are Unified Sampling (default), Legacy Rasterizer Mode, and Legacy Sampling Mode. Unified Sampling is generally the best choice because it sets the best range based on the Min and Max Samples you set along with a single Quality value. With the Min and Max Samples set to 1 and 100, respectively, the Quality value is key. A Quality setting at about 1.0 is considered good for production-quality renders, though you may need slightly higher than 1.0 in some cases. Quality of about 0.3 is a good fast render for previews. Experimenting with Min and Max Sample values will make more minor adjustments to the look of your render than would making changes to Quality.

For those who are already familiar with previous mental ray workflows, Legacy Sampling Mode will give you access to additional sampling modes available in previous versions of mental ray for Maya. Legacy Sampling is discussed in the “Legacy Sampling” sidebar. However, Unified Sampling mode attempts to greatly simplify the quality settings for mental ray for Maya and is preferred for use.

The Error Cutoff value (default at 0) and check boxes for Contrast as Color (default at off) are used for more advanced tweaking of quality settings and by and large should be left at their defaults.

Sample Options Heading Filtering is done on the results of the sampling of pixels to blend the pixels of a region together to form a coherent image. A high filter size tends to blur the image, whereas low filter values may look overly crisp. Box is the default filter and is the fastest to render, whereas Gaussian (Gauss) gives a slightly softer result with the slowest render times. Usually, render times don’t vary much between different filter modes—it’s not as if Gaussian takes four times longer to render the same frame over the Box filter type. But each gives a slightly different type of softness depending on its Filter Size setting.

Legacy Sampling
When the Sampling Mode option is set to Legacy Sampling, you will have access to more controls over the quality of mental ray renders, which may be helpful if you are familiar with previous versions of mental ray. Under Legacy Sampling, you will see another Sampling Mode drop-down menu: Fixed Sampling, Adaptive Sampling (default), and Custom Sampling. Adaptive Sampling is generally the best choice because it sets the best range based on the Max Sample Level option you set. If you choose Custom, you can set your own sampling range with the Min and Max Sample Level options.
Number of Samples These Min and Max Sample Level values set the number of times mental ray samples a pixel to determine how best to anti-alias the result. The higher the number, the finer the detail and the smoother the appearance of your rendered lines will be. These settings are exponential, so a small increase yields a much greater quality and much longer render time. You won’t need to set Max Sample Level above 2 for most uses. Both Max and Min Samples Level can be set into the negative numbers for fast renders, although you’ll notice jagged edges. A good setting for most renders is 2 for Max Sample Level with the Adaptive Sampling mode.
What determines the exact sample level within the min and max range set by these attributes is dependent on the Anti-aliasing Contrast Threshold value.
Anti-aliasing Contrast The values here determine when mental ray turns up the number of samples in a particular region of the frame. If the contrast level from one pixel to its neighbor is below the threshold value, mental ray turns up the number of samples for that pixel to render a higher-quality result. Therefore, the lower the values set here, the higher the sample rate will be (within the Min and Max levels set).

Sample Lock is turned on to reduce noise and artifacts in rendered sequences that have lots of movement.

Rather than setting high sample rates with just the Min and Max Sample Level attributes, carefully increase the Quality value to force mental ray to use a sample rate closer to the Max Samples only where it needs to do so. You’ll see this in action in the next section.

When you’re ready to render your scene to disk, you still use batch rendering; however, the options in the Batch Render Option window are different (Figure 11-33) than they are for Maya Software.

Figure 11-33: mental ray batch render options

c11f033.tif

Render Settings in Action!

In this section, you’ll look at how Quality values and how the number of Min and Max Samples work together to determine the quality of the render of a toy wagon. You can find the scene (RedWagonRenderSettings.ma) to render in the RedWagon project on the book’s web page. Make sure to set your project to RedWagon. This scene is set up to use Final Gather with an IBL using an HDR image. I’ll cover these methods later in this chapter.

Open the Render Settings window, making sure you are set to mental ray, and open the Quality tab. Set your Sampling Mode value to Unified Sampling. Occasionally you may see that Sampling Mode reverts to Legacy Sampling Mode when you open a file even though it was set to Unified Sampling. If that is the case, any settings you’ve created for Unified Sampling Mode do remain intact. Unified Sampling is mental ray’s newest method to speed up rendering, replacing what is now called Legacy Sampling Mode. Quality should be set to 0.50, Min Samples to 1.0, and Max Samples to 1.0 in this file already.

These render quality settings are low at first and will yield the render shown in Figure 11-34, which took just less than two minutes. You can see jagged highlights on the wagon, especially the white lines on the side body, the reflections in the front black nose, and the edge of the white rims on the back wheel.

Figure 11-34: A toy wagon rendered with low sampling values. Notice the jagged highlights on the white decal lines and the back wheel.

c11f034.tif

If you increase Max Samples Level to 100 and Min Samples Level to 1.0, you’ll see an immediate increase in quality (especially in the reflections of the wagon and the white decal lines) and a noticeable increase in render time (about 50 percent as long), as shown in Figure 11-35, which took just under three minutes to render.

Figure 11-35: Better sampling improves the wagon’s appearance.

c11f035.tif

You can get an even cleaner render. If you crank up the Quality value to the heavens, such as 2.0, you get a far cleaner render than before but with a much longer render time. Figure 11-36 shows the same frame with the Quality value set to 2.0 instead of the default of 0.5. The Min Sample Level option is still set to 1, and the Max Sample Level option is left at 100. The wood panels and the reflections of the wagon in the checkered floor are both noticeably nicer in this render. Your results as you render the scene on your own computer will be more noticeable than the images shown here. But this render took 4:35.

Figure 11-36: The wagon has still better sampling with a higher Quality value. You’ll see it better in your own renders.

c11f036.tif

For very quick render to check composition and lighting, set your Quality, Min, and Max Samples all to 0.1. You should get a super-fast render, though good luck discerning much detail. It’s easy enough to crank the numbers to the sky, but render times will very quickly become unacceptable, especially when you have a supervisor or client breathing down your neck. Find just the right combination of numbers for acceptable results in a minimum of time. Each scene will be different.

Motion Blur with mental ray

Now that you have a primer on quality settings in mental ray for Maya, you’ll learn how motion blur works.

1. Load the Planets_motionBlur.ma scene file from the Solar_System project on the web page. This is an animated scene of the solar system with just the first few planets and moons, as shown in Figure 11-37. A blast from the past!

Figure 11-37: The Solar_System project is back!

c11f037.tif
2. Open the Render Settings window. The scene should already be set to render with mental ray. If your scene isn’t, make sure the mental ray for Maya plug-in is loaded, and set the scene to render with mental ray.
3. On the Common tab, set Frame/Animation Ext to name.#.ext, Frame Padding to 3, Start Frame to 1, and End Frame to 100.
4. Set the Image Size to 640×480 for now, and leave the renderable camera to persp.
5. Go to frame 75, and render a frame from the persp view panel. Figure 11-38 shows the result.

Figure 11-38: A render of frame 75 shows the planets in motion without any motion blur.

c11f038.tif
6. In Render Settings, click to open the Features tab. In the Rendering Features heading, select No Deformation in the Motion Blur drop-down menu, as shown in Figure 11-39. This setting is the faster of two motion blur methods and works for objects that move in the scene without deformation. Deformations occur when the mesh or surface of an object changes, such as when you use a lattice or a skeleton rig like IK to drive a character. For deforming objects, you need to use Full as the Motion Blur setting.

Figure 11-39: Turn on motion blur.

c11f039.tif
7. Click to open the Quality tab in Render Settings. Set Sampling Mode to Unified Sampling, and set Quality to 0.5 and Min Samples and Max Samples each to 1.0. In the Motion Blur ⇒ Motion Blur Optimization heading, set the Motion Blur By attribute from 1.0 to 3.0 for quite a bit of blur. Render a frame at frame 75. (See Figure 11-40.)

Figure 11-40: Render a frame with motion blur turned on.

c11f040.tif
8. The render is very fast and shows quite a bit of blur; however, the quality is low. You see a lot of graininess in your render, especially with the yellow and red planets at the bottom of the screen. On the Quality tab of the Render Settings window, leave Sampling Mode at Unified Sampling, but change Max Samples to 50. This render should be fast but cleaner, with a smoother but still-grainy motion blur for the planets. Notice, however, that the render time increases by about 50 percent! Now try Max Samples at 100 and Quality at 2.0 (Figure 11-41 shows this much cleaner render). You control the amount of motion blur in your scene with the Motion Blur By attribute (step 7) for your scene.

Figure 11-41: Motion blur looks much better with higher sampling levels.

c11f041.tif

Render Layers

Most of the time, it’s better to composite different elements together to form a final CG image. Professional CG workflow almost always requires multiple render passes that are composited together later for the maximum in efficiency and quality.

Maya does a great job of making rendering in layers much easier with render layers. As you saw earlier in this book, using display layers helps a lot in keeping your scene organized. Render layers operate in basically the same way, although they function by separating different elements of the scene into separate renders.

I’ll address the most basic and commonly utilized render layer functionality here: separating objects into different renders. You’ll select elements in a scene and assign them to different render layers. When you batch-render the scene, Maya will render each of the layers separately and save the files into their own subfolders in the Images folder of your current project. You’ll then need to load all the different rendered layers into a compositing program, such as The Foundry’s NUKE or Adobe After Effects, and composite the layers together.

Render Passes in mental ray

Two powerful features in mental ray rendering, Render Passes and Pass Contribution Maps, make rendering in passes and elements much more efficient. Passes allow you to separate shadows, reflections, diffuse color, and so on, from the render to give the most control in compositing over the image. This mental ray–specific workflow is fairly advanced and requires an existing knowledge of rendering and compositing render passes (such as you will do with render layers) to fully grasp. Thus, I won’t cover these features in this book; however, you should be aware of this mental ray rendering pipeline as you move beyond this introduction and continue rendering with mental ray in your own work.

Rendering the Still Life in Layers

In this example, you’ll separate a scene into different layers for rendering with mental ray, though the render layer workflow here applies to Maya Software rendering as well.

To separate a scene into different layers, follow these steps:

1. Set your project to the Lighting project downloaded from the book’s web page, and open the still life scene (still_life_renderLayers_v01.mb from the Scenes folder to start there). The lights and a camera are already set up in this scene. Set your camera view to camera1. Open Render Settings, and make sure mental ray is the current renderer. Set Sampling Mode to Unified Sampling, set Quality to 2.0, and set Min/Max Samples to 1.0 and 100, respectively.
2. To separate the scene into different renders, in the Layer Editor, click the Render tab to switch to the render-layers view. Select the foreground lemon, and click the Create New Layer And Assign Selected Objects icon (c11g003.tif). Doing so creates a new render layer called layer1 and assigns the lemon to it. (See Figure 11-42.)

Figure 11-42: The newly created render layer with the foreground lemon assigned

c11f042.tif
3. Click layer1, and everything but the lemon disappears from the scene (see Figure 11-42). Double-click layer1 in the Layer Editor, and rename it lemonPass, as shown in Figure 11-43.

Figure 11-43: Rename the render layer to lemonPass.

c11f043.tif
4. If you test-render a frame, the frame should turn black. You need to assign your lights to the render layer as well. Select all the lights in the scene using the Outliner, as shown in Figure 11-44. Right-click the lemonPass layer in the Layer Editor, and select Add Selected Objects from the context menu. If you render a test frame now, the lemon renders as shown in Figure 11-45.

Figure 11-44: Add the lights to the lemonPass render layer.

c11f044.tif

Figure 11-45: The lemon rendered on its very own layer

c11f045.tif
5. Create a render layer for the column and floor. Click the masterLayer render layer, and then select the column, the floor, and all the lights in the scene. As you did with the lemon, click the Create New Layer And Assign Selected Objects icon (c11g003.tif), and then click the new layer to select and display it. Double-click the layer name to rename the render layer columnPass (see Figure 11-46).

Figure 11-46: The background is assigned to its own render layer.

c11f046.tif
6. Click back to the masterLayer; then select all the rest of the pieces of fruit, as shown in Figure 11-47, and create their render layer called fruitPass. You should now have three render layers and the default masterLayer. The masterLayer is always present to house all the elements of the scene. It switches to being not renderable as soon as you create a new render layer, as evidenced by the little red X in its Renderable icon (c11g004.tif).

Figure 11-47: The newly created fruitPass render layer

c11f047.tif
7. The first icon on each of the render layer entries in the Layer Editor toggles whether that layer will render or not. Make sure all your render layers are renderable, and leave the masterLayer off. Because all the elements of the scene are assigned to one render layer or another, the whole scene is covered. The masterLayer nonetheless is always present, because it represents all the objects in the scene, assigned to layers or not.
8. With the fruitPass render layer selected, test-render a frame, as shown in Figure 11-48. You should see just the fruit and not the background, column, or foreground lemon. Notice the reflections in the fruit.

Figure 11-48: Rendering the rest of the fruit

c11f048.tif

Test-Rendering Everything Together

By default, Maya renders only the selected visible render layer. You can, however, tell Maya to test-render and show you all the layers composited together to give you a preview of what you’ll end up with when you composite all the layers together after batch-rendering the scene.

To test-render all the layers together, click the Options menu in the Layer Editor, as shown in Figure 11-49, and toggle on Render All Layers by clicking the check box if it isn’t already selected.

Figure 11-49: Turn on Render All Layers.

c11f049.tif

Now if you test-render a frame, Maya will render each layer separately and then composite them together. Test-render a frame with Render All Layers enabled, and you should notice that the foreground lemon is missing, as in Figure 11-50.

Figure 11-50: Rendering all the layers together

c11f050.tif

This is because the render layers in the Layer Editor need to be reordered so that columnPass is on the bottom, fruitPass is in the middle, and lemonPass is on top. This is the layer ordering for the composite. You can reorder the render layers by MMB+clicking a layer and dragging it up or down to its new location in the Layer Editor, as in Figure 11-51.

Figure 11-51: Reorder the render layers.

c11f051.tif

Now if you render the frame with Render All Layers enabled, you see the scene properly placed, as shown in Figure 11-52. Notice that shadows and reflections on the column’s tabletop are missing, however. For that, you will need to create render layer overrides to allow reflections and shadows of an object to render, but without the object itself rendering.

Figure 11-52: Now the lemon appears in the render.

c11f052.tif

Render Layer Overrides

Where are the shadows and reflections? If you recall from earlier in this chapter, this scene renders with shadows, and this scene should have reflections as well. However, the reflections and shadow-casting objects are on different layers than the column. Shadows and reflections can’t be cast from one layer onto another. In the following steps, you’ll use render layer overrides to set up your columnPass layer to have shadows and reflections from the fruit but not render the fruit on top of the column:


Render layers and overrides are very powerful workflow tools in Maya. Because there can be an obscene number of overrides in any given render layer, it’s important to follow through this workflow carefully. Practice it to gain a comfort level before getting too fancy with render layers and overrides. Also, it helps to keep notes beside your keyboard to help you stay organized with render layers and overrides. And lastly, there are occasional problems when assigning shaders to the faces of a mesh (as opposed to the entire mesh) when using render layers. Try to always assign shaders to the entire mesh and not to faces in those cases.

1. Click to the columnPass render layer. In the Outliner, select all the fruit objects and add them to the layer (Figure 11-53).

Figure 11-53: Add the fruit back into the layer.

c11f053.tif
2. If you render the layer now, it will render the fruit. To turn them off without removing them from the layer (and hence lose shadows and reflections), you’ll set render layer overrides for each of the fruit objects. Select the orange, and open the Attribute Editor.
3. On the orangeShape tab in the Attribute Editor, click to open the Render Stats heading. Here you see switches allowing for different ways to render the object. You want the orange to cast reflections and shadows in the scene, without rendering itself, so uncheck the Primary Visibility box. It will turn orange to signify that there is now a render layer override on that attribute for the current render layer (columnPass) only (Figure 11-54).

Figure 11-54: Turn off Primary Visibility to set a render layer override for the orange on the columnPass layer.

c11f054.tif
As a matter of fact, if you click the other render layers with the orange still selected, you will notice that the Primary Visibility setting for the orange turns back on and loses its orange color in the Attribute Editor on the other render layers. Render layer overrides work only on the layers in which they were created.
4. Now select each fruit model down the list in the Outliner individually, and turn off Primary Visibility one by one. You cannot select all the objects at once and turn off Primary Visibility in the Attribute Editor; it will register the action only for the last selected object and not them all.

To change attribute values on multiple objects at once, such as Primary Visibility, you can use Window ⇒ General Editors ⇒ Attribute Spread Sheet. Be careful, though!

5. Turn off Render All Layers (in the Layer Editor, uncheck Options ⇒ Render All Layers). Render the columnPass layer, and you’ll see the top of the column is rendering with shadows and reflections but not the fruit! (See Figure 11-55.)

Figure 11-55: The column is rendering with shadows and reflections.

c11f055.tif
6. Finally, you make the shadows look nicer by using raytrace shadows. Select spotLight1, and in the Attribute Editor, under the Shadows ⇒ Depth Map Shadow Attributes heading, turn off Use Depth Map Shadows. Scroll down a bit until you see the Raytrace Shadow Attributes heading; open it, and turn on Use Ray Trace Shadows.
7. Repeat step 6 for spotLight3 and spotLight4. Render, and you’ll see sharp shadows now on the column (Figure 11-56).

Figure 11-56: The shadows are crisp and clean but too sharp.

c11f056.tif
8. Let’s enable soft shadows now for those three spotlights. Select spotLight1, and in the Raytrace Shadow Attributes, set Light Radius to 0.4 and Shadow Rays to 16. Repeat the procedure for spotLight3 and spotLight4. The shadows will look much more believable now.
9. Turn on Render All Layers, and render a frame to see the entire composition (Figure 11-57). Once you verify everything is working and looking good, you can now render your scene into separate layers for better control in compositing.

Figure 11-57: The layers all rendered together with soft shadows and reflections

c11f057.tif

You can check your work against the file still_life_renderLayers_v02.mb from the Scenes folder of the Lighting project on the book’s web page.

Batch Rendering with Render Layers

Now that you have everything separated into render layers, let’s talk about batch-rendering the scene to composite later. Make the render layers you want to render renderable by making sure the Renderable icon next to each render layer is enabled, as shown in Figure 11-58.

Figure 11-58: Check to make sure the layers you want to render are enabled.

c11f058.tif

In the Render Settings window, make sure Renderable Camera is set to camera1, as shown in Figure 11-59. Select your image file type and anything else you need to set in the Render Settings window. Then, in the main Maya window, choose Render ⇒ Batch Render to render the scene. Because render layers are enabled here, Maya renders the scene into different subfolders under the Images folder of your current project. Each render layer gets its own folder in the Images folder, as shown in Figure 11-60.

Figure 11-59: Select camera1 as your renderable camera in the Render Settings window.

c11f059.tif

Figure 11-60: Render layers batch-render into subfolders in the Images folder of your project.

c11f060.tif

I have only begun to scratch the surface here. When you get the hang of rendering and as your CG needs begin to grow, you’ll find a plethora of options when rendering with layers and rendering with passes through mental ray. This section and the “Ambient Occlusion” section later in this chapter are here only to familiarize you with the basic workflow of render layers. You can find a wealth of information about rendering in layers and passes in the Maya online documentation under the Help menu.

Final Gather

Final Gather (FG) is a type of rendering with mental ray that includes a simple light bounce within the scene. Final Gather traces light as it reflects off surfaces to illuminate the scene for a nicely realistic render that takes into account color bleed of light from one surface to another. For example, a red wall casts a red hue on the surface right next to it. FG is an intricate dance of settings and numbers that lets you get perfect renders. It’s tough to cover in an introductory book such as this; however, this section will give you a primer to start using FG. In a follow-up section, you’ll use a combination of lights and HDRI with Final Gather to render the decorative box.

The basic premise is that FG uses the illumination in the scene from lights as well as objects with color and incandescence set in their shaders to create a soft natural light. Its base settings will give you nice results right from the start.

To render the still life fruit scene with FG, begin by creating a dome light, which evenly illuminates a scene from a dome around the scene. (The term dome light is a bit of a misnomer, because a dome light isn’t itself a light.) You’ll construct a simple NURBS sphere, cut it in half to create a dome, and give it an Incandescent shader to provide the light for the scene. This type of quick FG setup is extremely useful for rendering out soft lighting and shadows to show off a model or a composition.

To light and render with FG, follow these steps:

1. Ensure that mental ray for Maya is loaded.
2. Load the still life scene file still_life_mentalray_v01.mb from the Lighting project from the book’s web page. In the persp view panel (not the camera1 panel), create a polygonal sphere, and scale it up to enclose the entire scene. Select the bottom half faces of the sphere, delete them to cut the sphere in half, and name the object lightDome. Place the dome to fit over the scene, as shown in Figure 11-61.

Figure 11-61: Create a sphere to act as a light dome.

c11f061.tif
3. Add an Incandescent shader to the dome to give the scene some illumination through FG. To do so, in the Hypershade create a new Lambert shader. Turn up its incandescence to a medium light gray. Assign the new shader to the dome.
4. Maya automatically creates a general default light in a scene that has no lights when you try to render it. This is so you can test-render your scene quickly. However, because this incandescent dome light should be the only light source in the FG render, you have to turn off the default light feature before you render. Open the Render Settings window, and under the Common tab’s Render Options heading (at the bottom of the Attribute Editor), turn off the Enable Default Light check box.

Don’t forget to turn Enable Default Light back on when you’re finished with this FG exercise.

5. At the top of the Render Settings window, switch the Render Using attribute to mental ray. You can keep the settings on the Common tab to render at 640×480. Choose the Quality tab to access its settings. Set Sampling Mode to Unified Sampling, and leave Min and Max Samples to 1.0 and 100, respectively, but set a Quality of 0.3. Check to make sure that raytracing is enabled under the Raytracing heading. Figure 11-62 shows the Quality tab of the Render Settings window.

Figure 11-62: The Quality tab

c11f062.tif
6. Click to open the Indirect Lighting tab, and click the Final Gathering heading to expand its attributes. Turn on Final Gathering by checking the box. You can leave the settings at their defaults for your first render. Figure 11-63 shows the Indirect Lighting tab for the Render Settings window with Final Gathering turned on.

Figure 11-63: The Indirect Lighting tab accesses all the Final Gather settings.

c11f063.tif
7. You need to make sure the sphere you’re using as a dome light doesn’t render out in the scene. Select the sphere, and in its Attribute Editor under the Render Stats heading, turn off Primary Visibility. Since there are no render layers in the scene, it doesn’t turn orange like with the previous section’s exercise. Highlight the camera1 panel, and render the frame. Maya makes two passes at the scene and shows you something like Figure 11-64. You can control the brightness of the scene with the Incandescence attribute value of the dome’s shader—the whiter the incandescence, the brighter the scene.

Figure 11-64: The Final Gather render of the still life

c11f064.tif

You can adjust the level of lighting by increasing or decreasing the amount of incandescence on the light dome’s shader. The proximity of the sphere also affects the light amount, so moving the sphere closer or farther away will change the lighting level as well. You can also insert lights into the scene as you see fit.

You can improve the quality of the render by adjusting any of the following three settings in the Indirect Lighting tab under the Final Gathering section of the Render Settings window:

Accuracy Increase this number for a more accurate render. Don’t increase it too much, however, because it will slow down your render. Earlier the still life was rendered with the default Accuracy setting of 100. In Figure 11-65, which uses a setting of 500, the soft shadows are noticeably smoother. Accuracy dictates the number of FG rays that are cast into the scene. The more rays, the better the quality of the render, although at a cost of rendering time.

Figure 11-65: Accuracy set at 500 increases the smoothness of the soft shadows. It’s hard to see here, but you’ll notice it in your own render.

c11f065.tif
Primary Diffuse Scale Use this setting to adjust the overall lighting level globally in the scene. The higher the value of this color, the brighter the scene. You can type values greater than 1 in the Color Chooser.
Secondary Diffuse Bounces Setting this attribute to 1 will add an additional bounce of light inside your scene, essentially brightening everything. Shadowed areas will pick up the biggest boost, and the scene lighting will be a bit more soft overall.

The Point Density and Point Interpolation attributes, along with several other attributes under the Final Gathering section, optimize and further control the FG settings for optimum efficiency and results, especially with animated scenes. Consider using the basic settings shown in this chapter to become familiar with mental ray for Maya, and then use FG to crank out fast and elegant renders to show off your models until you get more comfortable with mental ray.

Final Gather is a tough nut to crack; it will take you some time to become proficient at rendering with FG in scene files and especially with animated scenes. Later in this chapter, you’ll try your hand at using FG, HDRI, and regular lights to render the decorative box from the previous chapters.

Ambient Occlusion

Ambient Occlusion is a special render pass that helps add depth and reality to a render. Ambient Occlusion goes by the premise that when two objects or surfaces are close to each other, they reduce the amount of light at the intersection. Ambient Occlusion passes make for great contact shadows and bring out the definition in surface creases and corners very nicely. Figure 11-66 shows an Ambient Occlusion pass for the living room scene from the PDF Global Illumination exercise included on the book’s web page.

Figure 11-66: The Ambient Occlusion pass is black and white and is used to darken areas of the original color render.

c11f066.tif

How the composite works is very simple. Ambient Occlusion gives you a black-and-white pass of the same geometry you’ve already rendered. This pass is then multiplied over the color render. That means a brightness value of white (a value of 1) in the Ambient Occlusion pass won’t change the color of the original render (when the original color of the render is multiplied by 1, it stays the same color). The black parts of the frame (with a brightness value of 0) turn those parts of the original render black (when the original color of the render is multiplied by 0, it goes to black). The gray points of the multiplying image darken the original render. It sounds confusing, but when you see it, it makes much better sense.

The Living Room

You’ll now take the living-room render made in the PDF file exercise on the web page and add an Ambient Occlusion pass using render layers. You don’t have to read the PDF exercise to understand the concepts and practices for making an Ambient Occlusion pass here. However, if you’d like to understand how to light the living-room scene with Global Illumination, you may want to read that exercise on the web page now and then return to the following.

Set your current project to the Livingroom project you copied from the web page, open the livingRoom_v2.mb file from the Scenes folder, and follow these steps:

1. Make sure mental ray is loaded, of course, and that Render Settings is set to render with mental ray. As you did earlier, you need to create a new render layer for the Ambient Occlusion. This layer requires all the objects in the scene but the lights to be assigned to it. In this scene, the only light is a single Directional light. In the Outliner, select all the top nodes of the scene, but leave out the light, as shown in Figure 11-67.

Figure 11-67: Select the scene objects for your Ambient Occlusion pass.

c11f067.tif
2. Click the Render tab in the Layer Editor to switch to Render, and then click the Create New Layer And Assign Selected Objects icon (c11g003.tif). Doing so creates a new layer (layer1) along with the preexisting masterLayer, as shown in Figure 11-68.

Figure 11-68: Create a new render layer.

c11f068.tif
3. Click the new layer (layer1) to activate it. Everything in the scene should display as it did before, although the light disappears from view. Double-click layer1, and rename it ambientOcclusion.
4. You’re going to use a preset to create a material override. This takes all the objects in the scene and assigns a single material to them: in this case, an Ambient Occlusion shader that generates the Ambient Occlusion pass for the entire scene. Right-click the ambientOcclusion layer, and select Attributes. In the Attribute Editor, click and hold down the Presets button. From the menu that appears, select Occlusion, as shown in Figure 11-69.

Figure 11-69: Setting an Occlusion preset for the layer

c11f069.tif
If you’re in Shaded mode, everything should turn black in the view panels. This is normal, because everything now has the Ambient Occlusion Surface Shader assigned, and that shader displays black in Maya panels. If you click the masterLayer, everything pops back into place.
5. When you select Occlusion from the Presets menu, your Attribute Editor window should display a new shader called surfaceShader1. Figure 11-70 shows the new Ambient Occlusion shader that is assigned throughout the scene. Rename that shader to ambOccShader. Don’t worry if you don’t see the surfaceShader1 in your Attribute Editor; you’ll come back to it in later steps.

Figure 11-70: The Ambient Occlusion shader in the Hypershade

c11f070.tif
6. While still in the ambientOcclusion layer, render a frame. You should see something like Figure 11-71. You needn’t worry about most of the settings in the Render Settings window; the layer preset takes care of it all. Well, almost all. It doesn’t turn off the Global Illumination pass that you used for the original color render in the PDF exercise (which you can find on the web page); you need to turn that off manually in the next step.

Figure 11-71: The first render from the Ambient Occlusion pass doesn’t look great—it’s too dark.

c11f071.tif
7. In the Render Settings window, on the Indirect Lighting tab, you need to turn off Global Illumination, but just for the ambientOcclusion layer. With ambientOcclusion still selected in the Layer Editor, right-click the Global Illumination check box in Render Settings and choose Create Layer Override. The attribute lettering turns orange to signify that it’s being overridden for that render layer, just like you saw before. Uncheck the box. It doesn’t turn off GI for the masterLayer pass. You don’t have to spend the time calculating any GI for this pass.
8. The render is mostly black, which darkens the original color render to black almost everywhere. You need the Ambient Occlusion shader to render mostly white with some darkening at the corners and where objects contact each other. You can adjust the Ambient Occlusion shader to fix this. Open the Hypershade window, and click ambOccShader (or surfaceShader1, if you didn’t rename it earlier in step 5—rename it now).
9. Notice that the Out Color attribute has a texture connection to it (signified by the c11g006.tif icon). Click this button to display the mib_amb_occlusion1 texture node in the Attribute Editor, as shown in Figure 11-72.

Figure 11-72: The Ambient Occlusion shader attributes

c11f072.tif
10. Set the Max Distance attribute to 4.0, as shown in Figure 11-73, and render the frame again. Your Ambient Occlusion layer should look like Figure 11-74. It should have also taken less than half as long to render as the darker render from step 6.

Figure 11-73: Set Max Distance to 4.

c11f073.tif

Figure 11-74: The Ambient Occlusion layer pass looks much better, but you aren’t finished yet!

c11f074.tif
11. Notice that the glass in the window and the glass on the coffee table have shadows on them. Because glass is clear, they shouldn’t have any Ambient Occlusion applied to them; it would look odd in the final composite. Select those pieces of geometry (Figure 11-75 shows the Outliner view for those pieces).

Figure 11-75: The Outliner view of the glass geometry in the scene

c11f075.tif
12. With the glass geometry selected, select Display ⇒ Hide ⇒ Hide Selection. Now the glass won’t render in the Ambient Occlusion pass. But because you hid the objects only in this render layer, they still appear in the masterLayer; they will still render as glass in the color pass.
13. Render the frame, and you should have something similar to Figure 11-76. This is the Ambient Occlusion pass you need to composite.

Figure 11-76: The Ambient Occlusion pass

c11f076.tif

Remember to check out the PDF exercise on the web page if you’d like to learn how this scene was lit with Global Illumination.

Rendering the Results

You could save the image you just rendered in the Render View window to use in the composite and then render the masterLayer for the color pass in the Render View and save that frame as well. Instead, let’s batch-render the scene to show how Maya handles rendering with layers enabled. To batch-render the scene, follow these steps:

1. Turn on the Renderable icon box (c11g007.tif) for the masterLayer, and make sure it’s on for the ambientOcclusion layer as well.
2. Click to activate the masterLayer. Open the Render Settings window, and on the Common tab, verify all the settings to render a single frame (name.ext.# in the Frame/Animation Ext field) at 639×360 (which is half 720p HD resolution). Also, select camera1 as the renderable camera.
3. If you batch-render (by choosing Render ⇒ Batch Render), Maya renders both render layers into the Images folder of your project in separate folders, as shown in Figure 11-77.

Figure 11-77: Maya renders the layers into their own folders by default.

c11f077.tif

If for some reason your renders don’t show up in your project’s Images folder, open the Script Editor window and look at the batch-render report. The render feedback shows you where the rendered images were saved, as shown in Figure 11-78. You may also want to make sure you set your project to the Livingroom project from the web page.

Figure 11-78: The Script Editor gives you feedback on the progress of the batch render.

c11f078.tif

Compositing the Results

Now that the two layers are rendered in their respective folders, load them into your favorite compositing package. You’ll layer the Ambient Occlusion pass over the color render using a Multiply Transfer mode. This exercise uses Adobe After Effects CS4 to demonstrate how the Ambient Occlusion pass is composited over the original color render.

Figure 11-79 shows After Effects with the masterLayer color pass loaded. Figure 11-80 shows the ambientOcclusion pass layered on top of the color layer. Finally, Figure 11-81 shows the ambientOcclusion pass changed to a Multiply Transfer mode (as it’s called in After Effects). Notice how the dark areas of the Ambient Occlusion pass help give contact shadows and depth to the color pass. Voilà!

Figure 11-79: The masterLayer render pass is loaded into After Effects.

c11f079.tif

Figure 11-80: The ambientOcclusion render pass is loaded into After Effects.

c11f080.tif

Figure 11-81: The ambientOcclusion pass is multiplied over the color pass and creates a more realistic image.

c11f081.tif

This is a prime example of rendering different passes to achieve a more realistic result. Use different layers to put your final images together in composite.

You can see the difference Ambient Occlusion made to the living-room image in the Color Section of this book and on the web page.

HDRI

As you saw in the Final Gather section, FG rendering is based on the illumination in the scene from lights as well as the brightness of objects in the scene, such as a light dome. In a previous section, you used an incandescent dome to light the still-life scene. But what if you were to use an image instead of just white for the light dome?

Furthermore, what if the image you used was a high dynamic range image (HDRI)? In Chapter 1, I briefly discussed HDR images. Several photos at varying exposures are taken of the same subject, ranging from very dark (low exposure), to highlight only the brightest parts of the scene, and going all the way up to very bright (overexposure), to capture the absolute darkest parts of the scene. When these images (usually five or seven images) are compiled into an HDR image, you get a fantastic range of bright to dark for that one subject.

How does this help you light? With image-based lighting (IBL), mental ray creates an environment sphere in your scene to which you assign an image, usually an HDRI. That environment sphere, much like the white dome in the Final Gather exercise earlier in the chapter, uses the brightness of its image to cast light in your Maya scene.

The best type of image to capture for an IBL is sometimes called a light probe. This is a picture of an environment, such as the office reflected in a chrome ball shown on the left of Figure 11-82 or the stitched-together panoramic stills compiled into a map shown on the right of Figure 11-82. The stitched panoramic on the right of Figure 11-82 was photographed at four 90-degree angles using a fish-eye camera lens capable of capturing a field of view of close to 180 degrees using a panoramic tripod attachment.

Figure 11-82: A light-probe photo of a desk is taken with a chrome ball (left) and a panoramic stitch (right).

c11f082.tif

Figure 11-82 shows the middle exposure of five exposures taken of the office and one of the four angles of the living room. Figure 11-83 shows five images in the range from underexposed (dark) to overexposed (bright) photos that were used to compile the HDRIs shown here. You will use an HDRI made from the living-room panoramic photos to light the decorative box in the next section.

Figure 11-83: Five exposures make up the HDRI of a desk using a chrome ball (left); and a living room using a panoramic stitch (right), which is to be used in the next section

c11f083.tif

The living-room photos are taken at 90-degree intervals inside the living room and then stitched and compiled in an HDRI file using a photographic software package (shown in Figure 11-84). The HDRI file is called livingRoomPanoramic.hdr and is in the Sourceimages folder of the TableLamp project on the web page for the next section’s IBL lighting exercise. You won’t be able to see the extensive range of the HDR, because the great majority of computer displays are limited to a display of 8-bit color.

Figure 11-84: Fish-eye photos are taken at four angles of the living room, each with several exposures from light to dark (above). The fish-eye photos are then warped and stitched together using the very handy software package PTGui and merged into an HDR image file (bottom).

c11f084.tif

The HDR will be mapped onto an IBL sphere. This is a large sphere that surrounds the environment in your Maya scene. The individual photos first need to be stitched together and converted to a rectangular image file, as shown in Figure 11-84. The full spherical panorama space captured in these photos and stitched together is laid out into a rectangular format that is suitable to project onto a sphere in Maya, just as if a geographic map on a school room globe was unwrapped into a rectangular sheet of paper.

Software such as HDRShop, available online for free, allows you to combine multiple images into an HDR. One useful program, PTGui from the Netherlands (available for a demo online at http://ptgui.com), allows you to stitch panoramas as well as merge HDR images, which makes it a fantastic tool for CG lighters and photographers. As long as the photos to be stitched were taken with enough overlap at the edges, PTGui is able to turn them into a large panoramic photo. And if the proper exposure ranges were also taken, PTGui creates a solid HDR as well. I won’t get into the details of creating the HDRI, because it’s an advanced topic using Photoshop CS5, PTGui, and/or other software; however, it’s good to know the origins of HDR images and how they come to be used in IBL.

Displacement Mapping the Decorative Box

Before continuing with the lighting and rendering for the lamp and decorative box, let’s first address a need for detailing just the box by itself. Look at the photo of the box in Chapter 3, “The Autodesk Maya 2014 Interface.” (Figure 3-24) and compare it to the close-up renders of the box in Chapter 10 (Figure 10-68); you’ll see that the carved details in the CG box need more detail. Let’s start by taking a closer look at the box by itself.

1. Make sure your project is set to the TableLamp project. Open the file lampLighting_v01.mb from the TableLamp project. An error may come up saying that the reference file cannot be found (if so, it will look like Figure 11-85). If that is the case, simply click Browse and navigate to where you have saved the Decorative_Box project’s Scenes folder, where you will find the scene file boxDetail01.mb. Otherwise, the scene should open with no issues.

Figure 11-85: Oh no! Reference file not found!

c11f085.tif
2. Select the top node of the table lamp (lampGroup), and create a new display layer called lampLayer. Turn off visibility for the lampLayer.
3. Use the persp camera (not the renderCam), and line up a view of the box to match the box render shown in Figure 11-86.

Figure 11-86: The lamp and decorative box’s current render when you finished the lighting in Chapter 10

c11f086.tif
4. Render a frame, and you should notice more closely the lack of definition in the box when compared to the real photo of the box (Figure 3-24 in Chapter 3).
5. Save your work!

In the current render, the grooves are flat and shiny, whereas in the real box, they’re carved into the wood and aren’t glossy like the rest of the box. You will add definition to the model through textures next.

You can use the scene file lampLighting_v02 to catch up to this point or compare your camera angles.

Reflection Map

Just as you use a map to put color on the box, you can use similar maps to specify where and how much the box will reflect. Figure 11-87 shows the color map you used to texture the box in Chapter 7 side-by-side with a black-and-white map that shows only the carved regions of the box. This map was created with elbow grease and hard work to manually isolate just the carved areas of the box in Photoshop. See how much I do for you?

Figure 11-87: The black-and-white map on the right shows only the carved areas of the box.

c11f087.tif

You’ll first take the reflections out of the carved areas in the following steps:

1. Set your project to the Decorative_Box project from the companion website.
2. Open the boxDetail02.mb scene. This scene has the box set up with a few lights, a render camera and render settings preset, and a ground plane for you to focus on detailing just the box. Render a frame and study the outcome. Save it to the image buffer in the Render View window.
3. Open the Hypershade. In the Create bar on the left, click 2D Textures under the Maya heading, and choose File to open a new image file node (called file2). See Figure 11-88.

Figure 11-88: Create a new file node.

c11f088.tif
4. Double-click the file node, and navigate to find and choose the boxCarvings.jpg file in the Sourceimages folder of the Decorative_Box project. See Figure 11-89.

Figure 11-89: Select the proper image file.

c11f089.tif
5. If the sample swatch at the top of the Attribute Editor for the file2 node doesn’t show the image you just selected, it is because the image is too large for Maya to create a thumbnail swatch automatically. If this is the case, the file node in the Hypershade would also be blank. Right-click the file node, and choose Refresh Swatch from the marking menu. Figure 11-90 shows the swatch with the black-and-white image as a thumbnail. This isn’t necessary, but it makes it easier for you to identify what file map is where.

Figure 11-90: The swatch shows a thumbnail of the image you’re using.

c11f090.tif
6. MMB+drag the phong1 node from the top of the Hypershade window down to the Work Area, alongside the file2 node.
7. Double-click the phong1 node to open the Attribute Editor. MMB+drag the file2 node onto the Reflectivity attribute for the Phong2 shader, as shown in Figure 11-91.

Figure 11-91: Map the new image file to the Reflectivity attribute.

c11f091.tif
8. Notice the connection line in the Hypershade between the file2 and phong1 nodes. The white areas of the map tell the phong1 shader to have a reflectivity of 1, whereas the black areas have zero reflectivity. This effectively removes reflections from the box’s carvings. Render a frame of the box in the renderCam view, and compare it to Figure 11-92.

Figure 11-92: The reflections are stronger; the entire box looks like a mirror.

c11f092.tif
9. In the Render View window, click the Keep Image icon (c11g008.tif) to store this render in the render buffer. Doing so allows you to easily compare renders to see the changes you make as you continue.
10. The box’s reflections are now stronger all over, and the carvings still reflect. You need to turn on one switch. Select the file2 node, and open the Color Balance heading in the Attribute Editor. Check the box for the Alpha Is Luminance attribute. This instructs Maya to use the luminance values (basically the brightness) of the image to output to the reflectivity attribute of the phong1 shader. The box renders properly, and the carvings have no reflections, as shown in Figure 11-93. Save this render into the render buffer with the Keep Image icon (c11g008.tif).

Figure 11-93: The carvings don’t reflect, but the rest of the box’s reflections are still too strong.

c11f093.tif
11. You need to reduce the reflections on the rest of the box. Double-click the file2 node to open the Attribute Editor. In the Color Balance heading, set Alpha Gain to 0.4, as shown in Figure 11-94. This sets the brightest part of the reflections to be capped at 0.4 and not the previous 1.0. Render, and you see a much better reflection in the box and no reflections in the carvings. (See Figure 11-95.) Save this to the render buffer.

Figure 11-94: Set Alpha Gain to 0.4.

c11f094.tif

Figure 11-95: The reflections look much better now.

c11f095.tif
12. Rename the file2 node to reflectionMap and the phong1 node to boxShader, and save your work to a new version.

You can open the scene file boxDetail03.ma from the Scenes folder in the Decorative_Box project to catch up to this point or to check your work so far.

Displacement Mapping

Now that the reflections are set up, you’ll use the same image map to create displacements in the box to sink the carvings into the box. Isn’t that convenient?

1. In the Hypershade, click to create a new file node, and select the boxCarvings.jpg file in the Sourceimages folder again. You don’t want to reuse the same file node as you did for the reflections (reflectionMap node), because you need to change some of its attributes. Name the new file node displacementMap.
2. Double-click the boxShader node to open the Attribute Editor. MMB+drag the new displacementMap node onto the boxShader node in the Hypershade, and select Displacement Map from the context menu, as shown in Figure 11-96.

Figure 11-96: Add the new image map to the Displacement Map attribute.

c11f096.tif
3. A new node appears called displacementShader1, but there is no connection apparent to the boxShader. Select the boxShader, and click the Input And Output Connections icon at the top of the Hypershade (c11g009.tif). The Hypershade shows you the entire shader network, including the displacement map connection, as shown in Figure 11-97. Notice that the displacement connects to the phong1SG node and not directly to the boxShader node. This is normal and how it’s always done.

Figure 11-97: The shader network for the box

c11f097.tif
4. Render the box, and see what happens now that you have a displacement map applied. Figure 11-98 shows how the box seems to have exploded!

Figure 11-98: The displacements seem to be wrong!

c11f098.tif

Occasionally when you click to view the input and output of a shader as you did in step 3, the Hypershade will put some nodes on top of others. If you don’t see any of the nodes, try clicking and dragging some of the nodes around in the Hypershade to see whether there are any accidentally hidden nodes. These little touches make Maya extra fun!

Not to worry—this is to be expected. The values coming from the black-and-white map dictate how much of the geometry is displaced (moved). Obviously, you don’t have an image that works well for the amount of displacement, although it does look like the displacements are in the proper place to correspond to where the carvings are on the box.
5. Double-click the displacementMap node. In the Attribute Editor, open the Effects heading, and click the Invert check box. This turns the background to black and the carvings to white. Set Alpha Gain to 0.03 in the Color Balance heading, and make sure Alpha Is Luminance is also checked. (See Figure 11-99.) The Alpha Gain value reduces the amount of displacement, and inverting the image lets the rest of the box outside of the carvings not be displaced.

Figure 11-99: Set the attributes for the displacement image.

c11f099.tif
6. Render a frame, and compare it to Figure 11-100. It’s not looking very good. The box isn’t exploding anymore, and only the carvings are displacing, which is good. However, the carvings are sticking out, instead of in.

Figure 11-100: The carvings are displacing outward.

c11f100.tif
7. Set the Alpha Gain attribute to –0.02 to push the carvings in a little instead of out. Render, and compare to Figure 11-101. The carvings are set into the wood as they should be, but the render looks bad. The displacements are very jagged and ill-defined.

Figure 11-101: The carvings are inset into the wood, but they don’t look good yet.

c11f101.tif
8. The jagged look of the carvings has to do with the tessellation of the box—that is, the detail of the box’s polygonal mesh. There are advanced ways to address how mental ray deals with displacements; however, the most basic method is to adjust the detail of the box’s mesh. Figure 11-102 shows the current box’s mesh. Notice that the sides of the box are very simply detailed. To increase the box’s faces to add detail, select the box, and then, in the Polygons menu set, choose Edit Mesh ⇒ Add Divisions optionbox.png. Set the options to Exponentially and Division Levels to 3, as shown in Figure 11-103. Click Add Divisions to execute.

Figure 11-102: The current box’s mesh isn’t detailed enough.

c11f102.tif

Figure 11-103: Set the Add Divisions values.

c11f103.tif
9. Figure 11-104 shows the newly tessellated box. It’s far more detailed in the mesh. When you render, it gives a result similar to Figure 11-105. You can compare your work to the scene file boxDetail04.ma in the Scenes folder of the Decorative_Box project.

Figure 11-104: Added divisions

c11f104.tif

Figure 11-105: The displacements render much better now.

c11f105.tif
10. Now that you have the detail you want in the box, you need to prepare the box’s scene file to be referenced back into your lamp lighting scene. Select the ground plane, the renderCam camera, and the three lights in the scene and delete them. Save your work to a new version.

Compare your work to the scene file boxDetail05.ma in the Scenes folder of the Decorative_Box project.

Notice that the render times increased because you increased the detail on the mesh in step 8. This increase is normal, but it can become a problem if the mesh is too divided and has more faces than you need. This box has fairly detailed carvings, so the level to which you set Add Divisions in step 8 gives a good result without being too detailed. As your experience increases in Maya and mental ray rendering, you’ll learn how to use functions such as the mental ray Approximation Editor to keep the overall detail low on the mesh but with smooth displacement results when you render. This is an advanced technique, so I won’t cover it in this book. You’ve taken in quite a lot by this point already.

The next time you select the box and open the Attribute Editor, you’ll see a new tab called polySubdFace1. This is the node added with the Add Divisions function in step 8. Feel free to adjust the Subdivision Levels setting on that tab and render to see how the detail levels affect the final render. Also try better quality settings in Render Settings, as you did with the red wagon earlier in this chapter, to clean up the render to your satisfaction.

You’ll next add an IBL sphere and use the HDR image you saw earlier in the chapter.

Rendering the Lamp and Decorative Box

You’re all grown up and ready to light a full scene using Final Gather, IBL with HDRI, and regular lights to get the best bang for your buck out of mental ray rendering. In the previous chapter, you briefly lit the lamp and decorative box with key, fill, and rim lights (the three-point lighting system). In this exercise, you’ll take this concept a few steps further, so take a deep breath, call your mother and tell her you love her, and let’s get started!

Set your project to the TableLamp. Open the lampLighting02.ma file in the Scenes folder. This scene has the lights and soft shadows created in Chapter 10 and is set to render through mental ray with raytracing enabled already. Let’s take a critical look at the render from the previous chapter in the earlier Figure 11-86.

Now that you have created a more detailed box, let’s update the reference in this scene. Choose File ⇒ Reference Editor. You are currently reading in boxDetail01.mb. Click boxDetail01.mb to select the entry, and choose Reference ⇒ Replace Reference. Navigate to the Decorative_Box project’s scene folder, and select boxDetail05.mb.

All your work detailing the box will now pop into the lamp lighting scene. Render a frame from the persp camera view. Figure 11-106 shows a comparison of the render from before the added detail (left) and the newly detailed box in the lamp lighting scene (right). The detailed box looks much nicer now, although you have to tweak the render quality settings in this scene later.

Figure 11-106: The render on the right shows all the added detail to the box missing from the render on the left.

c11f106.tif

Adding an IBL

Here’s where things get fun. You’ll add an IBL node to the scene and add the living-room HDR image to that IBL. First make sure you have mental ray selected as your renderer in the Render Settings window, and then follow along with these steps:

1. In your already open lampLighting02.ma scene, turn on the lampLayer visibility. Render a frame in the renderCam view, and save it to the buffer in the Render View window. You can also start moving around with your persp camera view again, since you’re no longer focusing on the box.
2. In the Render Settings window, click the Indirect Lighting tab. At the top, in the Environment heading, click the Create button for Image Based Lighting, as shown in Figure 11-107.

Figure 11-107: Click to create an IBL.

c11f107.tif
3. The Attribute Editor opens to a view of the newly created IBL (named mentalrayIblShape1), as shown in Figure 11-108. Set Hardware Exposure to 3 to lighten up the view of the HDR image in the view panels.

Figure 11-108: The Attribute Editor for the IBL node

c11f108.tif
4. Click the folder icon (c11g010.tif) next to the Image Name attribute. Navigate to the Sourceimages folder of the TableLamp project on your system, and select the file livingRoomPanoramic.hdr. You see in your view panes that a large yellow sphere is created in your scene. The living-room panoramic HDR image is mapped. (See Figure 11-109.)

Figure 11-109: The IBL is in place and mapped to the office chrome ball HDRI.

c11f109.tif
5. Use your persp camera to take a good look at the placement of the IBL sphere and the HDR image mapped to it. Select the IBL (you can click the IBL’s yellow wireframe lines or select mentalrayIbl1 in the Outliner), and rotate the IBL sphere to 155 in the Y-axis so that the bright sun in the window is behind the renderCam and the window faces the top wing of the biplane on the lamp. Figure 11-110 shows the orientation of the IBL.

Figure 11-110: Rotate the IBL sphere in the Y-axis to 155.

c11f110.tif
6. In the renderCam view, render a frame, and you’ll see the HDR image in the background. However, the lighting is largely unchanged from before when you compare it to your earlier renders from step 1. You need to enable Final Gather to take advantage of the IBL and the HDRI mapped to it.
7. On the Render Settings window’s Indirect Lighting tab, check the Final Gathering check box in the Final Gathering heading. Click the color swatch for Primary Diffuse, and enter a V (value) of 3.0, as shown in Figure 11-111. This will boost the brightness of the HDRI and will therefore cast more light into the scene.

Figure 11-111: Enter a value of 3 to increase the brightness of the HDRI.

c11f111.tif
8. Render a frame, and compare it to the image in Figure 11-112. Save the image by clicking the Keep Image icon (c11g008.tif), and compare it to your earlier render before the IBL. Also notice the bounced light on the gray floor, which is a nice touch, albeit splotchy right now.

Figure 11-112: It’s a noisy and bright render.

c11f112.tif
The render is a little bright and quite noisy. You have three lights in the scene already and now an HDRI. Reduce the Intensity of the key light from 1.2 to 0.8, the fill light from 0.25 to 0.15, and the rim light from 0.5 to 0.4.
9. Now, let’s prevent the HDR image from showing up in the background. Select the IBL sphere, and in the Attribute Editor under the Render Stats heading, turn off Primary Visibility. The background renders black without the IBL. Feel free to select the IBL and change its rotation to a different orientation to see how it changes the look of the scene. Just don’t forget to return it to its current orientation to stay consistent with the results shown in Figure 11-112 and the following section.

Orienting the IBL
The image (HDRI or otherwise) used in an IBL and the IBL’s orientation are huge factors in the lighting of a scene. Play around with the rotations of the IBL to see how the lighting differs until you settle on a look you like.

Fixing Final Gather Noise

The render from the previous section looks nice, except that it’s noisy. Notice the blotches of light all over the floor. This is from having low-quality settings for FG. On the Render Settings’ Indirect Lighting tab, increase Accuracy to 500 under the Final Gathering heading and Point Interpolation to 50. Doing so dramatically increases the render time for the frame (almost doubling the previous time); however, it makes the scene look much better—practically eradicating the blotchy nature of the previous renders. The floor plane is still a bit blotchy, but you’ll take care of it soon. The lamp and box have a nice glossy look to them thanks to the reflections and soft light from the HDRI. (See Figure 11-113.) Save the image to your Render View buffer.

Figure 11-113: Using higher-quality settings for FG makes a big difference.

c11f113.tif

You can open the scene file lampLighting03.ma from the Scenes folder in the TableLamp project to catch up to this point or to check your work so far.

FG is a difficult beast to tame, especially with an IBL. It takes a lot of experience and practice to be able to use this powerful feature of mental ray successfully in scenes. Experiment with different HDR images that you can download from the Internet as well as adjusting the lights in the scene.

Blurring Reflections with the mia_material

Let’s tweak the render a little more by making a new tabletop floor plane for the lamp and box to sit on to make the table look like a rich brown wood. You will use the mental ray mia_material shader:

1. Open the Hypershade, and in the Create panel, select Materials under the mental ray heading. Click mia_material to create the shader, as shown in Figure 11-114.

Figure 11-114: Create a mia_material shader.

c11f114.tif

The mia_material is quite different from the shaders I’ve covered. Although I will not cover this shader any further than this section, it is a powerful shader to use for glossy and reflective surfaces when using mental ray and especially so with Final Gather.

2. In the Attribute Editor for the mia_material, click the Map button next to the Color attribute under the Diffuse section, and apply a file node. Navigate to the Sourceimages folder of the TableLamp project, and select the tableWood.tif image file. This is a simple redwood texture.
3. In the Attribute Editor for the mia_material, set Reflectivity to 0.3 and Glossiness to 0.6. The way the mia_material works allows you to have diffused or blurred reflections, which are set by the Glossiness attribute. The higher the number, the more mirror-like the sharpness of the reflection. Experiment with this powerful shader to see the results in changing the shading quality of the redwood table.
4. Assign the mia_material to the floor plane. Name the shader tableShader.
5. Create two polygonal planes to make the corner of two walls behind the lamp and box, as shown in Figure 11-115, to have something in the background. Assign a light gray Lambert to the walls.

Figure 11-115: Create walls and a wood tabletop.

c11f115.tif
6. Render a frame, and you’ll see that the lighting on the lamp and box has changed a bit, because the new walls and tabletop are bouncing more light than the earlier default gray plane. This is why indirect lighting can be more photo-realistic, though trickier to control. Figure 11-116 shows the render.

Figure 11-116: Not a bad render

c11f116.tif

Let’s Get a Little Closer

Now that you have an overall look, let’s create a new camera and get closer to the subjects.

1. Create a new camera, and call it closeUpCam.
2. In the Attribute Editor for the new camera, set Focal Length to 28 and frame the scene, as shown in Figure 11-117.

Figure 11-117: Create and frame the new camera for a close-up shot.

c11f117.tif
3. Render a frame, and compare it to Figure 11-118. If your render times are too long to wait for, you should reduce the FG values in the Render Settings window (Accuracy and Interpolation). Just remember to turn them back up for your final renders. Keep the image in your Render View buffer.

Figure 11-118: Render the close-up shot.

c11f118.tif
4. In the render, the soft reflections in the tabletop look nice. The reflections in the lamp’s base and biplane could benefit from softening as well. You don’t have to make mia_material shaders for them to get blurred reflections, though. Open the Hypershade, and click the blue shader. In the Attribute Editor, click the mental ray heading to expand it. Set Mi Reflection Blur to 4.0 and Reflection Rays to 8, as shown in Figure 11-119.

Figure 11-119: Create a blurred reflection for the blue shader.

c11f119.tif
The higher the Reflection Blur attribute, the blurrier the reflections. However, this comes at a slight cost in render time. The Reflection Rays attribute controls the detail and quality of the blurred reflections; the higher this attribute value, the better the reflections and the longer the render.
5. Repeat step 4 for the green and red shaders, and render a frame of the close-up view (Figure 11-120). Keep the image in the Render View window, and compare to the previous render with the nonblurred reflections in the biplane. It looks nicer, doesn’t it? Experiment with the Reflection Rays attribute in the shaders to get a better reflection quality in the biplane and lamp base as desired.

Figure 11-120: Softened reflections create a nicer, more realistic look to the render.

c11f120.tif

Also try rendering the wider view in the other camera (RenderCam) and see how you can adjust lighting and shader settings for that angle.

Save your work, and compare it to the lampLighting_v04.mb scene file found in the Scenes folder of the TableLamp project from the companion web page. And if you decide to batch-render this scene, make sure to select one of the two cameras you created for this scene in the Render Settings window.


For a nice challenge, you could re-create the shaders for the objects using mia_materials to see the difference they can make in your renders. Many different materials could be simulated with the mia_materials shader.

Adding Depth of Field

One last item of interest is adding a depth of field (DOF) to the image. This effect adds blur to the render for the areas of the image that may be out of the lens’s focal depth. It can greatly add to the photo-realism of a rendered image.

Select the closeUpCam, and open the Attribute Editor. In the Depth Of Field heading, check the Depth Of Field attribute. Set Focus Distance to 14, and set F Stop to 11. The F Stop setting, like a real lens, sets how much is in focus around the focal distance. With a higher F Stop value, the focus runs deeper than with a low F Stop value.

Figure 11-121 shows the final render of the lamp and box with DOF enabled. Your render times will be longer, and for a better render, you’ll need to increase your Sample settings. Figure 11-121 was rendered with Min Samples of 0, Max Samples of 1, and Anti-Aliasing Contrast of 0.04 and took several minutes to complete.

Figure 11-121: The decorative box is in focus! We’re finished!

c11f121.tif

The scene file lampLighting_v04.ma from the Scenes folder in the TableLamp project will take you to this point.

Notice from the render that the biplane is thrown out of focus, along with the back of the tabletop and the walls. Experiment with varying focus distance and F Stop values to try different looks for your scene. For example, keep the biplane in focus, but throw the box out of focus.

Depending on the need and the size of the render, you’ll have to set the sampling levels to suit your needs—but be warned that your rendering times will dramatically increase, easily tripling depending on the quality settings. There are several ways to create DOF in a render that are faster or more controllable than what I’ve covered here. You can render out a depth pass to use with a lens filter in a compositing package such as Nuke to keep render times down. There are also more accurate DOF methods in mental ray and its lens shaders that you can experiment with when you’ve comfortably grasped the overall workflow presented here.

Try also experimenting with the different sampling modes to see whether you can shave time off the render. The table lamp scenes are all set to legacy sampling settings, so setting it to a Unified Sampling Mode may get you faster results. Finally, adding an Ambient Occlusion pass isn’t absolutely necessary for this render, although it may enhance the look of the contact shadows.

Wrapping Up the Lamp and Decorative Box

When you’ve learned a lot more about lighting and gained confidence with the processes of lighting, rendering, and compositing, you’ll find a wealth of options when you render in several different layers. For example, if this lamp and decorative box scene were a professional job, its render would most likely be split into a flat color pass, a reflection pass, a specular highlight pass, a shadow pass, an Ambient Occlusion pass, a depth pass, and several different matte passes that separate parts of the scene to give the compositor the ultimate control in adjusting the image to taste.

You may not know what all those passes do right now, but understanding will come with time as long as you continue practicing your CG Kung Fu. Rendering your own color passes and Ambient Occlusions will give you some beautiful renders even without all the other passes. Keep in mind that small changes and additions can take you a long way toward a truly rich image.


For an interesting challenge, take a photo in your house similar to the one on the cover of this book, render the lamp and box to match the lighting in the photo, and then composite the render against your photo.

Summary

In this chapter, you learned how to set up your scene for rendering. Starting with the Render Settings window and moving on to the different render engines available, you learned how to render your scene for a particular look. Then, I covered how to preview your render and how to use IPR for fast scene feedback. I moved on to how to render reflections and refractions, how to create and use cameras, and how to render motion blur. You tested your skill on a wine bottle scene, and to batch-render it out into a sequence of images, you checked it in a program like FCheck. You also used Maya render layers, overrides, and rendering an Ambient Occlusion pass to make your renders more realistic. Finally, you applied this knowledge to rendering the lamp and the decorative box using Final Gather and an HDR of a living room.

Getting to this point in a scene can take some work, but when you see the results playing back on your screen, all the work seems more than worth it. Always allow enough time to ensure that your animations render properly and at their best quality. Most beginners seriously underestimate the time needed to complete this step properly in CG production.

After you create numerous scenes and render them, you’ll begin to understand how to construct your next scenes so that they render better and faster. Be sure to keep on top of your file management—rendering can produce an awful lot of files, and you don’t want to have them scattered all over the place.

..................Content has been hidden....................

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