Graphics Reference
In-Depth Information
Listing 14.11: Direct illumination from an arbitrary set of lights.
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
27
28
29
30
31
/ ** Computes the outgoing radiance at P in direction w_o * /
Radiance3 shadeDirect
( const Vector3 & w_o, const Point3 &P,
const Vector3 &n, const BSDF & bsdf,
const std::vector< Light * >& lightArray) {
Radiance3 L_o(0.0f);
for ( int i = 0; i < lightArray.size(); ++i) {
const Light * light = lightArray[i];
int N = numSamplesPerLight;
// Don't over-sample point lights
if (light->surfaceArea() == 0)N=1;
for ( int s=0;s<N;++s) {
const Vector4 & Q = light->randomPoint()
const Vector3 & w_i = (Q.xyz() * P-P * Q.w).direction();
if (visible(P, Q)) { // shadow test
const Biradiance3 & M_i = light->biradiance(Q, P);
const Color3 & f = bsdf.evaluateFiniteScatteringDensity(w_i, w_o, n);
L_o += n.dot(w_i) * f * M_i / N;
}
}
}
return L_o;
}
If this is your first encounter with code like that shown in Listing 14.11, sim-
ply examine it for now and then treat it as a black box. A fuller explanation of
the radiometry that leads to this implementation and motivates the abstractions
appears in Chapter 32. A brief explanation of the derivation of this implementa-
tion appears in the following section.
14.11.3.3 Relationship to the Rendering Equation
We now attempt to reconcile the “light” that's used in the traditional graphics
pipeline (e.g., in Chapter 6) with the physically based rendering model that is
described in Chapter 31. The key idea is that if we measure light in units of bira-
diance , 6 then classic graphics models can function as simplified versions of the
physics of light and the rendering equation.
This material appears in this chapter because it constitutes a conventional
approximation to the real physics of light, which we wanted to introduce before
the full theory. It of course also serves readers encountering this section after read-
ing Chapters 26 and 31, or with previous experience in graphics systems.
6. We are not aware of a preexisting name for solid-area weighted radiance measured
at the receiver , so we introduce the term “biradiance” here to express the idea that it
incorporates two points. This quantity is distinct from radiosity (which considers the
whole hemisphere), irradiance (which is measured at the emitter's surface), radiant
emittance (likewise), and other quantities that commonly arise with the same units.
 
 
Search WWH ::




Custom Search