Graphics Reference
In-Depth Information
the effect of the limiting case should be the limit of the effects in the nonlimiting
cases. If the disk-shaped lights are given values that increase with the inverse
square of the radius, then these nonlimiting cases may produce nonzero effects,
which should show up in the limiting case as well.
The other, far more practical, reason for not letting rays hit point lights is that
point lights are an abstract approximation to reality, used for convenience, and if
you want them to be visible in your scene you can model them as small spherical
lights. In our test cases, there are no point lights visible from the eye, so the issue
is moot.
In general, not only might light be emitted by the place where the
ray meets the scene, but also it may be scattered from there as well. The
estimateTotalScatteredRadiance procedure handles this (see Listing 32.16)
by summing up the direct light, impulse-scattered indirect light, and diffusely
reflected direct light.
Listing 32.16: Estimating the total radiance scattered back toward
the course of the ray r.
1
2
3
4
5
6
7
8
9
10
Radiance3 App::estimateTotalScatteredRadiance(const Ray& r, int depth){
...
if (m_world->intersect(r, dist, surfel)) {
L_o += estimateReflectedDirectLight(r, surfel, depth);
if (m_IImp || depth > 0) L_o +=
estimateImpulseScatteredIndirectLight(r, surfel, depth + 1);
if (m_IDiff || depth > 0) L_o += estimateDiffuselyReflectedIndirectLight(r, surfel);
}
return L_o;
}
In each case, there's a Boolean control for whether to include this aspect of the
light. We've chosen to apply this control only to the first reflection (i.e., if m_IImp
is false, then impulse-scattered indirect light is ignored only when it goes directly
to the eye).
Listing 32.17: Impulse-scattered indirect light.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Radiance3 App::estimateImpulseScatteredIndirectLight(const Ray& ray,
const SurfaceElement& surfel, int depth){
Radiance3 L_o(0.0f);
if (depth > m_maxBounces) {
return L_o;
}
SmallArray<SurfaceElement::Impulse, 3> impulseArray;
surfel.getBSDFImpulses(-ray.direction(), impulseArray);
foreach impulse
const SurfaceElement::Impulse& impulse = impulseArray[i];
Ray r(surfel.geometric.location, impulse.w);
r = r.bumpedRay(0.0001f * sign(surfel.geometric.normal.dot( r.direction())),
surfel.geometric.normal);
L_o += impulse.magnitude * estimateTotalScatteredRadiance(r, depth + 1);
return L_o;
}
 
Search WWH ::




Custom Search