Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Digital Audio, Video > 3D

  • Print
  • + Share This
This chapter is from the book

Casting Shadows

There are four types of shadows that the scanline renderer can project from a light:

  • Shadow maps are bitmaps that are projected from a light. They are created by the scanline renderer during a pre-rendering pass of the scene and applied during rendering. Shadow maps give shadows a soft edge, as if they are being diffused by the atmosphere.

  • Shadow maps are the default shadow type for most lights (Figure 11.36).

  • Area shadows simulate shadows that are cast from an illuminated area or volume. They use anti-aliasing to produce soft, atmospheric shadows and they support opacity and transparency mapping (see Chapter 14, "Maps," for more information) (Figure 11.37).

  • Ray-traced shadows are calculated by tracing a ray from source to object. Sharper and more precise than shadow-map shadows, ray-traced shadows are usually slower to render. Ray-traced shadows are perfect for architectural shadow studies, which is why they are the default shadow type for sunlight systems. Like area shadows, ray-traced shadows support opacity and transparency mapping, but they do not support soft shadows (Figure 11.38).

  • Advanced ray-traced shadows are a variation of ray-traced shadows that use less RAM for rendering. They can use anti-aliasing to produce soft edges (Figure 11.39).

The fifth type of shadow, the mental ray shadow map, can only be used with the mental ray renderer. If mental ray shadow maps are used with the scanline renderer, no shadows will be rendered.

Figure 11.36Figure 11.36 Shadow map shadows have soft edges.

Figure 11.37Figure 11.37 Area shadows produce soft, atmospheric shadows.

Figure 11.38Figure 11.38 Ray-traced shadows have hard edges.

Figure 11.39Figure 11.39 Advanced ray-traced shadows use anti-aliasing to produce soft edges.

Once you select a shadow type, you can adjust its color, density, and position, plus other qualities specific to that type. The adjustments that you make to a shadow determine the speed at which it will render.

To change shadow type:

  1. Open Practice02.max.

  2. Render the scene to see what the shadows look like (Figure 11.40).

  3. Select the spotlight.

  4. Open the Modify panel.

  5. In the General Parameters rollout, choose a shadow type from the drop-down list (Figure 11.41).

  6. Render the scene to see the result (Figure 11.42).


n Ray-traced shadows render more slowly when you use them with omni lights. If possible, use ray-traced shadows with spotlights or directional lights instead. If you still need the effect of an omni or directional light, check Overshoot so the shadows will only be calculated within the cone.

Figure 11.40Figure 11.40 The practice scene has soft shadow mapped shadows.

Figure 11.41Figure 11.41 Changing the shadow type to Ray Traced Shadows.

Figure 11.42Figure 11.42 The ray-traced shadows are more crisp and precise.

Shadow maps sometimes appear blurry, faint, or detached from the objects that cast them. Shadow-map parameters help you fix these problems (Figure 11.43):

  • Bias—Offsets shadows from the object that casts them. Lowering the Bias value moves shadows closer to the object.

  • Size—Controls the resolution of a shadow by setting the size of the bitmap that generates the shadow. Increasing this parameter sharpens shadow edges and increases rendering time.

  • Sample Range—Controls the sharpness of shadows by averaging different sized areas of the shadow map. If a shadow smudges, streaks, or creates moiré patterns, the Sample Range setting is probably too high. A Sample Range setting that is too low creates jagged shadows.

  • Absolute Map Bias—Determines how the map bias is computed in relation to the rest of the scene. Use this option to end flickering shadows in an animation.

  • 2 Sided Shadows—Causes surfaces to cast shadows as if they were double sided.

To get the most accurate feedback, render the scene after you change each parameter.

To adjust a shadow map:

  1. Select a light that has a problematic shadow map, such as the spotlight in Practice02.max.

  2. Open the Modify panel.

  3. Open the Shadow Map Params rollout (Figure 11.44).

  4. Increase the Size and the Sample Range to improve the resolution of the shadow. Then decrease the Bias until the shadows touch the objects that cast them (Figure 11.45).

  5. Save the scene.

Figure 11.43Figure 11.43 Before and after adjusting a shadow map.

Figure 11.44Figure 11.44 The Shadow Map Params rollout provides the means to correct shadow maps.

Figure 11.45Figure 11.45 Increasing the map size and sample range focuses the shadow. Adjusting the map bias brings the shadow bank into alignment. To make the gap between the teapot and its lid disappear, check 2 Sided Shadows.

Ray Traced shadows produce hard-edged shadows that rarely need correcting. Like shadow map shadows, they allow you to adjust the shadow bias and render 2-sided shadows. In addition, the Max Quadtree Depth setting controls the rendering speed of ray-traced shadows by setting the maximum size of the data structure that generates them.

Advanced Ray-Traced shadows allow you to add anti-aliased edges and control their smoothness. You can also add noise to the shadows to offset shadow artifacts.

For more information on shadow parameters for each of the shadow types, open the 3ds max 6 User Reference and go to Contents > Lights and Cameras > Lights > Rollouts for Specific Shadow Types.

To speed up rendering of ray-traced shadows:

  1. Open Practice05.max. Then select Sun01 (Figure 11.46).

  2. Open the Modify panel.

  3. Open the Ray Traced Shadow Params menu (Figure 11.47).

  4. Increase the Max Quadtree depth.

  5. Render the scene. The scene renders faster.

Figure 11.46Figure 11.46 This sunlit scene has ray-traced shadows that are slow to render.

Figure 11.47Figure 11.47 Ray Traced shadows have few parameters. For faster rendering, increase Max Quadtree Depth.

To anti-alias ray-traced shadows:

  1. In the General Parameters rollout, convert the shadows of the Sun01 object to advanced ray-traced shadows.

  2. Open the Adv. Ray Traced rollout (Figure 11.48).

  3. Increase the Shadow Integrity to 5 and the Shadow Quality to 10. Then increase the Shadow Spread to 4.

  4. Render the scene (Figure 11.49).

  5. Continue to play with the parameters until you get the effect that you like. Be sure to try increasing the Jitter Amount to see what it looks like when you add noise to the shadow.

Figure 11.48Figure 11.48 The Adv. Ray Traced Params rollout allows you to set options for anti-aliasing and adding noise to ray-traced shadows.

Figure 11.49Figure 11.49 The anti-aliased shadows have softer edges.

You can set shadow color for all types of shadows independently of the color of the light. Use this feature to simulate reflected color from nearby objects or from secondary light sources such as the sky.

To set shadow color:

  1. Select a light that casts shadows (Figure 11.50).

  2. Open the Modify panel.

  3. Open the Shadow Parameters rollout.

  4. Click the Color swatch (Figure 11.51).

  5. Choose a color in the Color Selector: Shadow Color dialog box (Figure 11.52).

  6. Render the scene. The shadow changes color (Figure 11.53).

Figure 11.50Figure 11.50 The object casts a black shadow.

Figure 11.51Figure 11.51 Click the color swatch.

Figure 11.52Figure 11.52 Choosing a light-blue color.

Figure 11.53Figure 11.53 The shadow changes to light-blue.

The Density parameter sets the value, or darkness, of the shadows without affecting their hue and saturation. Use this feature to fill in shadows or to make them more transparent.

To set shadow density:

  1. Select a light that casts shadows (Figure 11.54).

  2. Open the Modify panel.

  3. Open the Shadow Parameters rollout.

  4. Set the Density value of the shadow (Figure 11.55).

  5. Render the scene. The shadow becomes darker or lighter (Figure 11.56).


To mix the color of the light with the shadow color, check Light Affects Shadow Color in the Shadow Parameters rollout.

To project a map into a shadow, check Map, click the None button, and choose a map.

Figure 11.54Figure 11.54 The object casts a shadow of Density = 1.0.

Figure 11.55Figure 11.55 Decreasing the density of the shadow.

Figure 11.56Figure 11.56 The shadow lightens.

Shadow casting is an arrangement between three parties: a light and an object that cast shadows, and an object that receives them.

If you turn off the shadow-casting property of an object, it will not cast shadows for any light.

To turn off shadow casting for an object:

  1. Open a scene that is illuminated by a light (Figure 11.57).

  2. Select an object that is casting a shadow.

  3. Right-click on the object, and choose Properties from the Transform quad menu.

  4. In the Object Properties dialog box, uncheck Cast Shadows (Figure 11.58).

  5. Click OK.

  6. Render the scene to see the results (Figure 11.59).


To prevent any shadows from falling across an object, uncheck Receive Shadows in its Object Properties dialog box (Figure 11.60).

Figure 11.57Figure 11.57 In this scene, the teapot overshadows the tube.

Figure 11.58Figure 11.58 Turning off cast shadows for a teapot.

Figure 11.59Figure 11.59 After turning off the teapot's shadow, the tube stands out.

Figure 11.60Figure 11.60 The tube stands within the teapot's shadow but is not shaded by it.

  • + Share This
  • 🔖 Save To Your Account