About Shadows


Shadows are an important scene element because they secure an object's placement in a scene. Objects without shadows look free floating (Figure 15.60) and, by extension, unrealistic. Shadows are also important artistically. Most lights in Maya have the option to cast shadows, but you only want a few in each scene to cast them; the most dramatic effects are produced with a few bold shadows.

Figure 15.60. Shadows help to visually plant objects on the ground.


A real-world shadow is the complementary color of the light source: The sun is yellow; therefore, the shadows it casts are purplein essence, there are no black shadows in the real world, only very dark representations of a particular color. Keep this in mind as you create both realistic and artistic shadows: If you apply this principle to your 3D work, you'll produce deeper, richer imagery.

A real shadow is darkest close to an object, fading and blurring as it gets farther away (Figure 15.61). The bounce of light and variations in light source illuminate a shadow and ensure it isn't pitch black (Figure 15.62). A shadow that is very precise or very dark will stand out and thus appear unrealistic.

Figure 15.61. A real shadow's darkest area is slightly away from the object's edge, near the base of the shadow.


Figure 15.62. Light from bright areas leaves from more than just one point. In the areas where light is partially blocked, a light, blurry shadow forms (Top). The closer a shadow is to the object that casts it, and the smaller the source, the sharper a shadow gets (Bottom).


Creating shadows

Shadows are turned off on all lights by default. To see shadows in a render, you must turn them on. Because you will have many lights in most scenes, you should turn on shadows for only a few key lights. Always try to ensure that your shadows come from obvious light sources.

Another way to help your shadows look good is to be sure you don't have too many in your scene. Too many shadows can look as odd as none (Figure 15.63), and Maya gives you the ability to limit the shadows cast by objects. An individual object doesn't cast a shadow if shadow casting is turned off on the object. This applies even if the object is struck by a shadow-casting light.

Figure 15.63. Too many shadows make it hard to tell what is going on.


Maya uses two types of shadows: depth map (Figure 15.64) and raytraced (Figure 15.65). Both methods can produce good-looking shadows, although raytracing often produces more realistic shadows with less effort and tweaking. However, raytraced shadows can take much longer to render than depth-map shadows, so the choice is a trade-off. It's a constant battle to produce good-looking shadows while keeping rendering time to a minimum for each scene.

Figure 15.64. Depth-map shadow.


Figure 15.65. Raytraced shadow.


Depth-map simulated shadows are usually much faster to render than raytraced shadows, but you pay for that speed with increased RAM use at render time. A depth map is an image file that contains a depth channel (a grayscale representation of how far objects are from the camera, the lights, and each other) rendered from a light's point of view (Figure 15.66). Maya uses the depth map to determine which surfaces have light hitting them and which surfaces are in shadow. Think of the depth map as a pre-drawn shadow brought into the scene just before it's rendered. This image is then projected from the light's point of view, like a texture, darkening the areas where shadows should be. The image resolution and your object's distance from the light are key to ensuring a good-looking depth map. If you need to redo a render, these depth-map image files can be reused, saving even more rendering time.

Figure 15.66. On the left is a render of the scene, on the right is the depth map used to determine which objects are closest to the light.


In most scenarios, raytraced shadows produce great-looking, realistic imagesresults you wouldn't be able to achieve with depth-map shadows. One example is a transparent shadow cast from a partially transparent object (Figure 15.67).

Figure 15.67. A depth-map shadow can't show an object's transparency within the shadow (top);a raytraced shadow can (bottom).


However, raytraced shadows have some restrictions as well. For one, they don't show up if rendered with interactive photorealistic rendering because IPR doesn't allow raytracing. This represents an additional speed cost because you can use IPR to see depth-map shadows, making depth-map shadow adjustment much faster. You can also preview light placement and depth-map shadows using the shaded mode in any view.

Depth-map shadows

Depth-map shadowswhich are available in all but ambient lightcan simulate relatively realistic shadows without greatly affecting rendering time.

To create a depth-map shadow:

1.

Select the light from which you want to produce a shadow.

2.

In the Attribute Editor, click the arrow next to the Shadows heading to expand the shadow options.

3.

Select the Use Depth Map Shadows check box under the Depth Map Shadow Attributes heading (Figure 15.68).

Figure 15.68. Select Use Depth Map Shadows.


4.

In the Shadows section, click the swatch next to the Shadow Color attribute (Figure 15.69).

Figure 15.69. Click the swatch next to the Shadow Color attribute to open the Color Chooser.


The Color Chooser opens.

5.

Select a shadow color from the color wheel.

6.

Click Accept to lock in the color.

7.

Select the surface you want to cast shadows.

8.

In the Render Stats section of the surface's Attribute Editor, make sure that Casts Shadows (the default option) is selected (Figure 15.70).

Figure 15.70. Select Casts Shadows in the Render Stats section of the Attribute Editor.


9.

Test-render the scene by selecting Render > Render > Persp in the Render view pane.

The render shows a depth-map shadow (Figure 15.71).

Figure 15.71. The final render with a depth-map shadow.


To preview depth-map shadows:

1.

Continuing from the previous task, "To create a depth-map shadow,"click in the Perspective pane.

A blue box around the Perspective view indicates that it's the active pane.

2.

Press to switch to shaded mode.

3.

Press to enable Use All Lights in the Perspective view.

4.

Select Lighting > Shadows to display depth-map shadows (Figure 15.72).

Figure 15.72. Select Lighting > Shadows to display depth-map shadows.


You can now move the camera and play the animation with a good approximation of what the final lighting will look like (Figure 15.73). If the lights are set to raytraced shadows, then the shadows don't appear in the view.

Figure 15.73. These depth-map shadows are a good approximation of the final rendering.


5.

Select Shading > High Quality Rendering (Figure 15.74).

Figure 15.74. Select Shading > High Quality Rendering to display depth-map shadows.


The overall shading quality and especially the shadow edges should be greatly improved, giving an even more accurate preview of what the final shading will look like (Figure 15.75).

Figure 15.75. The overall shading quality is improved, especially the depth-map shadow edges.


The following are common depth-map shadow attributes:

  • Dmap Resolution The resolution of the depth-map shadow file. Shadow edges appear pixilated if the resolution is too low (Figure 15.76). However, you should use the lowest possible setting that produces acceptable results, because this attribute is extremely memory intensive.

    Figure 15.76. Shadow edges appear pixilated if the Dmap Resolution is too low.

  • Dmap Filter Size Works in unison with Dmap Resolution to control the softness of the shadow's edges (Figure 15.77). Try to maintain a setting of 3 or less to avoid adding excessive render time.

    Figure 15.77. Dmap Filter Size controls the softness of the shadow's edges.

  • Dmap Bias Moves the map closer to or further away from the light. You only need to use this attribute in the following circumstances:

    • If a shadow appears detached from the shadow-casting surface, gradually decrease the Dmap Bias value until the shadow looks correct.

    • If dark spots or streaks appear on illuminated surfaces, gradually increase the Dmap Bias value until the spots or streaks disappear (Figure 15.78).

      Figure 15.78. From left to right: Correct Dmap bias settings, bias set too high, bias set too low.

Raytraced shadows

Raytraced shadows can create highly realistic shadows but also add expensive rendering time. To produce raytraced shadows, you must check three things:

  • Raytracing must be selected in the Raytracing Quality section of the Render Settings window.

  • Use Raytraced Shadows must be selected in the light's Attribute Editor.

  • Casts Shadows must be selected in the Render Stats section of the Attribute Editor of each object you want to cast a shadow.

To create a raytraced shadow:

1.

Select the light you want to produce a shadow.

2.

In the Raytrace Shadow Attributes section of the light's Attribute Editor, select Use Ray Trace Shadows (Figure 15.79).

Figure 15.79. Select Use Ray Trace Shadows in the light's Attribute Editor.


3.

Above the Raytrace Shadows Attributes, open the Shadows section and click the swatch beside the Shadow Color attribute.

The Color Chooser opens.

4.

Click in the color wheel to select a shadow color.

5.

Click Accept to lock in the color.

6.

Test-render the scene by selecting Render > Render > Persp in the Render view window.

IPR renders don't support raytraced shadows, so be careful not to perform one.

The following are common raytraced shadow attributes:

  • Light Radius Sets the softness of the shadow's edge relative to the size of the light, as we showed earlier in Figure 15.62. For example, smaller light values produce crisper shadows, and greater light values create softer shadows (Figure 15.80).

    Figure 15.80. A default raytraced shadow (top), and a shadow with the Light Radius attribute turned up (bottom).

  • Shadow Rays Sets the number of sampling rays used to determine soft shadow edges (Figure 15.81). Increasing this attribute's value reduces grainy edges but increases rendering time, so keep it as low as possible.

    Figure 15.81. Changing the Shadow Rays attribute can cut down on grainy shadows.

  • Ray Depth Limit Determines whether a light casts a shadow if the light bounces off multiple mirrors before it hits your object.




Maya 7 for Windows and Macintosh(c) Visual Quickstart Guide
Maya 7 for Windows & Macintosh
ISBN: 0321348990
EAN: 2147483647
Year: 2006
Pages: 185

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