Graphics Reference
In-Depth Information
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Vector2 extent;
// Center of the source
Point3 C;
Power3 Phi;
public :
...
Vector4 randomPoint() const {
return Vector4 (C +
u * (random(-0.5f, 0.5f) * extent.x) +
v * (random(-0.5f, 0.5f) * extent.y), 1.0f);
}
float area() const {
return extent.x * extent.y;
}
Power3 power() const {
return Phi;
}
Biradiance3 biradiance( Vector4 Q, Vector3 P) const {
assert(Q.w == 1);
const Vector3 & w_i = (Q.xyz() - P).direction();
return Phi * max(-m.dot(w_i), 0.0f) /
(PI * (P - Q.xyz()).squaredLength());
}
};
14.11.5 Hemisphere Area Light
A large hemispherical light source that emits inward is a common model of the
sky or other distant parts of the environment. Listing 14.14 adapts the concepts
from the rectangular area light source to such a dome. Two natural extensions to
this model are to incorporate a coordinate frame so that the hemisphere can be
arbitrarily centered and oriented, and to modulate the power over the dome by an
image to better simulate complex environments and skies with high variability.
Listing 14.14: A model of an inward-facing hemispherical light dome,
centered at the origin and with rotational symmetry about the y-axis.
1
2
3
4
5
6
7
8
9
10
11
12
13
class HemisphereAreaLight : public Light {
private :
// Radius
float r;
Power3 Phi;
public :
...
Vector4 randomPoint() const {
return Vector4 (hemiRandom( Vector3 (0.0f, 1.0f, 0.0f)) * r, 1.0f);
}
 
 
 
Search WWH ::




Custom Search