Lighting Environments and Architecture in Animation
- Creating Daylight
- Working with Indoor Natural Light
- Practical Lights
- Night Scenes
- Distance and Depth
- Exercises
To light natural environments and architectural spaces, you need to be aware of the environment around you. Direct light from the sun, soft illumination from the sky, and indirect light blend their colors and tones in subtle ways. This chapter discusses how you can use these three elements to simulate natural light outdoors and indoors, by day or by night. Different kinds of artificial light, from flashlights to desk lamps to streetlights, require equal care to simulate realistic throw patterns and illumination in your scene. You can use atmosphere, from fog and dust in the air to thicker participating media for underwater scenes, to help convey how light travels through space in your environment. Finally, with global illumination (GI) you can simulate how all of these lights are transmitted from one surface to another, filling your scene with indirectly bounced light. This chapter explores not just how to light with natural and artificial light sources, but how to simulate indirect lighting with or without GI.
Creating Daylight
You can create a simple outdoor lighting setup by adding three elements to your scene: direct sunlight; soft fill light representing light from the sky; and indirect light, simulating light that has bounced off of surfaces in your environment. When you put these three elements together, you can simulate outdoor light at any time of day. This section will explore these three elements and the choices you need to make when creating them.
Adding Sunlight
Think about your scene. What time of day is it? Is there direct sunlight? You’ll want to address the sun first, because the sun will be your key light—the most important, main light that defines your scene. If sunlight is visible at all, it is often the brightest light in your scene and tends to cast the most visible shadows. You determine the angle of the sun depending on the time of day you are trying to re-create, but remember that your audience doesn’t usually know whether the camera is facing east or west, so you have enormous creative latitude in picking an angle for the sun that lights your scene well.
Most of the time, you will use a directional light as the type of light source for the sun. Remember from Chapter 2 that a directional light casts all light and shadows in parallel, which is appropriate for sunlight. If you are using a directional light to cover a full scene with sunlight, you should probably use raytraced shadows to make sure that accurate shadows can be cast by everything in the scene.
Sunlight does not need any decay or attenuation based on distance. The light has already traveled about 150 million kilometers (93 million miles) from the sun to reach your scene, so it is unlikely to wear out appreciably in the last few meters.
Make the sun a yellow color for most of the day; turn it orange or red only during sunrise or sunset. If you test-render your scene with just the sunlight and no other lights, it will appear very yellow and stark, as in Figure 4.1. Before you add any other lights, make sure that you are completely happy with which areas of the scene are in sun and which aren’t. In this example, I pivoted the sun around until the statue’s head was lit by sunlight and the light came from the side, to bring out the shape of the face instead of flattening it with frontal lighting.
[Figure 4.1] Sunlight by itself looks yellow and is full of contrast. Here, the sun angle is adjusted to light the main subject well.
Adjusting Raytraced Shadows
The shadows from the sun are the most important shadows in an outdoor scene. Be sure to adjust and test-render the sun shadows, and make sure you like their shape and direction, before you move on to add any other lights.
Shadows from the sun are not completely sharp. Think of the sun as an area light that casts slightly soft shadows. The sun usually fills an area of about 1% of the sky around us, but the shadows from the sun can become considerably softer on a hazy day or around sunset, so you may use values between 1 and 5 degrees for the shadow’s light angle.
It is best to leave the shadow color parameter of your sunlight set to pure black. You can add a blue cast to the shadow areas later, when you fill in the scene with skylight.
Using Depth Map Shadows
If you are using depth map shadows, you may need to approach setting up sunlight differently. In order to focus a depth map around an appropriate area, you may choose to use spotlights instead of a directional light.
If you use a spotlight to represent the sun, you need to translate the light a large distance away from the rest of the scene so that the shadows it casts will appear parallel. After you accomplish this, set the spotlight cone to a very narrow cone angle so that it only covers the area where its light and shadows are visible in the scene.
One advantage of this approach is that it is easy to aim cookies from a spotlight. If you want a cookie in the sun—to simulate dappled light shining through tree leaves, for example—you can aim and adjust that cookie by moving the light.
One spotlight might not be enough to cover a large area, however. Stretching a depth map over too broad an area can cause it to lose accuracy. If you want to work efficiently with depth maps in cases like this, sometimes you must represent the sun with an array of spotlights, and each must provide light and shadows to one region of the scene. Using multiple depth maps, each with a reasonable resolution such as 1024 or 2048, is usually more efficient than cranking up the depth map resolution above 4096 or 8192.
In some environments you may have no choice but to use depth maps. Complex elements such as grass, fur, or vegetation greatly add to render times and memory use if you try to render them in raytraced shadows. Depth maps can shadow this kind of subject matter more efficiently. Specialized types of depth maps in some renderers, such as the deep shadow maps in RenderMan and the detail shadow maps in Mental Ray, are optimized for shadowing fine details such as hair and grass.
Adding Spill from the Sun
It is often a good idea to use a second light to represent the spill from the sun. After you have your main sunlight set up and you have test-rendered it to make sure you like what it illuminates and where it casts shadows, you can duplicate a second copy of the sunlight and rename it to become a spill light. Don’t rotate the spill light; leave it aimed the same direction as the main sunlight. Set the spill to have much softer shadows than the sunlight so that it spills out beyond the edge of the sunlight into shadow areas, and make the spill dimmer than the sunlight itself.
In some scenes, it is useful to give the spill a richly saturated color. Around sunset, the sun itself might be an ordinary yellow, but the spill could be a rich red or deep orange. In some midday scenes, the sun is so bright that it should appear overexposed and desaturated; in these cases your sun’s color might be a pale yellow or appear almost white. If you give the spill light a more saturated color than the sun itself, then the overall impression created by your scene will be that the sunlight has a warm tone.
Figure 4.2 compares the scene from Figure 4.1 with sunlight only (left), and with both sunlight and spill light together (right).
[Figure 4.2] Sunlight by itself (left) leaves more of the scene in black shadow. Adding a spill light (right) fills in the edges of the shadows with a warm glow.
Visually, adding a spill light around the sun extends the sunlight into more angles and helps it wrap further around round objects. Because shadows get softer the farther they are cast from the subject, you can still have black shadows close to the objects that cast them, but shadows cast from more distant objects are more filled in. Overall, having spill light around the sun can add both richness and realism to your scene, compared to the starkness of having sunlight that is not visible at all beyond the edge of the shadows.
Adding Skylight
The soft blue light from the sky is another main aspect of your outdoor lighting. It helps to test-render the sky illumination by itself, with the sunlight and sun spill hidden, before you start to put them all together. A single dome light, as discussed in Chapter 2, is usually the best way to simulate sky illumination in an outdoor environment. The left side of Figure 4.3 shows the scene lit entirely by a dome light.
[Figure 4.3] Sky illumination from a single sky dome softly fills the entire scene (left), whereas adding a kick light (right) adds definition to the shadow side of the objects.
You can map the dome light with gradients to create shaping and variety in your sky illumination. Often a gradient runs from a lighter blue at the horizon up to a deeper, darker blue at the top of the sky. This simulates a bit of haze that makes the sky look brighter and less saturated near the horizon. Often you want a second gradient to run from the bright side of the sky (where the sun is) toward the darker side of the sky. This adds more variety to sky illumination.
In some programs, the sky dome is just the top half of a sphere and does not include the portion of the sphere that would be underground. In other programs, dome lights wrap all the way around your scene, with half of the dome below the ground. Because the ground shadows any illumination that comes from below it, the color of the bottom half of the sphere shouldn’t make a visible difference in your scene. However, you can map the bottom half of the dome to black to prevent potential light leaks if you have holes in your geometry, and possibly to save rendering time in some renderers in case the renderer is optimized to take more samples toward brighter parts of the dome light.
Including an Extra Kick from the Sky
Sometimes you can add more shaping to your scene by augmenting your sky illumination with an extra light. You can use a directional light, set up just like the spill light from the sun, or you can add a spotlight if you want to be able to aim it and focus it on one area. You might give this extra light a blue or gray color, matching whatever colors you see in the sky. This technique not only adds an extra kick of illumination that comes from the sky behind your subject, often on the opposite side from the sun, but it also adds variety and shaping to the side of a subject that isn’t lit by the sun and sun spill, as shown on the right side of Figure 4.3. Notice how the dark sides of the statue and columns are better defined when the kick is added.
Let’s make all of our lights visible now, as shown in Figure 4.4. We now have two directional lights in the same place for the sun and the sun spill (shown in the lower right), a dome light for the sky, and another directional light for a kick from the sky.
[Figure 4.4] This wireframe view shows the sunlight and sun spill (lower right), the sky dome, and the kick from the sky (upper left) positioned around the scene.
Adjusting Color Balance
In a sunlit scene, the warm color of the sun and the cool color of the sky should balance out so that they appear almost white where they overlap. Areas where the sun is blocked so that you see only skylight may look blue. If you render your scene with the sun and all of your skylights visible, you can see the overall color balance of your scene.
You might want a golden yellow overall tint for your scene for a late afternoon or sunset, or a blue tint for dusk or a gloomy overcast day. For a normal daylight balance, however, you don’t want your full scene to look blue tinted or yellow tinted overall. You may need to go back and adjust the sun’s brightness or color to achieve a natural-looking balance and make it cancel out the blue of the sky.
Figure 4.5 shows the result of rendering with the sun, the spill from the sun, and the sky illumination, all together. Although it still lacks the bounce light that will tie it together, you can see the overall daylight look already appearing in the image.
[Figure 4.5] Sunlight and skylights are combined to create balanced daylight illumination.
Adding Indirect Light
The sunlight and skylights give you most of your illumination, but a realistic daylight scene also requires indirect or bounce light. Light that reflects off the ground and other surfaces back up into the scene is called indirect light because it doesn’t come directly from a light source. Where sunlight and skylight illuminate the ground and other surfaces in your scene, the brightly lit surfaces themselves need to act like light sources. If light has bounced off the ground, then in many scenes most of your indirect light is aimed upward from the ground, illuminating the bottom of other objects.
You have two basic choices for how to simulate indirect light in your scene. You can add your own bounce lights to simulate indirect illumination, or you can use GI to simulate indirect illumination for you. GI adds indirect illumination to your scene automatically, so you don’t need to add any more lights as bounce lights. However, this type of illumination also takes a lot longer to render, especially for scenes like this example that feature grass and vegetation. We’ll come back to GI later in this chapter. For now, the straightforward approach to simulating indirect illumination in this scene is to add some bounce light, aimed upward at the scene through the ground, as shown in Figure 4.6.
[Figure 4.6] Bounce lights (shown in yellow) shine up through the ground to simulate indirect light.
The bounce light makes the biggest difference on the bottoms of objects, brightening up the surfaces that face the ground. Figure 4.7 shows the difference that bounce light adds, if you compare the scene without bounce light to the scene with bounce light.
[Figure 4.7] Adding bounce light (right) fills in the dark bottom surfaces of objects and visually connects the light colors from the sun and the sky.
To simulate indirect light, you need to make some delicate adjustments:
- Most of the time, you should set bounce lights not to emit any specular illumination; you don’t want unmotivated specular highlights to appear on the bottom of objects.
- Give your bounce lights colors similar to whatever surface motivates the indirect light. For example, to simulate light reflected off of a green lawn, use a green light.
- To simulate light bouncing off of the ground, position your bounce lights underneath the ground, aimed upward. Use light linking or shadow linking to make sure the ground itself doesn’t shadow the light.
- Sometimes bounce lights don’t need to cast shadows. If your bounce light casts shadows, then the shadows should be very soft and indistinct. Check inside the mouths, noses, and ears of characters to make sure you don’t have unshadowed bounce light visibly shining through them.
- In most scenes, you need more than one bounce light, with different angles and different colors. Even if there’s only one ground color, you can use different colors based on the colored lights that hit the ground. For example, if yellow sunlight and blue sky fill both illuminate the grass, then you can have a yellow-green light and a blue-green light bouncing back from the grass onto the rest of the scene.
- Whereas most bounce light in many scenes is light aimed upward, you can actually aim bounce lights in any direction. If bright light is aimed at a wall, you can add a bounce light simulating light bouncing off of that wall. If a floor lamp is aimed up at a ceiling, you can aim a bounce light from the ceiling down onto the rest of the scene.
Because bounce lights are dim and subtle, it’s usually a good idea to hide all of your other lights and test-render an image with only the bounce lights so that you can see that they uniformly cover the surfaces of your scene. Make sure you don’t see any harsh shadows or sharp highlights in your bounce lighting, because that would give away the illusion that it comes from indirect light reflecting off large surfaces.
Alternate Approaches
You can simulate sky illumination in three alternative ways in modern software: You can simulate the sky with an array of lights coming from different directions instead of using dome lights; you can use a unified sun and sky shader that is available in many programs; or you can use image-based lighting to illuminate the whole scene with a High Dynamic Range Image (HDRI).
Doing Without a Dome Light
If your renderer doesn’t support dome lights, or you want a solution that renders faster, use a set of multiple lights to simulate sky illumination.
Start with a directional light that casts very soft raytraced shadows (a light similar to your spill light), but give it a blue color. Test-render your scene and see how it looks with one skylight; then duplicate the light so that lights illuminate your scene from all directions. In an open scene you probably need between four and eight lights to represent fill from the whole sky. Figure 4.8 shows a collection of directional lights arranged to simulate sky illumination.
[Figure 4.8] As an alternative to a sky dome, add several directional lights around the scene.
The lights don’t need to have the same brightness and color. You can vary the brightness and color of the lights so that the sun side of the sky is brighter, and the darker side of the sky is a more saturated blue. The lights don’t need to be spaced at equal angles, either. Adjust them however they look best in your particular scene. If you see any visible edges to shadows, use softer shadows, or add more directional lights from more angles, to fill in the unlit areas.
Unlike when you use a dome light, using an array of directional lights does not look very good on shiny or reflective objects. If you used six directional lights to simulate light from the sky, you don’t want six bright highlights to appear on each shiny object. If you have any shiny, reflective objects in your scene, your best bet is to set the lights not to emit specular illumination and then use a separate environment map for their reflections.
For the very cheapest results, you can use an array of spotlights with depth map shadows instead of directional lights with raytraced shadows. This may not look as natural as other approaches, especially for wide-open scenes surrounded by sky, but it can render very quickly without raytracing. And in situations where only a smaller amount of sky is visible, such as within a canyon, a few spotlights may be all you need to create some sky illumination.
Sun and Sky Shaders
Available at the click of a button in many programs, linked sun and sky shaders allow you to create a sunlight and sky fill all in one step. These shaders simulate many effects for you automatically. For example, when you move the sunlight lower in the sky, it automatically changes color to simulate the color of the setting sun, and the sky’s color and brightness changes to match it.
When choosing approaches to lighting, you need to think ahead, beyond the first version that you render. After you render version one, chances are that you will need to show your work to your client, creative lead, director, or art director. At that time, you will get notes on how to proceed to the next version. Even if physically based sun and sky shaders saved you time on lighting the first version, they can sometimes limit your ability to adapt to art direction after that. For example, if you are asked to make the sun a little pinker as it sets, it’s easier to directly adjust the RGB color of a light than to look through options labeled “Turbidity” and “Ozone” and adjust them to see how the sun’s color happens to respond. Time saved up-front on an easy, preset setup does not always speed up your overall workflow in the long run.
Image-Based Lighting
Image-based lighting (IBL) provides an alternative approach to simulating skylight. With IBL, you map an image to a sky dome surrounding the scene, and the colors and tones from that image are used to illuminate the scene. Figure 4.9 is a test-render of the scene lit only by a texture map of a sky and clouds.
[Figure 4.9] This test-render shows a scene lit entirely by IBL instead of lights.
When you use a High Dynamic Range Image (HDRI) format, all of the colors and tones from a real environment can be included in one map for IBL. A huge range of HDRI maps are available for free or for low prices over the Internet, or you can make your own. (Chapter 6 describes how to make your own HDRI.)
IBL holds the promise of great convenience and realism if you happen to have a texture map that perfectly matches the environment you are simulating. IBL also lets you use whatever map you make to represent the environment in reflections, potentially increasing the realism of any shiny or reflective objects in your scene.
In a few ways, it is possible to adjust the lighting on a scene lit by IBL: You can adjust the overall diffuse and specular brightness emitted from your dome light; you can rotate the whole map around to face a different way; you can adjust its overall tint; and you can add conventional lighting to it, aiming extra lights into the scene wherever the illumination from the IBL itself doesn’t meet your needs. However, lighting your whole scene based on a premade map is still creatively limiting compared to lighting your scene with fully adjustable individual lights. As with the sun and sky shaders described earlier, sometimes taking this approach makes it easy to create the first version of your lighting, but makes it more difficult to iterate your scene into different versions and adapt your lighting based on creative notes from the director or art director.