Sometimes you want more creative control over your lighting than regular shadows and occlusion can provide. This section discusses some handy cheats and tricks to help you create "fake shadows"—things that look like regular shadows or occlusion, but really aren't. These techniques will give you more ways to control the shape and location of your shadow and will even save rendering time.
Negative lights, which are simply lights with their intensity (also called brightness or multiplier) set to a negative number, can be useful tools for darkening parts of your scene. For example, if you wanted to softly darken a corner of a room or the area underneath a table without using any soft shadow or occlusion techniques, you could just put a negative light in the area you wanted to darken. As shown in Figure 3.31, the negative light will suck the light out of that area.
Figure 3.31 A light with a negative intensity (left) under the table makes a difference between the area looking too bright (middle) and extra darkness (right).
Generally, a negative light should not be set to cast shadows, nor should it emit any specular light; negative specular highlights would be unnatural black dots. If you want to add a colored tint to the area, remember that the light color specifies the color that will be subtracted, not added, so you may need to set the light to a complementary color of the tint you'll see in the scene. For example, to darken an area and give it a blue cast, you'd set the negative light's color to yellow.
You can use almost any type of light as a negative light; a simple point or omnidirectional light can work well. Remember that these lights are still emitting their negative light from a specific point, however, so just like a positive light, they will affect the surfaces facing them, not surfaces facing away from them. For example, a negative point light might not work well to darken the interior of a character's mouth, because from the center of the mouth it would hit the insides of the teeth, not the outsides of the teeth.
Negative spotlights can be handy for aiming at a specific area of the ground you want to darken with something that looks like a soft shadow. They can even be constrained or grouped to move with vehicles and characters for this purpose. For this kind of use, you'll typically want to use light-linking to light the ground with the negative light exclusively, not light the objects above the ground that motivate the fake shadow.
In Maya, there is a kind of light called a volume light, which seems ideal for negative lighting. A volume light influences only the area within its own radius, or within a selected shape such as a cube or cylinder, so you can scale the light to surround the exact region you want to darken. With a volume light, you can turn off the Emit Diffuse and Emit Specular options, and use only Emit Ambient. This means it will softly darken every surface in the region, without any regard to whether a surface is facing towards the light or away from it.
Sometimes you want to add a shadow to your scene, but you don't want to add any light along with it. Most 3D packages enable you to create a shadows-only light, a light that doesn't brighten anything, but adds only an extra shadow. Yet this functionality exists as a hack or cheat you can set up, not a clearly labeled option.
In many programs, you can create a shadows-only light by sliding the light color down to pure black and setting the shadow color to a negative value, as shown in Figure 3.32.
Figure 3.32 In Mayavolume lights, negative lightsMaya, you can create a shadows-only light by giving a light a black color and a negative shadow color.
In 3D Studio Max, you aren't allowed to set a color to a negative value, but an alternate technique for making a shadows-only light is to set the light's color to black, the shadow color to white, and the shadow density to -1, as shown in Figure 3.33.
Figure 3.33 A shadows-only light in 3D Studio Max uses a black light color, white shadow color, and a shadow density of -1.
If your software does not support either of the techniques above, there's an alternate way to create an identical effect. This works in any program that supports negative lights: Start with two copies of a spotlight in the same place. Give the first light a positive intensity of 1 and set it to cast shadows. Give the second light a -1 intensity but do not set it to cast shadows. As a pair, the first light will add illumination (except where it is shadowed); the negative light will subtract all of the illumination added by the first light, effectively canceling it out, but will also take light away from the area where the first light was shadowed.
Shadows-only lights can be tremendously useful if you want to control the exact size, angle, and perspective of your shadow without changing the lighting of the scene. You can even light the scene with several lights that don't cast shadows—such as the red, green, and blue lights in Figure 3.34—and then use a shadows-only light to add a single, consolidated shadow to an object, thus avoiding shadow clutter.
Figure 3.34 Multiple shadows (left) can be replaced by a single shadows-only light (right).
Objects in most programs can be adjusted to cast shadows or not, whether or not they are directly visible in the render. This means that you can always add extra objects to your scene that cast shadows but are otherwise invisible. These are called shadow objects.
If you want to make an extra shadow, fill in gaps in an existing shadow, or plug any kind of light leak, adding a shadow object (which could be a primitive cube) can be a simple approach. Shadow objects are also handy if you plan to do any compositing. For example, if a real car were going to be composited into a 3D environment, you might add a shadow object the shape and size of the car to create proper shadows in the scene.
Shadow objects provide a marvelous degree of creative freedom that goes beyond the control a photographer or cinematographer would have when shooting in real life. Cinematographers use all sorts of blockers, flags, and other objects to cast shadows and control where a light can shine, but they have to put them in places that will not also be visible in the scene or block the camera. With shadow objects, you can shadow or block any light from any angle or position you want, and the surfaces you add to block the light will never appear in your rendering by accident.
You can also make a pair of two objects in the same place, with one being a shadow object (casting shadows but not directly visible) and the other being the regular object that will appear in the rendering but not set to cast shadows. Figure 3.35 shows an example of this: Because the regular object is a flat card textured to look like a tree, the shadows it would cast from the side would be very thin and un-tree-like. By turning off the tree card's shadow casting and adding a shadow object that is rotated toward the light, acceptable shadows can be cast.
Figure 3.35 A shadow object (green) helps cast a shadow from the side of the flat card textured as a tree.
Baking lighting is a process of computing all of the light and shadows that hit a surface and storing it as a texture map. Programs have different names for the functions that bake lighting, sometimes calling it "render to texture" or "convert to file texture." Once illumination has been baked into texture maps, the surface can be rendered very quickly, because lighting and shadows do not need to be calculated.
As an example of baking, suppose that you wanted a soft shadow of a shelf to appear a wall, as shown in Figure 3.36. Rendering a good-quality soft shadow from an area light takes a significant amount of rendering time, so you might not want to do that at every frame of an animation. Instead, the lighting and shadows can be baked into a texture map that gets applied to the wall.
Figure 3.36 A soft shadow does not need to be recomputed for every frame if it can be baked into a texture map.
Once converted into a texture map, as in Figure 3.37, the rendered lighting appears the same, even if the area light isn't present. The only downside is that the shadow would not change automatically if the lighting changed or something on the shelf moved.
Figure 3.37 A texture map on the wall stores a baked shadow.
Be careful about baking anything onto moving characters. The end result of a light-baking process is lighting that essentially seems "painted on" to surfaces. If the surface were on a moving character, the light would turn and move with the character instead of reacting to the lights in your scene. In fully rendered projects, baked-in occlusion should be limited to specific areas where you are sure you will want darkening throughout the whole production, such as the throat and nostrils.
For real-time games, a much greater amount of lighting, shadows, and occlusion is integrated into character textures, because it is often the only way possible to achieve certain looks. Even techniques such as global illumination can appear in an interactive game level if you bake your GI solution into textures on the walls and floor.