Graphics Reference
In-Depth Information
For a scene with only point lights and Phong BSDFs in which we have,
numSamplesPerLight = 1 , Listing 14.11 degenerates into the familiar OpenGL
fixed-function shading algorithm. The framework presented in this chapter pro-
vides some explanation of what the lighting parameters in OpenGL “mean.” That
puts us on a somewhat more solid footing when we attempt to render scenes
designed for classic computer graphics point sources within a physically based
renderer. It also leads us to the settings perhaps most likely to produce a realistic
image under rendering APIs similar to OpenGL.
For all scenes, Listing 14.11 implements direct illumination in the style
employed both for algorithms like path tracing and for explicit direct illumination
under rasterization. It is an estimator for the terms in the rendering equation due
to direct illumination (Figure 14.28 shows the key variables, for reference). The
perhaps unexpected radiant emittance units arise from a change of variables from
the form in which we often express the rendering equation. That is, we commonly
express the scattered direct illumination as
v i
v o
P
Figure 14.28: Light reflected at P.
v o )=
Ω +
L ( P ,
L ( P ,
v i ) f P (
v i ,
v o ) n
· v i d
v i ,
(14.25)
where the domain of integration is the hemisphere Ω + above the point P at which
we are computing the illumination.
That would lead us to an implementation like:
1
2
3
4
repeat N times:
dw_i = 2 * PI/N;
L_i = ...;
L_o += L_i * bsdf.evaluate(...) * n.dot(w_i) * dw_i;
However, path tracing and other algorithms that employ explicit direct illumi-
nation sampling tend to sample over the area of light sources, rather than over the
directions about the shaded point.
We must change integration domains from Ω + to the surfaces of the lights;
that entails making the appropriate change of variables. Consider a single light
with surface region Δ A and unit surface normal m at Q (see Figure 14.29).
,
while the distance from P to ΔΩ is exactly 1. (Recall that ΔΩ is a small region
on the unit sphere around P .) If the region Δ A near Q were not tilted (i.e., if
m and
The distance from P to the surface region Δ A is approximately r =
Q
P
Q
v i were opposites), then its area would be r 2 times the area of ΔΩ .The
tilting principle of Section 7.10.6 says that the area is multiplied by a cosine factor.
So the area of Δ A is approximately r 2
D
A
times the area of ΔΩ , with the
approximation getting better and better as the region ΔΩ shrinks in size. Thus the
change of variable, as we go from d
|
m
· v i |
m
DV
v i to dA (often denoted by some symbol like
dA )is | m · v i |
d
v i
2 . We can now rewrite Equation 14.25, substituting S ( Q
P ) for
v i ,
1
Q P
P
v o )=
L ( P ,
L ( P ,
v i ) f P (
v i ,
v o ) n
· v i d
(14.26)
v i
Ω +
=
L ( P , S ( P
Q )) f P ( S ( Q
P ) ,
v o ) n
· S ( Q
P )
·
Figure 14.29: The small, solid-
angle ΔΩ and a corresponding
small region Δ A on the lumi-
naire's surface.
Q R
m
· S ( P
Q )
dA ,
(14.27)
2
Q
P
 
Search WWH ::




Custom Search