Graphics Reference
In-Depth Information
For a solid-color material, the innate colors for the diffuse and specular layers
are constant across a surface. For a textured material, the texture image and texture
algorithm together determine the diffuse-layer color at each individual surface
point.
The three efficiency factors are each expressed as an RGB triple, with each
entry being a number between 0 and 1, with 0 meaning “no efficiency” and 1
meaning “full efficiency.” For example, we would specify k a,R = 0. 5 for a diffuse
layer that reflects exactly half of the red component of the ambient light in the
scene.
What we've called “reflection efficiency” here is closely related to the physical
notion of reflectivity, which we'll examine in detail in Chapter 26.
Next, let's examine the inputs that are specified by or derived from the lights
that have been placed in the scene, via any of WPF's light-specification elements,
such as DirectionalLight :
Symbol
Description
Format
I a
Color/intensity of the scene's ambient light ( I a,R , I a,G , I a,B )
I dir
Color/intensity of a directional light source ( I dir,R , I dir,G , I dir,B )
I geom
Color/intensity of a geometric light source ( I geom,R , I geom,G , I geom,B )
F att
Attentuation factor for geometric lights
a single real number
A geometic light's actual contribution is subject to attenuation. The attenuation
factor F att is calculated for each surface point P , based on the light's characteristics
and distance from P . Thus, the actual light arriving from at the surface point P
from the geometric light source is
( F att I geom,R ; F att I geom,G ; F att I geom,B ) .
Now that we have enumerated all of the inputs, we are ready to examine the
WPF lighting equation. Here is the equation that computes the intensity of the
red light that reaches the camera from a specific surface point (we examine each
component in detail below):
I R =
(6.2)
I a,R k a,R C d,R
(6.3)
I dir,R k d,R C d,R (cos
)
+
directional lights
θ
(6.4)
F att
)
+
geometric lights
I geom,R k d,R C d,R (cos
θ
(6.5)
I dir,R k s,R C s,R (cos
) s
+
directional lights
δ
(6.6)
F att
) s
+
geometric lights
I geom,R k s,R C s,R (cos
δ
(6.7)
The sums in the equations above are over all lights of various kinds, which
we'll describe shortly.
If the scene contains multiple lights, and/or if the material uses multiple com-
ponents (e.g., both ambient and diffuse) with high reflection efficiency coeffi-
cients, the computed result may be greater than 100% intensity, which has no
Search WWH ::




Custom Search