[WML-Source: Lighting.wml][TOC][Part00]

[chapter]Lighting by Geno Ruffalo

[section]Light in Blender

Lighting is just as important as the models and textures are in a 3D scene. The first thing to realize is that one light will never be enough to properly illuminate a scene, or even a single object. Many people misuse lighting trying to duplicate nature, like using a single light to mimic the Sun or a lamp on a desk, but end up with an unrealistic result. In this chapter we shall overcome this problem and with use of a classic lighting style known as the `three light setup', with emphasis on the use of the spot light to cast shadows.

Blender offers four basic lights. The Lamp is a point light that shines in all directions form a single point. The Spot is a cone-shaped spot light which is the only light that can cast shadows. A Sun lamp is a light source that shines from a constant direction, and the Hemi light is similar to the Sun except that the light is shed in the form of a half sphere. At the end of the chapter we will cover advanced lighting techniques, such as the use of light gels and volumetric lighting.

You will see how lighting can play an important part in any scene, and getting it right can be very challenging, even in the simplest of scenes. Blender provides us with a variety of lamp types and options to meet most situation requirements. With practice, and this chapter as your starter, you will learn how to use these many types of lights in a variety of ways in order to achieve the result you are seeking.

[section]Light and Shadow

The only type of light that can cast a shadow is the Spot Light. Before a spot light can cast shadows, a few things must be set up in the scene. Load the file "no_lights.blend" in Blender. The scene contains a ground plane, a model of a woman, and a camera. Verify that shadows are enabled in the rendering engine by pressing the Shadows button in the Display Buttons Window (Fig. 1).

Figure 1  [images/Lighting/light1.tga]

Select the ground plane and press F5 to display the Material Buttons. Make sure that the Shadow and Traceable buttons are pressed (Fig. 2). Both of these buttons are set by default. The Shadow button will ensure that the object with this material (the ground plane) will receive shadows. The Traceable button needs to be set for the material of any object that needs to cast shadows.

Figure 2  [images/Lighting/light2.tga]

The first light in a standard three-light set up will be a spot light known as the Key Light. In top view add a Lamp and press F4 to display the Lamp Edit Buttons. Press the Spot button and make sure that the Shadows button is also pressed. Compare your settings with the rest of the buttons in Fig. 3. The Energy slider button determines the brightness of the light, the SpotSi slider button sets the size of the spot light's cone, and the SpotBl sets the amount that the edge of the lamp's light blends with the area not lit by the lamp.

Figure 3  [images/Lighting/light3.tga]

Now that the spot light has been added to the scene and all the basic necessities have been put into place, the spot light needs to be positioned and rotated. Place the light  in front, above, and to the right of the main object of focus (the model of the woman). The easiest way to point the spot light is to make it track an empty. In top view add an empty directly below the spot light. Select the spot light, hold down SHIFT and select the empty. Press CTRL+T to make the spot light track the empty (Fig. 4).

Figure 4  [images/Lighting/light4.tga]

We can actually look through the spot light as if it were a camera while positioning the empty to point the spot light. This is done by selecting the spot light and pressing CTRL-NUMPAD_0 . Move the empty in camera view and in the other view ports until the subject is centred as in Fig. 5. You can always return to the real camera view by pressing. ALT-NUMPAD_0 . Figure 5 There are still a few more settings that must be adjusted to achieve nice shadows. Blender uses something known as clipping to determine which parts of the scene will be included in the shadow calculations during rendering. All objects contained within the ClipSta and ClipEnd values will cast and receive shadows. Fig. 6 is a demonstration of a high ClipSta value. The value is so high that the top part of the model cannot be seen in the spot lights view when used as the camera.

Figure 6  [images/Lighting/light6.tga]

Adjust the clipping values so that the model of the woman and the ground plane fall inside of the visible boundaries of the spot light (Fig. 7).

Figure 7  [images/Lighting/light7.tga]

Before we test render, increase the values of the BufSi, Samples, and Bias buttons (Fig. 8). These settings will increase the quality of the shadows but will also increase render time. BufSi sets the size of the shadow buffer in pixels and Samples determines how many samples of the shadow buffer are sampled to reduce aliasing. The best way to see the effect of these values do is to make many test renders while adjusting the values and comparing the renders to each other.

Figure 8  [images/Lighting/light8.tga]

In order to do a test render we need to return the view from the spot light back to the camera. Select the camera and press ALT+ZERO and then F12 to render. The result of all this hard work so far can be seen in Fig. 9. Compare your settings with those in the "spot.blend"   file on the CD-ROM. Although we have a nice shadow, our scene still needs a great deal of more work and more lighting.

Figure 9  [images/Lighting/light9.tga]

[subsection]Flood Fill and Back Lighting

The next light in a standard three-light setup is the Back Lighting. The Back Light is not only used to illuminate the back of the object but to also separate the foreground objects from the background and add overall depth to the scene. The positioning is usually above and behind the main subject  and offset opposite from the position of the Key (Fig. 10).

Figure 10  [images/Lighting/light10.tga]

The default lamp settings will work well for back lighting. If only one lamp is used then the energy value should be greater than or equal to the key light. If needed increase the Dist setting as seen in Fig. 11.

Figure 11  [images/Lighting/light11.tga]

Test render the scene with just the back lighting in place. This can be dome by moving the other lights in the scene to an inactive layer or adjust their energy values to zero. Notice how a nice silhouette of the model can be seen separated from the background.

Figure 12  [images/Lighting/light12.tga]

The third and final style of light needed to complete our scene is the Fill Light. The fill light is usually placed behind the camera and is used to soften shadows from the Key and to add to the overall ambience of a scene (Fig. 13). The intensity, or energy of the light is usually slightly less than that of the key and back lights.

Figure 13  [images/Lighting/light13.tga]

After test rendering the scene with just the fill light, we see that parts of the model, not visible with the other two styles, can now be seen. It is also noticeable that without a shadow there are no visible clues available and the model seems to be floating off the floor. This is one reason why shadows are so important in a lighting solution.

Figure 14  [images/Lighting/light14.tga]

Add all 3 lights to the scene and compare their settings to those in the file "three_lights.blend" and render the scene. Not one of the renders from the single lights was enough to properly render the scene, but notice how rich the result is when all three lights are used together, complimenting each other as a whole (Fig. 15).

Figure 15  [images/Lighting/light15.tga]

[subsection]Shadow-Only Spots

Sometimes it is necessary to cast shadows without the need for the bright, hard-edged light that a spot light casts, or you may just want greater control over the intensity of the shadow itself. This is just what the shadow-only spot light is for. Select the spot light in our scene and duplicate it with SHIFT-D . Turn one of the spot lights into a standard lamp by clicking the Lamp button in the Lamp Edit Buttons. Select the other spot light and click the OnlyShadow button (Fig. 16).

Figure 16  [images/Lighting/light16.tga]

Reduce the energy of the shadow-only spot light and render the scene. Notice the softer mood that is achieved in Fig. 17 than that of Fig. 15. Compare your settings with the settings in the file "shadow_only.blend" on the CD-ROM.

Figure 17  [images/Lighting/light17.tga]

[subsection]Light Gels

A light gel in real life is when you place a colored piece of film over a stage light or a slide with an image on it. The color or image is then cast on the scene with the light. In Blender, this is as simple as assigning a texture to a lamp. If you wanted to simulate the shadow cast by a latticed windowpane, but without having to model the architecture, you could use an image similar to Fig. 18. Add a new image texture to your three light scene and use the window.jpg image on the CD-ROM. If you are not familiar with adding an image texture please review the chapters covering the use of materials and textures in Blender.

Figure 18  [images/Lighting/light18.tga]

With the spot light selected open the Lamp Edit Buttons and activate the Add New menu to add the texture in the same way you would add a texture to a material. Press the View button so that the spot light will project the image properly (Fig. 19). Make sure you return the spot light back to its default setting by removing the OnlyShadow option.

Figure 19  [images/Lighting/light19.tga]

The last step to take on the spot light is to change it to a square spot light. Press the Square button next to the light preview window. This is necessary so that the corners of the image don't get cropped off.

Figure 20  [images/Lighting/light20.tga]

The final result is quite convincing (Fig. 21). Color images can also be used to simulate light from a stained glass window, and even animated images and textures can be used for special effects.

Figure 21  [images/Lighting/light21.tga]

[section]Volumetric Lighting

The term Volumetric Lighting refers to light with some type of volume perceived. Usually this is in the form of light rays because of dust in the air, fog, mist, or under water effects. This is best seen when a volumetric light is obstructed by something and casting shadows. Load the file "volumetric1.blend" from the CD-ROM. Our scene consists of only a pre-calculated radiosity solution (Fig. 22).

Figure 22  [images/Lighting/light22.tga]

A volumetric light (or halo spot) must start out as a spot light and all the rules of a spot that cast shadows must also apply to a volumetric light, including clipping. Use Fig. 23 as a reference when placing your spot light. Adjust the clipping as needed.

Figure 23  [images/Lighting/light23.tga]

There are three areas of interest when converting a spot light to a volumetric light (Fig. 24). First, the Halo step value must be changed from the default value of zero. The values range from 1 to 12, the lower the number the higher the quality and the longer the render time. A setting of zero makes the halo rendering inactive. Next press the Halo button to activate volumetric lighting. This is where the name halo spot comes from. The intensity of the light rays are adjusted with the HaloInt slider button.

Figure 24  [images/Lighting/light24.tga]

In the final render, the color of the halo spot was changed to a light blue to help give the look of daylight (Fig. 25). This use of color is used to suggest the time of day. It can easily be changed by rotating the angle of the light rays and the color of the lamp. In Fig. 26 the angle was lowered and the color of the lamp was changed to a reddish-orange, to suggest a sunset mood (see "volumetric2.blend" ).

Figure 25  [images/Lighting/light25.tga]

Figure 26  [images/Lighting/light26.tga]


-cw- Last modified: Tue Nov 7 10:52:16 CET 2000