Graphics Reference
In-Depth Information
The change of variables formula says that to compute
A
=
g
(
v
i
)
v
i
·
n
d
(26.30)
v
v
i
∈
Ω
we can instead compute
A
=
g
(
N
(
Q
))
N
(
Q
)
·
n
|
JN
(
Q
)
|
dQ
,
(26.31)
Q
∈
R
where
JN
is the Jacobian for the change of variables
N
.
Let's suppose that the rectangle
R
is specified by a corner,
C
, and two perpen-
dicular unit vectors
u
and
v
, chosen so their cross product
n
points back toward
P
. The points of
R
are then of the form
Q
=
C
+
s
u
+
t
v
,
where 0
≤
s
≤
w
and 0
≤
t
≤
h
. So the integral we need to compute is
A
=
w
s
=
0
h
g
(
N
(
C
+
s
u
+
t
v
))
N
(
Q
)
·
n
|
JN
(
C
+
s
u
+
t
v
)
|
dt ds
.
(26.32)
t
=
0
Computing the Jacobian of
N
at the point
Q
=
C
+
s
u
+
t
v
is somewhat
involved, but the end result is simple:
n
|
r
2
JN
(
Q
)=
|
v
·
|
,
(26.33)
where
r
is the distance from
P
to
Q
and
v
is the unit vector pointing from
P
to
Q
.
The intuitive explanation for this is that if the plane of the rectangle
R
hap-
pened to be perpendicular to
, then a tiny rectangle on
R
, when projected down
to the unit sphere around
P
, would be scaled down by a factor of
r
in both width
and height, and that accounts for the
r
2
v
in the denominator. If the plane of
R
is
tilted relative to
, then we can first project the tiny rectangle onto a plane that's
not
tilted (projecting along
v
). This, by the Tilting principle, introduces a cosine
v
n
.
Applying this result to the point
Q
(
s
,
t
)=
C
+
s
u
+
t
v
, the integral
A
becomes
A
=
w
s
=
0
factor, which is
v
·
h
n
|
n
|
(
Q
(
s
,
t
)
−
P
)
·
g
(
N
(
Q
(
s
,
t
)))
N
(
Q
(
s
,
t
))
·
dt ds
(26.34)
Q
(
s
,
t
)
−
P
3
t
=
0
=
w
s
=
0
h
n
|
g
(
N
(
Q
(
s
,
t
)))
|
(
Q
(
s
,
t
)
−
P
)
·
n
|
|
(
Q
(
s
,
t
)
−
P
)
·
dt ds
Q
(
s
,
t
)
−
P
Q
(
s
,
t
)
−
P
3
t
=
0
(26.35)
=
w
s
=
0
h
n
|
g
(
N
(
Q
(
s
,
t
)))
|
(
Q
(
s
,
t
)
−
P
)
·
n
||
(
Q
(
s
,
t
)
−
P
)
·
dt ds
.
Q
(
s
,
t
)
−
P
4
t
=
0
(26.36)
(
s
,
t
)=
Q
(
s
,
t
)
−
P
If we define
, this simplifies to
v
Q
(
s
,
t
)
−
P
A
=
w
s
=
0
h
n
|
(
s
,
t
))
|
v
(
s
,
t
)
·
n
||
v
(
s
,
t
)
·
g
(
dt ds
.
(26.37)
v
2
Q
(
s
,
t
)
−
P
t
=
0