By: Jack Hoxley
Written: May 2000
Lighting is one of the most crucial
parts of a 3D scene; and if used effectively can result in incredibly real or
incredibly dramatic looking scenes. Although you've already come across lighting
(If you're following the tutorials in order), this feature will explain in depth
what lighting is available and how to use it.
First off, read through these
descriptions of the lighting types available. You'll need to have a reasonable
idea of what these are when it comes to choosing what sort of lighting you want
Ambient lighting affects every part of the scene and doesn't cast shadows. It
gives the overall scene a colour or brightness. If you had a light-red ambient
light in your scene everything would appear a slight tint of red. Ambient lights
don't have positions, or orientations as they would have no effect. Multiple
ambient lights will combine their colours; ie, if you had a light red and a
mid blue ambient light the overall colour would be a magenta-purple.
A spotlight emits a cone of light that is more intense in the middle (the Umbra)
and less intense on the outside (the Penumbra). These lights will cast shadows
and their positions and orientations are important.
A point light is more processor hungry and therefore should only be used when
necessary. A point light emits light equally in every direction from it's position;
because of this it results in a much better quality image.
A directional light source is often used to simulate lights that are a very
long way away from the scene; such as the sun or stars. A directional lightsource,
like an ambient one, illuminates all objects with an equal intensity.
A parallel point light isn't as processor hungry as the normal point light,
instead is about as processor hungry as a directional light source. A parallel
light illuminates all faces of visual objects that are parallel to itself.
Now you know roughly what each
light source is and what it does you can move onto the next step. This is another
list of things that you need to bare in mind when using lighting:
Lighting changes textures; this should be fairly obvious though. If you're using
textures and/or materials you should bare in mind that the lights will change
the colour; especially bare this in mind when things dont appear quite as they
should - too dark, wrong colour etc...
WHERE TO PLACE THEM
Lighting requires thought. Using few effectively is much better than using lots
ineffectively. If you are making a game lighting can make or break your level
design. Before coding the lights into your program decide what you want it to
look like - a bright summers day? or a dark gloomy urban alleyway? For the scene
to be recognisable you will need to get the lighting correct for what the scene
POLYGONS + DETAIL
The more polygons in a scene the more detailed the lighting will be. Direct3D
lights each polygon individually, so the more of them there are, the more detailed
the lighting will be. In the example provided with this tutorial the main box
has 100's of polygons in it - this makes for amazing lighting; the original
model had 11 and it didn't look half as good - trust me.
It is much easier for you to
learn lighting from looking at the code itself; so download the sample program
from the top of the page or from the downloads page.