Game Development Reference
In-Depth Information
Chapter 5
Lighting
To enhance the realism of our scenes, we can add lighting. Lighting also
helps to depict the solid form and volume of objects. When using light-
ing, we no longer specify vertex colors ourselves; rather, Direct3D
runs each vertex through its lighting engine and computes a vertex
color based on defined light sources, materials, and the orientation of
the surface with regard to the light sources. Computing the vertex col-
ors based on a lighting model results in a more natural scene.
Objectives
To learn the light sources that Direct3D supports and types of light
that these sources emit
To understand how we define light to interact with the surface that
it strikes
To find out how we can mathematically describe the direction a tri-
angle is facing so that we can determine the angle at which a light
ray strikes the triangle
5.1 Light Components
In the Direct3D lighting model, the light emitted by a light source con-
sists of three components, or three kinds of light.
Ambient Light —This kind of light models light that has reflected
off other surfaces and is used to brighten up the overall scene. For
example, parts of objects are often lit, to a degree, even though
they are not in direct sight of a light source. These parts get lit
from light that has bounced off other surfaces. Ambient light is a
hack used to roughly, and cheaply, model this reflected light.
Diffuse Light —This type of light travels in a particular direction.
When it strikes a surface, it reflects equally in all directions.
Because diffuse light reflects equally in all directions, the reflected
light will reach the eye no matter the viewpoint, and therefore we
do not need to take the viewer into consideration. Thus, the diffuse
98
Search WWH ::




Custom Search