Shadow Types Shadows help tie your geometry to the surfaces in your scene. They give the impression of density and size and help the viewer understand the positional relationships between all the objects in the scene. There are a few different types of shadows available in 3ds max, each with its own benefits and drawbacks.- Shadow map shadows are images (bitmaps) that are generated by the Default Scanline Renderer prior to the actual rendering and are then applied to your scene. The renderer calculates the distance from the light to the objects on its path to determine which objects obstruct the rays of light. Any surfaces beyond the obstruction do not receive any illumination. These shadows use more RAM than the other shadow types, but they do have soft edges, are reasonably quick to render, and are the default shadow type for most lights found in max.
- Raytraced shadows are determined by tracing the path that each light ray follows, whether it passes through an object or not. Raytraced shadows are more accurate than shadow map shadows but take longer to calculate. Raytraced shadows have hard edges along their perimeters and are the default shadow type for the Sunlight system.
- Advanced raytraced shadows are similar to raytraced shadows in the method that they use to calculate the shadow area, but they also have anti-aliasing controls to manage how the shadow edges appear in the scene. This allows raytraced shadows to have softer edges, similar to shadow map shadows, while retaining the greater accuracy of raytracing.
- mental ray shadow maps are used with the mental ray renderer. They are not as precise as raytraced shadows but render fast, thereby decreasing the time it takes to render a scene.
- Area shadows give the impression that the light source is generated by a surface, such as a diffusing cover, rather than by a single point. This spreads the shadows over a larger area, with a large variance between the dark and light areas. Area shadows can provide results not achieved by the other shadow types but may greatly increase your rendering time.
Shadow Maps Open the file entitled Shadows Start.max from the DVD. This is a simple interior corner with a potted plant and a rough opening for a window that we'll deal with later. Two lights are already placed and oriented in the scene: a directional light coming through the window and an omni light providing fill light to illuminate the inside walls, the floor, and the right side of the plant. We're going to adjust the shadows to make the scene more appealing.
1. | Make sure the Camera01 viewport is active; then render the scene. The directional light washes out the right wall and does not cast any shadows from the left wall (Figure 12.17).Figure 12.17. Our interior corner shows no shadows being generated by either light.
 | 2. | Select the directional light, then open the Modify panel. In the General Parameters rollout, click the On check box in the Shadows area (Figure 12.18). Notice that Shadow Map is the chosen shadow type. This will force the light to consider the left wall and window opening in the shadow calculations. Render the Camera01 viewport to see how this looks.Figure 12.18. Shadow Map is checked On in the General Parameters rollout.
Even these quick and basic shadows make a world of difference in the scene (Figure 12.19). The illumination of the right wall, except the area lit by the light through the window, now matches that of the left wall, which is lit only by the omni light. The shadows cast by the tree are much too pixelated (low in resolution) and need to be smoothed out a bit.Figure 12.19. The interior corner with a shadow map generated by the directional light.
 | 3. | With the directional light still selected, expand the Shadow Map Params rollout (Figure 12.20). The Size value refers to the image size, in pixels, of the map applied to the shadowed area. Larger Size values result in finer, more detailed shadows, at the cost of higher RAM consumption. The Sample Range determines the softness of the shadow's perimeter. Higher Sample Range values will result in softer shadow edges. Set the Size value to 1024 and the Sample Range value to 5, then render the scene again (Figure 12.21).Figure 12.20. The Shadow Map Params rollout.
 Figure 12.21. The interior corner with the Shadow Map Size and Sample Range values increased to soften the shadows.
The shadows are much finer now, especially near the top of the tree where the fronds are spread out. | 4. | The directional light in this scene represents sunlight. What if the light coming through the window comes from a car's headlights or a spotlight? Go back to the General Parameters rollout, and in the Light Type section, expand the drop-down and choose Spot to convert your directional light to a spotlight with the same parameters. The new shadows are more spread out than before because of the divergence of the spotlight rays (Figure 12.22). Notice how long the shadow from the top of the pot has become and how the area illuminated by the window is now expanded to an area outside the image.Figure 12.22. The spotlight generates shadows that are more spread out than the shadows produced by the directional light.
 | 5. | Switch the light back to a directional light. | 6. | Right-click in the viewport and choose Unhide by Name from the Quad menu. In the Unhide Objects dialog, choose CasementWindow01, then click Unhide to reveal the hidden window linked to the wall (Figure 12.23). Render the scene again.Figure 12.23. The corner scene with the window revealed. No illumination is coming from the window.
 |
Where have the light and shadows gone? As mentioned earlier, shadow maps are calculated by determining which objects obstruct the light rays and will not illuminate any surface beyond those objects. In the current case, the light rays encounter the window and stop projecting beyond that. Shadow maps do not consider the opacity or opacity-mapped features of an object when determining the shadowed area. One solution is to instruct max to disregard the glass panels. To do that, we'll need to detach them from the window.
1. | Select the window and apply an Edit Poly modifier to the top of the modifier stack. | 2. | Activate the Polygon sub-object level. In the Modify panel's Polygon Properties rollout, enter 3 in the Select ID field, then click the Select ID button. This will select the 12 polygons that make up the glass panels (Figure 12.24). Click the Settings button next to the Detach button in the Edit Geometry rollout and name the new object Glass Panels.Figure 12.24. Select the two glass panels (12 polygons) and detach them from the rest of the window. [View full size image] Note | The glass panels are no longer a part of the CasementWindow object. If you go lower in the stack and adjust any values (Open, Width, and so on) at the object's base level that change the layout or position of the window, the panels will not be included. If the window must be animated to open and close, consider breaking the panels into separate left and right objects and using an Attachment controller to keep them in place. |
| 3. | Exit the Polygon sub-object level. Select the directional light; then, in the General Parameters rollout, click the Exclude button to open the Exclude/Include dialog (Figure 12.25). The Exclude/Include dialog tells the light which objects it should or should not illuminate and which objects it can use to cast shadows. Highlight the Glass Panels entry in the left window, then click the ">>" button to move it to the right window. Make sure Exclude is selected in the top right corner, as well as Shadow Casting. The directional light will now illuminate the glass surfaces, but they will not generate shadows.Figure 12.25. Set the Exclude/Include dialog to disregard the glass panels when generating shadows from the directional light.
 | 4. | Render the scene one more time. You'll see that the glass panels are now ignored and the light passes through them and onto the tree and wall (Figure 12.26).Figure 12.26. With the glass panels excluded from receiving shadows, the light now properly hits the wall and tree.
 |
Raytraced Shadows Open the file entitled Shadows Raytraced.max from the DVD. This is the scene you were working on just prior to detaching the glass panels.
1. | Select the directional light, and change its shadow type from Shadow Map to Ray Traced Shadows. Activate the Camera01 viewport, and render the scene. The shadows from the tree and the window opening are much sharper than in the previous renderings (Figure 12.27).Figure 12.27. Using Ray Traced Shadows as the directional light's shadow type allows the opacity of the glass panels to be reflected in the shadows.
Even with a reflective floor, this corner is still too dark. The main light is coming through the window, but the left wall is blocking the majority of the illumination, causing that wall's shadows to be cast onto the right wall. Let's lighten the room up a bit. | 2. | In the Modify panel, open the directional light's Shadow Parameters rollout. Click the color swatch; then, in the Color Selector, choose (122, 122, 122), a medium gray. Render the scene (Figure 12.28). The shadowsand, as a result, the room in generalare a little lighter.Figure 12.28. Lowering the shadow color to a medium gray yields lighter shadows and brighter reflections from the floor and walls. [View full size image] Ray Traced Shadows can pick up the color from translucent objects and filter that color into the scene. This works with images and simple colors applied to those objects. | 3. | Open the Material Editor and select the Window material. In the Multi/Sub-Object Basic Parameters rollout, click the Panels button to open the parameters for sub-object 3, which controls the glass panels. In the Blinn Basic Parameters rollout, click the Diffuse color swatch and choose a pale blue color such as (176, 166, 251). Open the Extended Parameters rollout, and drag and drop the Diffuse color swatch onto the Filter color swatch. Choose Copy in the dialog that opens (Figure 12.29). Render the Camera01 viewport, and compare your results (Figure 12.30).Figure 12.29. Copy the panels' diffuse color to the filter color in the Material Editor.
 Figure 12.30. The Panels submaterial's filter color is passed through the window and into the scene.
Tip | The Reflectance and Transmittance information, shown in the Material Editor in Figure 12.29, can be activated under the Radiosity tab of the Preference Settings dialog. |
| 4. | In the Material Editor, select the Window With Color material and apply it to the CasementWindow object. This is the same as the Window material, but with a map applied to the Diffuse Color map channel. Render the scene. The map appears in the windows, but the color is not carried onto the wall because the Filter color is not yet set to accept the map. | 5. | Open the Maps rollout, then drag and drop the Diffuse Color map button onto the Filter Color map button and choose Instance in the Copy (Instance) Map dialog. To help bring out the stained glass borders, darken the shadow's color in the Shadow Parameters rollout. Then render the scene. Figure 12.31 shows the scene with the mapped panels' colors being filtered onto the wall and the plant.Figure 12.31. The window panel colors are now filtered into the scene.
 |
Be aware that the Advanced Ray Traced Shadows feature, although faster than Ray Traced Shadows, does not consider the filter color when rendering a scene.Area Shadows Open the file entitled Shadows Area.max from the DVD. This is similar to the previous scene, but an omni fill light has been converted to a target spotlight with its shadows enabled. (This spotlight is still named Omni01.) We are going to use area shadows to give the impression that a diffuse light source, possibly reflected light from the opposite walls, is entering the scene and illuminating the plant and walls. The shadows cast from this light will help anchor the pot to the ground and solidify its location in the scene.
1. | Render the scene to get a good reference image before we start changing the light's parameters. The spotlight casts shadows from the plant and pot onto the walls and floor. In the Rendered Frame Window, click the Clone Rendered Frame Window button to create a copy to compare with future renderings. | 2. | Select the spotlight (Omni01) and change its shadow type from Shadow Map to Area Shadows. Render the scene. You'll notice that your render times have increased and that the shadows from the tree are more diffuse than before but much too pixelated to be appealing. Figures 12.32 and 12.33 show the scene before and after area shadows were applied.Figure 12.32. The corner of the scene before selecting Area Shadows. [View full size image] Figure 12.33. The corner of the scene after selecting Area Shadows. The inset shows the shadows' pixelation. [View full size image] | 3. | In the Modify panel's Area Shadows rollout, expand the drop-down list in the Basic Options section and ensure that Rectangle Light is selected. This will create the shadows as if the light source were a plane rather than a point. Increase both the Length and Width in the Area Light Dimensions section to 5 feet 0 inches. | 4. | The soft area around the shadow's perimeter, called the penumbra, showcases the versatility of area shadows. Controls for Area Shadow settings are located in the Antialiasing Options rollout. Set the Shadow Integrity to 10 to increase the number of rays that are cast from each shadow-casting surface to each shadow-receiving surface. Increase the Shadow Quality value to 15 to raise the number of rays cast into the penumbra; this defines its edges more accurately. Set the Sample Spread to 4 to soften the edge a bit, and set the Jitter Amount to 0.4 to change the structured initial ray locations to a more random pattern. This will cause artifacts that have been created to be converted into less noticeable noise in the shadows (Figure 12.34).Figure 12.34. The tweaked area shadows.
 |
As you render your scene one more time, you'll notice that the render time has increased again. This is the tradeoff between the quality of area shadows and your production efficiency. Compare this rendering to the one that you saved earlier. |