Game Development Reference
In-Depth Information
lating the effective light color when shading a particular spot, the standard
abstract light types are attenuated.
In practice, Equation (10.16) can be unwieldy for two reasons. First,
the light intensity theoretically increases to infinity at d = 0. (This is a
result of the light being a Dirac delta, as mentioned previously.) Barzel
[5] describes a simple adjustment to smoothly transition from the inverse
square curve near the light origin, to limit the maximum intensity near the
center. Second, the light intensity never falls off completely to zero.
Instead of the real-world model, a simpler model based on falloff distance
is often used. Section 10.7 mentioned that the falloff distance controls the
distance beyond which the light has no effect. It's common to use a simple
linear interpolation formula such that the light gradually fades with the
distance d:
8
<
1
if d ≤ d min ,
− d
d max − d min
d max
Typical linear
attenuation model
i(d) =
(10.17)
if d min < d < d max ,
:
0
if d ≥ d max .
As Equation (10.17) shows, there are actually two distances used to con-
trol the attenuation. Within d min , the light is at full intensity (100%). As
the distance goes from d min to d max , the intensity varies linearly from 100%
down to 0%. At d max and beyond, the light intensity is 0%. So basically,
d min controls the distance at which the light begins to fall off; it is frequently
zero, which means that the light begins falling off immediately. The quan-
tity d max is the actual falloff distance—the distance where the light has
fallen off completely and no longer has any effect. Figure 10.32 compares
real-world light attenuation to the simple linear attenuation model.
Distance attenuation can be applied to point and spot lights; directional
lights are usually not attenuated. An additional attenuation factor is used
for spot lights. Hotspot falloff attenuates light as we move closer to the
edge of the cone.
10.7.3
Doom -style Volumetric Lights
In the theoretical framework of the rendering equation as well as HLSL
shaders doing lighting equations using the standard Blinn-Phong model,
all that is required of a light source for it to be used in shading calculations
at a particular point x is a light color (intensity) and direction of incidence.
This section discusses a type of volumetric light, popularized by the Doom
3 engine (also known as id Tech 4 ) around 2003, which specifies these
values in a novel way. Not only are these types of lights interesting to
understand from a practical standpoint (they are still useful today), they
are interesting from a theoretical perspective because they illustrate an
 
Search WWH ::




Custom Search