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).
-
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).
-
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).
-
Advanced ray-traced shadows are a variation of ray-traced shadows that also use anti-aliasing to produce soft edges (Figure 11.39).

Shadow maps are the default shadow type for most lights.

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

Figure
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:
-
Open Practice02.max.
-
Render the scene to get an accurate idea of what the shadows currently look like (Figure 11.40).
-
Select a light that casts shadows.
-
Open the Modify panel.
-
In the General Parameters rollout, choose a shadow type from the drop-down list (Figure 11.41).
-
Render the scene to see the result (Figure 11.42).



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

-
BiasOffsets shadows from the object that casts them. Lowering the Bias value moves shadows closer to the object.
-
SizeControls 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 RangeControls 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 BiasDetermines 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 ShadowsCauses 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:
-
Select a light that has a problematic shadow map, such as the spotlight in Practice02.max.
-
Open the Modify panel.
-
Open the Shadow Map Params rollout (Figure 11.44).
-
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).
-
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:
-
Open Practice05.max. Then select Sun01 (Figure 11.46).
-
Open the Modify panel.
-
Open the Ray Traced Shadow Params menu.
-
Increase the Max Quadtree depth (Figure 11.47).
-
Render the scene.

Figure
11.47 Increase the Max Quadtree Depth if you have plenty of RAM.
The scene renders faster.
To anti-alias ray-traced shadows:
-
In the General Parameters rollout, convert the shadows of the Sun01 object to advanced ray-traced shadows.
-
Open the Adv. Ray Traced rollout (Figure 11.48).
-
Increase the Shadow Integrity to 5 and the Shadow Quality to 10. Then increase the Shadow Spread to 4.
-
Render the scene (Figure 11.49).
-
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:
-
Select a light that casts shadows (Figure 11.50).
-
Open the Modify panel.
-
Open the Shadow Parameters rollout.
-
Click the Color swatch (Figure 11.51).
-
Choose a color in the Color Selector: Shadow Color dialog box (Figure 11.52).
-
Render the scene.



The shadow changes color (Figure 11.53).

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:
-
Select a light that casts shadows (Figure 11.54).
-
Open the Modify panel.
-
Open the Shadow Parameters rollout.
-
Set the Density value of the shadow (Figure 11.55).
-
Render the scene.


The shadow becomes darker or lighter (Figure 11.56).

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:
-
Open a scene that is illuminated by a light (Figure 11.57).
-
Select an object that is casting a shadow.
-
Right-click on the object, and choose Properties from the Transform quad menu.
-
In the Object Properties dialog box, uncheck Cast Shadows (Figure 11.58).
-
Click OK.
-
Render the scene to see the results (Figure 11.59).



TIP
To prevent any shadows from falling across an object, uncheck Receive Shadows in its Object Properties dialog box (Figure 11.60).
Figure
11.60 The tube stands within the teapot's shadow but is not shaded
by it.