Graphics Reference
In-Depth Information
k g
Figure 14.26: Sphere rendered with a single light source, using a Phong BSDF with a
white k g and orange k L .k g increases to the right and s increases upward. (Credit: From
Creating Games: mechanics, content, and technology by McGuire, Morgan and Jenkins,
Odest Chadwicke © 2009. Reproduced with permission of Taylor & Francis Group LLC -
topics in the formats other book and textbook via Copyright Clearance Center)
(each 0
1), but constants representing the net probability over all directions of
that term contributing to scattering.
The specific variant in Listing 14.9 includes the adjusted highlight term intro-
duced by Blinn, the (implicit) projected area factor demanded by physics, and an
approximate normalization factor introduced by Sloan and Hoffman [AMHH08]
for energy conservation. Figure 14.26 shows the impact of varying the two glossy
parameters of glossy coefficient and smoothness.
...
Listing 14.9: Normalized Blinn-Phong BSDF without Fresnel coefficients,
based on the implementation from Real-Time Rendering [AMHH08].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class PhongBSDF {
private :
// For energy conservation, ensure that k_L + k_g < 1 on each color channel
Color3 k_L;
Color3 k_g;
// ”Smoothness” parameter; the exponent on the half-vector dot
// product.
float s;
public :
virtual Color3 evaluateFiniteScatteringDensity
( const Vector3 &
wi,
const Vector3 &
wo) const {
if ((wi.dot(cframe.rotation.getColumn(1)) <= 0) &&
(wo.dot(cframe.rotation.getColumn(1)) <= 0)) {
return Color3 ::zero();
}
const Vector3 & w_h = (w_i + w_o).direction();
return k_L/PI+k_g * (8+s)/(8 * PI) * pow(max(0.0, n.dot(w_h)), s);
}
...
};
 
Search WWH ::




Custom Search