Game Development Reference
In-Depth Information
do not have to be placed on stands, they are perfectly even in the
distribution of light and can be turned on and off at will. You can turn on
some lights while you are drawing some of the geometry in a scene and
other lights to draw different parts of the scene, or even change the
properties of the light halfway through doing a render of the current frame.
In addition to enabling lighting calculations, each light is enabled or
disabled using the following syntax:
glEnable(GL_LIGHTx) 0 x < 8
will turn the light on and
glDisable(GL_LIGHTx)
will turn the light off.
The lights come in three basic flavours, directional, positional and
spotlights.
Directional, positional and spotlights
A directional light shines on all polygons from the same direction. It does
not matter where the light is placed, it can even be behind the object. All
that matters is that if it points directly down then all polygons will be lit by
a light that appears to shine directly down; similiarily, if it shines to the
right, left or any other direction, all polygons are lit as though their surface
is hit by a light striking the surface at the same angle.
A positional light does not have a direction. It shines out in every
direction, but it does have a location. If the light is placed behind an object
it will look as though it is lit from the rear.
Spotlights have both a location and direction. Because of this they
require an angle that defines how wide the beam that shines from the light
appears; this is called the GL_SPOT_CUTOFF. If this is set to 180° then
effectively the spotlight is a positional light because the beam of light is
cast in a half circle in both directions. If the angle is set to 30° then the
beam of light is 60°. Figure 4.1 shows how this works. Spotlights behave
in a way that is much closer to the way that a real light would interact with
a studio lit scene. Moving a spotlight has an effect and rotating the light
also has an effect. We will look at how to set up positional lights and
spotlights later; for now we will concentrate on directional lights. In some
software, directional lights are called distant lights.
Search Nedrilad ::




Custom Search