Game Engine Architecture

(Ben Green) #1

432 10. The Rendering Engine


and a maximum radius rmax. The rendering engine only applies the eff ects of a
point light to those surfaces that fall within is sphere of infl uence (a signifi cant
optimization). Figure 10.27 illustrates a point light.

Spot Lights
A spot light acts like a point light whose rays are restricted to a cone-shaped
region, like a fl ashlight. Usually two cones are specifi ed with an inner and an
outer angle. Within the inner cone, the light is considered to be at full inten-
sity. The light intensity falls off as the angle increases from the inner to the
outer angle, and beyond the outer cone it is considered to be zero. Within
both cones, the light intensity also falls off with radial distance. A spot light is
modeled as a position P, a source color C, a central direction vector L, a maxi-
mum radius rmax , and inner and outer cone angles θmin and θmax. Figure 10.28
illustrates a spot light source.

Area Lights
All of the light sources we’ve discussed thus far radiate from an idealized
point, either at infi nity or locally. A real light source almost always has a non-
zero area—this is what gives rise to the umbra and penumbra in the shadows
it casts.
Rather than trying to model area lights explicitly, CG engineers oft en use
various “tricks” to account for their behavior. For example to simulate a pen-
umbra, we might cast multiple shadows and blend the results, or we might
blur the edges of a sharp shadow in some manner.
Emissive Objects
Some surfaces in a scene are themselves light sources. Examples include fl ash-
lights, glowing crystal balls, fl ames from a rocket engine, and so on. Glowing
surfaces can be modeled using an emissive texture map —a texture whose colors
are always at full intensity, independent of the surrounding lighting environ-
ment. Such a texture could be used to defi ne a neon sign, a car’s headlights,
and so on.
Some kinds of emissive objects are rendered by combining multiple tech-
niques. For example, a fl ashlight might be rendered using an emissive texture
for when you’re looking head-on into the beam, a colocated spot light that
casts light into the scene, a yellow translucent mesh to simulate the light cone,
some camera-facing transparent cards to simulate lens fl are (or a bloom eff ect
if high dynamic range lighting is supported by the engine), and a projected
texture to produce the caustic eff ect that a fl ashlight has on the surfaces it il-
luminates. The fl ashlight in Luigi’s Mansion is a great example of this kind of
eff ect combination, as shown in Figure 10.29.

Figure 10.28. Model
of a spot light source.

Free download pdf