Game Development Reference
In-Depth Information
jth light source, including the attenuation factor. The index j goes from 1
to n, where n is the number of lights. Now the lighting equation becomes
n
The standard lighting
equation for multiple
lights
m spec ) max ( n h j ,0) m gls + ( s j
c lit =
( s j
m diff ) max ( n l j ,0)
j=1
+ g amb m amb + m emis .
(10.14)
Since there is only one ambient light value and one emissive component
for any given surface, these components are not summed per light source.
10.6.6
Limitations of the Standard Model
Nowadays we have the freedom of programmable shaders and can choose
any lighting model we wish. Since the standard model has some fairly seri-
ous shortcomings, you might very well ask, “Why learn about this ancient
history?” First, it isn't exactly ancient history; it is alive and well. The rea-
sons that made it a good compromise between realism, usability, and speed
of calculation still apply. Yes, we have more processing power; but we also
want to render more pixels and more lights, and it currently is very common
for the standard lighting model to be the winner when programmers are
deciding whether to spend the cycles on more pixels (higher resolution) or
more accurate pixels (a more accurate lighting model). Second, the current
local lighting model is one that content creators can understand and use.
This advantage is not to be taken lightly. Artists have decades of experi-
ence with diffuse and specular maps. Switching to a lighting model that
replaces those familiar inputs with different ones such as “metalness” (from
Strauss's model [69]) for which artists do not have an intuitive grasp is a big
price to pay. A final reason to learn the standard lighting model is because
many newer models bear similarities to the standard model, and you cannot
know when to use more advanced lighting models without understanding
the old standard.
If you have read the OpenGL or DirectX documentation for setting
material parameters, you are forgiven for thinking that ambient, diffuse,
and specular are “how light works” (remember our warning at the beginning
of this chapter) as opposed being arbitrary practical constructs peculiar to
a particular lighting model. The dichotomy between diffuse and specular
is not an inherent physical reality; rather, it arose (and continues to be
used) due to practical considerations. These are descriptive terms for two
extreme scattering patterns, and by taking arbitrary combinations of these
two patterns, many phenomena are able to be approximated to a decent
degree.
Search WWH ::




Custom Search