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

Home > Articles > Design

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

Casting Shadows

There are four types of shadows that you can assign to 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 (Figure 11.36).

  • Figure 11.36Figure 11.36 Shadow-map shadows have soft edges.

    Shadow maps are the default shadow type for most lights.

  • Area shadows simulate shadows that are cast from an illuminated area or volume. They use anti-aliasing to produce soft, atmospheric shadows (Figure 11.37).

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

  • Ray-traced shadows are more precise and sharp-edged than shadow-map shadows. They are calculated by tracing a ray from source to object. Use ray-traced shadows whenever you need to precisely locate shadows, such as in shadow studies for architectural siting (Figure 11.38).

  • Ray-traced shadows are the default type for sunlight systems.

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

  • Advanced ray-traced shadows are a variation of ray-traced shadows that also use anti-aliasing to produce soft edges (Figure 11.39).

  • 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 get an accurate idea of what the shadows currently look like (Figure 11.40).

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

  4. Select a light that casts shadows.

  5. Open the Modify panel.

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

  7. Figure 11.41Figure 11.41 Changing the shadow type to ray-traced shadows.

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

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

TIP

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.

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):

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

  • 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. Figure 11.44Figure 11.44 The Shadow Map Params rollout provides the means to correct shadow maps.

  5. 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. To make the gap between the teapot and its lid disappear, check 2 Sided Shadows (Figure 11.45).

  6. 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.

  7. Save the scene.

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 5 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. Figure 11.46Figure 11.46 This sunlit scene has ray-traced shadows that are slow to render.

  3. Open the Modify panel.

  4. Open the Ray Traced Shadow Params menu.

  5. Increase the Max Quadtree depth (Figure 11.47).

  6. Figure 11.47Figure 11.47 Increase the Max Quadtree Depth if you have plenty of RAM.

  7. Render the scene.

  8. The scene renders faster.

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. 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.

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

  5. Render the scene (Figure 11.49).

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

  7. 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.

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. Figure 11.50Figure 11.50 The object casts a black shadow.

  3. Open the Modify panel.

  4. Open the Shadow Parameters rollout.

  5. Click the Color swatch (Figure 11.51).

  6. Figure 11.51Figure 11.51 Click the color swatch.

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

  8. Figure 11.52Figure 11.52 Choosing a light-blue color.

  9. Render the scene.

  10. The shadow changes color (Figure 11.53).

    Figure 11.53Figure 11.53 The object now casts a light-blue shadow.

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. Figure 11.54Figure 11.54 The object casts a shadow of Density = 1.0.

  3. Open the Modify panel.

  4. Open the Shadow Parameters rollout.

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

  6. Figure 11.55Figure 11.55 Decreasing the density of the shadow.

  7. Render the scene.

  8. The shadow becomes darker or lighter (Figure 11.56).

    Figure 11.56Figure 11.56 The shadow lightens.

TIP

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.

Shadow casting is an arrangement between two parties: Both the light and the object have to be set to cast shadows before shadows will be rendered. 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. Figure 11.57Figure 11.57 In this scene, the teapot overshadows the tube.

  3. Select an object that is casting a shadow.

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

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

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

  7. Click OK.

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

  9. Figure 11.59Figure 11.59 Turning off Cast Shadows for the teapot.

TIP

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

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