Light Profiles

The mental ray photometric custom light shader supports adding realistic light models by means of light profiles known as Illuminating Engineering Society IES photometric files or Eulumdat profiles. Both are plain-text descriptions of light intensity and falloff, corresponding to various light types and light fixtures provided by light manufacturers. They are used to realistically simulate physically accurate lighting for architectural renderings or light simulations. Light fixture descriptions...

Info

Typically, with motion cameras, the shutter is a circular disk mechanism, known as a rotary disk shutter, that constantly rotates in front of the film, as illustrated in Figure 4.2. The two images on the top illustrate the shutter at two different points during the exposure time. Further, the shutter's shape seen as the gray triangle that is pivoted to rotate around the polygonal shape may be open to a greater or lesser degree based on the shutter angles value, measured in degrees. Thus, the...

mental ray Data Types

Before we dive into the topic of mental ray output, image formats, and frame buffers, you need to know some basic terminology as well as how images are stored. The following sections will gradually build these concepts so that you feel more confident with all the different frame buffer and image output options available with mental ray. Image bit depths are specified as either n bits per channel or n bits per pixel. Per channel bit depth refers to the bit depth of each channel independent of...

The GPU Advantage

GPUs have been developed to maximize speed and flexibility for hardware vertex transformations followed by primitive assembly and rasterization, creating vertices that have been lit, shaded, and placed within a specific pixel space as well as eliminating all unused vertices. The ability of a GPU to deal with such tasks in real time has some significant advantages over CPUs. In fact, GPU hardware can process hundreds of millions of triangles per second. As a result, your CPU can be relieved of...

OpenGL Accelerated Shadows

OpenGL shadow maps allow hardware to calculate the shadow maps extremely fast, limited only by the hardware's abilities. There is not much to say about OpenGL shadows except that the technique is very similar to scanline OpenGL acceleration it rapidly compiles the depth projection. See Chapter 2, Rendering Algorithms, for more information on hardware implementations. Because mental ray supports rendering partial shadow maps, it may require fewer shadow map calculations. With OpenGL shadow maps,...

Enabling Hardware Rendering in Maya

In Maya, when exporting .mi files, you can enable these features from under the .mi default options. These options should be accessed preferably when mental ray is selected as the current render type. Once mental ray rendering is enabled, you can access the hardware render settings by entering the following line into the script editor select -r miDefaultOptions Once you've opened the Attribute Editor, locate the bottom Extra Attributes tab, where you will see the hardware rendering settings,...

Hardware Rendering Capability Parameters

The following sections list some hardware rendering architectural implementation issues, capabilities, and limitations. Hardware rendering imposes on mental ray some implementation characteristics of its own Hardware rendering has no knowledge of the scene and thus copes only with one triangle at a time, adding its color values within the frame buffer. This approach is significantly different than software rendering, which sorts the scene with a scene database, evaluating and distributing jobs...

Field of View

Field of view is another component that is significantly influenced by both the film back size and the focal length. Earlier you learned about the influence of the film back dimensions, and now you can add the lens focal length into this equation. Normal lenses use an average horizontal width field of view of 20 to 25 . Because the film gate's horizontal and vertical scales differ, they dictate a different field of view value along either axis, unless of course you use a theoretical square film...

Raytrace Algorithms

Raytracing requires the renderer to compare each ray with every triangle in the scene, determining whether that ray intersects with a surface. With ray casting primary rays , the sampling number determines how many rays are cast into the scene, whether you're using infrasampling or supersampling. For example, if you set a sample level of 1, you will cast four rays into the scene for every pixel, and each of those rays needs to be compared with every triangle to find any intersections. You can...

Pixel Aspect Ratio

Typically, if you are using the same format to film as well as to project, you would want the render settings and the camera settings to match in size proportionally so that they both use the same image aspect ratio. When dealing with computer monitors, film formats, and even HD formats, pixels are said to have a 1 1 aspect ratio, and thus are known as square pixels. Other output media, however, don't use square pixels. With digital video recording DV devices and NTSC and PAL televisions VHS ,...

Depth of Field and FStops

Film Focal Length Film Back Lens

Within the camera lens, the iris simulates a pupil's iris expanding and contracting based on sensitivity to light. The iris then controls the aperture's diameter, controlling the pupil's size. What the term f-stop really describes is a relationship between the aperture diameter and the focal length of the lens. A stop is said to halve the light intensity that can penetrate the lens, stopping a portion of light from reaching the film. Typically, f-stop values are provided in increments of one...

Host Translators

When using mental ray through a host application, it is not necessary to be familiar with the mental images scene description language. In fact, no knowledge of any mental ray programmable features is required in order to take full advantage of mental ray. During the render, the host application will automatically translate the scene into a mental images format that is then rendered with mental ray. For example, when a render is executed in Maya, we can see the command line progress feedback,...

Shadow Map Shadows

Depth Shadow Map Reprojection

Unlike raytraced shadows, depth-based shadows are based on a visual projection of the scene as seen from the light's perspective, as in Figure 7.8, similar to a Z-depth pass from a camera's perspective. Here, a grid of XxY pixels B is used to record the scene from the light's perspective A . Each pixel in the shadow map is responsible for recording several elements from within the scene, as seen through each pixel's line of sight. Thus the ability of a shadow map to properly define shadow...

Raytrace Acceleration

Chapter 2 introduced scanline rendering and the basic concepts of raytracing. This section provides a closer look at raytracing and the three raytrace acceleration algorithms available for calculating raytracing. The different scanline rendering algorithms affect image quality as well as rendering time, but the raytracing algorithms are aimed only at improving render times and have no effect on image quality. This might be one reason users are not as familiar with these settings. After all, why...

Woo and Bias Shadow Maps and SelfShadowing

Our discussion of shadow maps so far has omitted the issue of how depth values are stored and of self-shadowing artifacts. mental ray provides two internal algorithms for storing depth values. They are referred to as the Woo and Bias algorithms, and they are available regardless of whether you use shadow map shadows, detail shadow maps, or OpenGL shadow maps except that OpenGL doesn't support the Woo algorithm . The Woo algorithm is also commonly known as mid-distance shadow mapping, and is the...

Rendering Shadow Map Shadows

Shadows Objects

During rendering, when mental ray needs to decide if a point is in shadow, it compares the distance from that point to the shadow-casting light with the stored depth map distance for that point. Figure 7.10 shows both the distance to the light from the point in question on the wall , referred to as distance B, and the distance from the closest light-occluding point the sphere , referred to as distance A. Distance B is compared with distance A, the stored shadow map distance. Because the shadow...

Primary and Secondary Color Values

RGB primary colors, when combined, provide any shade of color from the visible spectrum. The RGB color model is described as additive because colors are formed by adding light generated by phosphors in the monitor in the three primary colors. Essentially, a render view background can be thought of as a black blank canvas, corresponding to a value of zero. As values are rendered, their values are added together, increasing in value and relative brightness. When all three colors are combined at...

Light Profiles with ds Max

With 3ds Max, you can use the photometric lights to attach light profiles. As cited earlier, you should not use photometric area lights the free or target area lights with a light profile, even though you can technically do so. Note that photometric area lights export as point lights, with the area light option enabled, as with the mental ray area light examples in this chapter. Thus you can use these area lights with mental ray, but without light profiles. You can control sampling from the...

AntiAliasing

The main purpose of sampling and filtering is to control the anti-aliasing quality of the rendered image to provide the best possible render quality for the 3D scene. Aliasing refers to two primary types of artifacts and motion artifacts that appear while rendering. The first is object aliasing, which is the stair-step jaggedness along a surface's edge against a background or another surface. Anti-aliasing is used to soften the edge and provide a better transition between edges. Figure 5.4...

Games

In computer games, which are constantly evolving and offering more realistic experiences, the emphasis on complex, instantaneous interaction has always put high-end rendering out of reach. Enhanced CG requires complex shading models and lighting such as simulating indirect lighting. Games do not consist of images prerendered using mental ray or any other renderer they run on a game engine that renders in real time. This real-time display is enabled using technologies that access and control...

Exposure Levels

By now it is clear that real cameras enable us to use different methods to control light exposure, and the shutter speed and shutter angle discussed earlier and the aperture f-stop to regulate it. These settings provide unique methods for tweaking different photographic phenomena such as motion blur and depth of field. Ideally, you can reach the same specific exposure level balancing the shutter and f-stop values. With respect to exposure level, photographers will argue that there can be only...

Camera Basics and Aspect Ratios

One of the most important aspects of film production whether it's a short independent film or a high-tech feature film is the camera. The better a virtual camera can simulate a realistic camera's photographic abilities, the more the viewer will be convinced that the shot is genuine. Virtual cameras used to superimpose computer-generated imagery on live-action shots need to match the same image aspect ratio, focal depth, perspective, and so forth as the live-action camera. But that's only part...

Default and PerObject Sampling

Sampling values can also be applied on a per-object basis, under an object's declaration within an .mi file. Thus, you may specify sampling at three different levels the main primary global level, additional default values, and per object. This chapter mainly focuses on the primary sampling values, which constrain the two other settings to the primary sampling value range. Both default and per-object sampling may override each other based on which provides higher settings, but both are limited...

mental ray Hardware Rendering

Currently, hardware rendering is a practical option only for stand-alone mental ray users. Although Maya allows you to specify hardware rendering, you still need to provide supporting shaders as well as customize the render for hardware support. Thus, hardware rendering currently is not an out-of-the-box solution. You may, however, find that it can greatly accelerate render times, and so you can research it further with your application and the onboard hardware through the mental ray help...

mental ray Output

This chapter tackles mental ray's output features, including camera shaders and custom passes. We begin with the relationships between mental ray's data types and bit depth as a foundation for understanding image formats. Frame buffers control render output and so you'll learn about the different mental ray frame buffer types and their bit depths and purposes throughout this chapter. In the section mental ray Cameras, you'll begin outputting custom frame buffers and specifying global shader...

mental ray Options

The scene options define a custom time interval for the mental ray Shutter shutter time and Delay shutter delay options that are found in the mental ray Render Options for a given pass property editor. You can navigate to these options in the Render Manager window under Current Pass Pass mental ray Motion Blur tab, as seen in Figure 8.14 C. Delay controls the shutter delay or start time within the time interval, as defined by the Speed option Shutter is then the shutter time, which, when Delay...

The Cg Advantage

The connection between all these technologies and the GPU is that shaders that process the appearance of 3D renders are all processed within the GPU. Thus the Cg program, which interfaces with the GPU through either OpenGL or Direct3D, executes within the GPU every vertex and fragment shader see Programmable GPUs and Shader Trees below , repeatedly if necessary, until the shader process has finished evaluating. Essentially, with mental ray, when using Cg you can simply provide the source code...

Programmable GPUs and Shader Trees

Hardware shading abilities have come a long way, from supporting vanilla base shaders to being able to support shading trees. Shading trees are the backbone of any good 3D application you develop a shader graph by connecting several different elements in a certain tree form, creating a complex effect. Supporting shader trees requires programmable third-generation or later GPUs. That is, for a shader to provide mathematical color-evaluation instructions, the GPU must be capable of interpreting...

Empty Space and Environment Reflections

If the ray limit is met or there are no other objects to reflect, the ray will terminate and return a color. If an environment shader exists, either globally in the scene or as part of a specific shading network, that shader will be used to calculate the reflection value. Note that this sort of reflection value, defined by an environment shader, does not utilize raytracing but is part of a projected shader, such as with a spherical environment shader. In essence, several raytrace features can...

Introduction to Synthetic Lighting

As we begin exploring rendering algorithms, it's important to remember that the ultimate goal of rendering a computer-generated image is to create realistic, finished surfaces by simulating the behavior of light in the real world. In CG, the process of surface shading is based on two main components light shaders lights and their interaction with the surfaces' material shaders. However, as real light is far more complex than CG light, even the most basic light phenomena can become rather...

Diagnostic and BSP FineTuning

When mental ray renders, if you set the translation output to info messages verbose level 5 see Chapter 1, Introduction to mental ray , you will see useful fine-tuning information. Here is the output log for the BSP tree statistics Each of these outputs provides further insight into the current BSP optimization and its progress. Let's examine each of the messages, which are briefly described in Table 5.4. Max Depth The maximum depth level that was reached during the render Max Leaf Size The...

The Alpha Channel

The fourth channel is typically used for storing a masking channel, such as the alpha channel but not only. This channel should be considered as an additional grayscale channel not encoded to any specific color because it is not automatically by the image viewer encoded with any of the primary RGB colors it is simply a black-to-white grayscale channel that is used to store any form of data as grayscale values. For example, high dynamic range HDR images store the three standard RGB channels and...

The Motion Vectors Frame Buffer

The motion vectors frame buffer, a three-channel 32-bit-per-channel floating-point data type frame buffer, stores motion vectors typically for 2D postprocess motion blur effects. Motion vectors are exported using the MT mental ray format and represent the vertex motion and velocity in a color-coded form so that it can then be used by output shaders or with vector motion blur effects within compositing applications. When rendering motion blur 2D postprocess effects, mental ray creates the...

Umbra and Penumbra

The penumbra is the region where the terminator line divides light from shadow, as seen in image A in Figure 6.1. The light penumbra is the partially occluded light region, transitioning from fully occluded light umbra to un-occluded light. Penumbra transitions can be relatively smooth, both from the shadow's umbra to light and along the light's terminator line, as seen in image A in Figure 6.1. With respect to shadows, area lights provide the benefit of simulating shadow falloff more...

Soft Shadow Maps

Figure 7.12 demonstrates the result of rendering with a low-resolution shadow map A vs. a high-resolution shadow map B . In A, pixel artifacts appear along the sphere's edge, but in B we have a more finely detailed outline however, you still see the pixel patterns. Figure 7.12 Low-resolution shadow maps vs. high-resolution shadow maps, where fewer pixel artifacts can be seen Figure 7.12 Low-resolution shadow maps vs. high-resolution shadow maps, where fewer pixel artifacts can be seen Shadows...

CommandLine Rendering and the StandAlone Renderer

Another powerful feature mental ray offers is a stand-alone renderer. In general, large productions or smaller high-end specialist production houses can get more from mental ray by using the stand-alone renderer for troubleshooting. They use it primarily for taking advantage of additional mental ray features that are not fully incorporated in host software packages and instead of, or as a means to develop render farms without a need to install host applications on render nodes making it more...

BSP Large BSP and Hierarchical Grid

mental ray provide two algorithms for dealing with these ray-triangle comparisons in a logical method the Hierarchical Grid and Binary Space Partition BSP algorithms. The BSP tree algorithm is mental ray's primary raytracing algorithm, used in most cases, and there is also a subset algorithm, known as Large BSP. These algorithms are responsible for dividing the scene into smaller segments, so that a ray can be compared with fewer triangles. The theory for good raytracing render times is to...

The Segment Shadow Algorithm

The Segment shadow algorithm builds on the abilities of the previously discussed algorithms Regular and Sort by evaluating the distances between each occluding surface polygon within the light's path. This more complex shadow algorithm supports volumetric effects shadows such as through dust or smoke clouds. Figure 7.5 illustrates the segmented shadow process from a point on a surface to the light source, emitting a new ray at each intersection occluding point. The segmented shadow method...

The Normal Vectors Frame Buffer

The normal vectors buffer uses three 32-bit floating-point channels to store the surface normal directions in a color-coded form using mental ray's NT image format. Normal vectors are used to describe the surface normal aim direction at a given point, typically in world space coordinates. Green is used for the up Y vector, red for positive X vector, and blue for positive Z vector, as seen in Figure 3.2 on the CD, you'll find a color version named Normal Vectors . Figure 3.2 The normal vectors...

Raytrace Acceleration Settings

You can set raytrace acceleration within an .mi file's options block or on the command line -acceleration bsp largebsp grid -bsp_depth max depth value -bsp_memory max memory in mb -bsp_size max triangle per voxel -bsp_shadow on off And the following lines show the Grid options -grid_depth max subdivision level -grid_resolution x_res y_res z_res -grid_size max triangle per voxel In the host applications, you can access the options shown in Figures 5.25, 5.26, and 5.27 via the following paths...

Intro to Multichannel Images

Beyond these standard four channels, additional channels may also be stored, providing a multichannel image. For example, an image may store the RGBA channels and an additional fifth Z-depth channel, supporting five channels within a single image file. Today, one of the most significant formats is OpenEXR, an HDR format that supports storing any number of additional channels. It can store different grayscale channels that can then be interpreted as color channels within supporting compositing...

Reflection and Refractions

In Figure 2.5, as a ray exits the camera, it is first evaluated at point A, the sampled point. Thus, at point A the surface shader is called and begins evaluating surface properties for that point based on its shader settings. If the surface is reflective, refractive, or both, the shader evaluation will determine whether a ray needs to bounce and thus cast a secondary ray into the scene to look for additional influence objects. Assuming point A is reflective, a secondary ray is cast to point B....

Detail Shadow Sampling

The Detail shadow map algorithm also allows supersampling on a per-pixel level for depth map pixels , providing a good alternative to raytracing shadows. When enabled, two additional mental ray options are available under the light block in the .mi file shadowmap detail samples n Shadowmap accuracy n The samples option enables you to increase the per-pixel sampling for each pixel in the depth projection, which provides for much better results because samples are averaged to produce more precise...

DistanceBased Shadows

One of the more expensive tasks we face is softening a shadow's falloff, providing a more natural soft shadow look. Soft shadows can be accomplished in various ways, based on whether you choose shadow maps or raytrace shadows and whether you want to emphasize realism or just provide a creative shadow blur, such as with a Photoshop blur effect. The more you focus on realism, the more render-expensive the task becomes. Figure 6.4 Area lights enable light to wrap around surfaces, even past their...

Light Shaders

The basic light model acts as a component shader so that complex lighting models can be achieved by combining different component shaders to add effects such as texture projection, light effects, and light profiles used to simulate real-world light models . The common ground is that the base shading model selects one of four light types, and then additional options or light shaders are appended for specific light characteristics. For example, the excerpt in the preceding section created a spot...

Specifying Shadow Algorithms

The following options can be entered in the .mi file's option block or as a command-line command using the -shadow option -shadow off, on, sort, segment These settings are equivalent to the three raytrace algorithms previously discussed Regular on , Sort, and Segment and can be found within the host applications under the following drop-down lists, as seen in Figures 7.24, 7.25, and 7.26 Maya Shadows Shadow Method Simple is Regular. 3ds Max Shadows Mode Simple is Regular, and the Enable check...

Maya

1. Navigate to the Maya Render Settings window, and under the mental ray tab, locate the Ray-tracing rollout, shown in Figure 2.6 2. The Ray tracing check box is used to enable or disable raytracing altogether, corresponding to the command-line -trace option. Note that the Ray Tracing check box correlates to the Rendering Features rollout Secondary Effects Raytracing check box seen in Figure 2.2. Thus if you change either one, the other will update automatically. Reflection Blur Lm 1 1-J...

The Primitive Properties Tab

The Primitive tab provides general settings for the camera's field of view as well as the film format. The Field of View Angle option directly correlates to the camera's field of view. The Horizontal option below it dictates whether the Angle value represents the vertical or horizontal field of view. Typically, field of view refers to the horizontal axis. The Format Standard option provides several presets for cameras. If you select the NTSC D1 4 3 720x486 preset, notice how the Pict. Ratio and...

Shutter Speed Shutter Angle and Motion Blur

A shutter is a device that, based on a shutter speed, opens and closes in front of the film gate, exposing the film to light. With still cameras, the shutter typically operates like an opening door or a sliding curtain that can rapidly open and close. For simulating real motion cameras in CG, the shutter interests us to the extent that it influences some photographic phenomena, mostly motion blur and depth of field. Depth of field is not influenced by the shutter, rather by how the shutter and...

Photometric Lights

It's a great advantage that mental ray supports all the photometric lights, including an implementation of mr sky and mr sun shaders equivalent to the IES sun and sky shaders , which can be used with the daylight system and Final Gather to produce realistic lighting. The daylight system improves the approach to simulating particular lighting, and a particular time of day and location, as well as enables a high dynamic range of light brightness . The daylight system utilizes the mr sun to mimic...