Chapter 45: Raytracing and mental ray


When computer-generated 3D images started to appear, it was the ray-traced images that really got the wow factor. These images were amazing in their clarity and perfect in reflecting and refracting light through the scene. Raytracing isn't new in Max, but making sense of all the raytracing features can be confusing.

To help you generate raytraced scenes, you can use the mental ray rendering engine. This engine takes the rendering in Max to a new level, enabling you to render your scenes with amazing accuracy.

Raytracing in Max can be used with the Default Scanline Renderer using the traditional Raytracing materials and controls, or it can be enabled at the renderer level using the mental ray settings.

Understanding Global Raytracing Settings

When you use the Default Scanline Renderer, raytracing is added to a scene to be rendered by applying the Raytrace material found in the Material Editor. Applying a raytrace material to an object sets the local raytracing parameters for the object to which the material is applied, but other settings determine how the raytracing is applied globally to a scene. These settings are found in the Raytracer Global Parameters rollout of the Raytracer panel of the Render Scene dialog box, shown in Figure 45.1. You access it directly using the Rendering image from book Raytracer Settings menu command.

image from book
Figure 45-1: The Raytracer Global Parameters rollout includes raytracing settings that affect the entire scene.

Note 

The Raytracer Settings and Raytrace Global Include/Exclude options in the Rendering menu are available only if the Default Scanline Renderer is assigned in the Render Scene dialog box.

Figure 45.2 gives you an idea of what is possible with the raytrace settings. The scene includes several simple spheres with a bumpy raytrace transparent material applied. The image on the left was rendered without enabling raytracing, and the image on the right has raytracing enabled. Notice that the reflections are much more pronounced in the raytraced image.

image from book
Figure 45-2: This simple scene of transparent spheres was rendered without raytracing (left) and with raytracing (right).

Controlling the raytracer

Suppose you have a scene with two mirrors that face one another. If the raytracer is allowed to track the bouncing of light rays through the scene, then it never completes because some light rays would bounce back and forth off the mirrors and never end.

The Maximum Depth setting tells the raytracer how long to follow each ray, or you can set a Cutoff Threshold. (Lower numbers speed up render times at the expense of quality.) You can also specify a color (or select to use the background color) to use for rays that reach the Max Depth, which is useful for identifying lost rays. Lost rays are raytraced lines that don't bounce as expected and can result in a less-than-accurate solution.

Caution 

The movement of a ray through the scene depends on the face normals. If the normals are flipped or pointing in the wrong direction, then the results are unpredictable.

The Global Ray Antialiaser group includes a drop-down list with two options: Fast Adaptive Antialiaser and Multiresolution Adaptive Antialiaser. These two options open separate dialog boxes, shown in Figure 45.3. The Fast Adaptive Antialiaser is quicker than its partner and offers settings for Blur and Defocus. The Multiresolution Adaptive Antialiaser takes much longer than the other option, but you can limit it with the Threshold and Max Rays values.

image from book
Figure 45-3: Additional anti-aliasing settings are available by clicking the button to the right of the drop-down list.

Note 

SuperSampling is enabled for a local raytracing material, then enabling a raytracing antialiasing option isn't needed, and vice versa, unless you want to apply a blur or defocus effect.

The Options section includes settings to Enable Raytracing, enable Raytrace Atmospherics, Enable Self Reflect/Refract, and Reflect/Refract Material IDs. There are also options to render the objects contained within raytraced objects, to render Atmospheric effects within raytraced objects, and to enable Color Density and Fog effects. The Show Progress Dialog and the Show Messages options let you see the progress of the raytracing engine along with any messages that the raytracing image may output. Figure 45.4 shows an example of the Message dialog box. This dialog box contains some useful information, including the total number of rays traced. From this info, you can determine whether the number of rays is too many or not enough.

image from book
Figure 45-4: The Raytrace Messages window outputs all the data from the raytracing engine.

Raytracing can take a long time, but the Acceleration Controls (opened by clicking the Acceleration Controls button), shown in Figure 45.5, offer you several raytracer options that can control the speed of the process. These settings override the existing settings. Before sending rays into the scene, the scene is subdivided into a tree of nodes called a voxel tree. The complexity of this voxel tree determines how long the raytracing solution takes. The Face Limit is the number of faces to include in a voxel node before subdividing. The Balance value defines how the scene gets subdivided. The Max Division sets the size of the voxel subdivisions, and the Max Depth value limits how many times a subdivision takes place.

image from book
Figure 45-5: This Raytracing Acceleration Parameters options control the speed of the raytracing by limiting the number of faces and divisions that must be processed.

Excluding objects

One of the easiest ways to increase the speed of the raytracer is to reduce the number of objects that it has to deal with. You open the Exclude/Include dialog box for raytraced objects using the Rendering image from book Raytrace Global Include/Exclude menu command (or by clicking the Exclude button in the Raytracer Global Parameters rollout). From within this dialog box, shown in Figure 45.6, you can select objects to be excluded from the raytracer.

image from book
Figure 45-6: The Exclude/Include dialog box lets you select objects to be removed from the raytracer.

The Exclude/Include dialog box includes two panes. The pane on the left lists all the objects within the scene, and the one on the right lists the objects to Include or Exclude, depending on which option is selected.

Note 

You use the same Exclude/Include dialog box to exclude objects from the effects of lights.




3ds Max 9 Bible
3ds Max 9 Bible
ISBN: 0470100893
EAN: 2147483647
Year: 2007
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net