Game Development Reference
In-Depth Information
The preceding screenshot certainly does not look like a monkey. Why? Because we
did not add any light, illumination, or a shading model to our scene. If these effects
are not added, the effect of 3D realism on a 2D screen cannot be achieved.
Making a scene realistic depends on the use of light effects. Do not forget to note
that the number of lights and the choice of shading algorithms impact the game
performance. We will discuss a few illuminations and shading models, but we will
restrict ourselves from using the most used model for gaming. Also, in games, we add
textures baked in lighting so that the number of lights used is minimal (we mostly
avoid specular reflections). We will cover these textures in Chapter 4 , Applying Textures .
Understanding the illumination/reflection
model
The appearance of an object depends on the direction in which the light is reflected.
This also depends on the changes in the color and intensity of light after reflection.
The algorithms used to calculate the direction, intensity, and color of reflected
light are called reflection models. Reflection models use the color components
(ambient, diffuse, and specular) of a light source as well as the object material to
calculate the color of a fragment. Although we will cover these components in
depth in subsequent chapters, let us quickly get a basic understanding of how each
component contributes to the final color calculation of a fragment.
The ambient component illuminates every object equally and is reflected in all
directions equally. It simply means that the direction and distance of the light are not
used to calculate the ambient color component.
The diffuse component is directional in nature. The final diffuse color calculation
involves the distance of the light source and the angle the light direction subtends
with the surface normal.
The specular component is used to highlight an area of the object (shininess caused
by reflection). It is also calculated using the direction and distance of the light source.
Rendering images with more realistic reflection models is called Bidirectional
Reflectance Distribution Functions ( BRDFs ). A BRDF model for computing the
reflection from a surface takes into account the input direction of the incoming light
and the outgoing direction of the reflected light. The elevation and azimuth angles of
these direction vectors are used to compute the relative amount of light reflected in the
outgoing direction. BRDF models are constantly evolving to give more realistic effects.
 
Search WWH ::




Custom Search