CAP 203 - Computer Animation III
Chapter 4: Shadows
This lesson covers material from chapter 4 of the text.
Objectives important to this lesson:
- Ray trace vs. shadow map
- Why shadows disappear
As the chapter opens, the author provides a good illustration of shadows being used in a scene for two purposes: to establish the location of the light source, and to establish a location of the floor/ground in a scene.
On page 100, compare the two rendered images of the same scene. In the top image, no shadows are being cast by any objects. The scene is fine as far as it goes, but it feels flat compared to the second image.
- In the second image, we see that the letters on the furniture store's name are 3D. Why do we see that? They cast shadows now.
- The name of the store is now obviously on an overhang. It casts a shadow as well on the window below it.
- The streetlight and the mailbox cast shadows on the brick walkway. The author is illustrating the idea that an object with no shadow looks like it is floating in the scene. An appropriate shadow below the object defines its location in the space of the scene. The shadow also defines the location of the scene's light source(s) as much as the reflections from the surface of the object.
The most immediately frustrating aspect of this chapter is that it has no accompanying folder on the data disk. We will have to use our own scenes, or make do with some from other chapters.
Pick your shadows
In the first lesson on page 102, the author shows the differences between no shadows, soft shadows, and hard shadows in the same scene.
- Open the MailboxLit scene file from chapter 3. Add a material to the plane on the floor of the scene. The plane will now be able to show a shadow. Now consider the lesson.
The idea of no shadow at all is not likely to be useful, unless this is a scene that has no light in it. That is not the case in the author's example, so the scene looks unnatural. The effect was caused by unchecking the box for Shadows for the main light in the scene. Try this to see what the mailbox looks like with no shadow.
- Turn Shadows back on for the light in the scene. Consider the illustration for step 2 on page 103. The intent in this case is to show soft, fuzzy shadows, indicating that there is one main light source, and secondary light sources as well that wash out the shadows a great deal. Create fuzzy shadows by selecting Shadow Map from the dropdown below Shadows on the light source's General Parameters rollout. The settings to adjust are now available on the Shadow Map Params rollout. Make the Size value smaller, and the Sample Range value bigger until you are satisfied with a good soft shadow.
- As the author states in the text, it is easy to get sharp shadows if you select Ray Traced Shadows on the Shadows dropdown. Switch to that setting. You can use a map instead, but the point of the lesson is to do this the easy way. Make the change, and make sure to save an electronic copy of the render for each part of this lesson.
This lesson is on pages 104 and 105. The author's tip is to use two versions of an object in a scene, a complex one to see, and a simpler version of it to cast a simple shadow. Why? Casting a complex shadow takes up more rendering time.
- In the illustration, she shows us a tree with many branches and leaves. It looks nice on the camera, but she turns off its Cast Shadows property.
- She places a simpler geometric form in the scene to stand for a the tree: a tapered cylinder for the trunk and a sphere with a noise modifier for the leaves and branches. These are allowed to cast shadows, but they have their Visible to Camera properties turned off.
- Since there is no scene for this one, learn the idea and use it in a scene of your own.
Where's the shadow?
This lesson is on pages 106 and 107. The author runs through several things that would keep a shadow from appearing in a scene.
- For each light in the scene that is supposed to cast shadows, turn on the Shadows property.
For each object that is supposed to have a shadow, turn on its Cast Shadows property.
For each object that a shadow is supposed to be cast upon, turn on the object's Receive Shadows property. Each of these should be on by default, but they could be turned off.
- Shadows can be washed out by bright lights in the scene. Two ideas: make sure that the shadow casting light is the brightest one in the scene, and try to keep the total of all light multipliers in the scene below 3.
- An object that is completely self-illuminated will not receive shadows. Don't allow an object to be too self-illuminated.
- If light will not shine through a window, check the window's Cast Shadows property. Try turning it off.
- Light sources that are too close to the ground in the scene will not cast a good shadow. Move the light source higher to get a better shadow.
- Pick one of the problems above, and apply it to a scene. A randomly selected student will be assigned to check your scene and correct the problem. It must be correctable by one of the methods above, or neither of you get credit.
What else can go wrong with shadows? This exercise is on pages 108 and 109.
- Shadow maps that are chunky, as illustrated on page 108, have too small a Sample Range. Increase the value of Sample Range.
- The illustration in this case is not clear, because we have no clear expectation of what the shadow map should look like. The tip is to adjust a shadow map's Size parameter if it looks wrong.
- This one is much easier to see. A shadow should appear connected to the object casting the shadow. If the shadow appears disconnected, change the Bias setting. A smaller value should place the shadow closer to the bottom of the object.
- This example bears some thought. If you look quickly at the images at the bottom of page 108, you may not notice the small difference between them. However, it is likely that the scene on the left would begin to feel wrong the longer you looked at it. The problem is that this is an outdoor, sunlit scene. The shadows of the two objects are not parallel. The reason they are not is explained in the text: Spot and Omni lights do not cast parallel shadows. Direct lights do cast parallel shadows. We could correct the problem by using individual spot lights for each object, casting a shadow only for that object. It would be better to use a Direct light instead to simulate the distant light of the sun.
- The lesson ends with some advice that you are probably not seeing shadows in your viewports, but you probably can choose to see them. The text tells you to click the Shading label in a viewport. This is the label to the right of the name of the viewport. Choose Lighting and Shadows, Enable Hardware Shading to see if this works with your video card.