Graphics Reference
In-Depth Information
•
Create cone
C
with apex at point
p
and opening angle
α
, oriented around
vector
r
.
•
Project cone
C
onto the light plane of area light
L
, creating ellipsoid
E
.
•
Find area
A
S
of the intersection between ellipsoid
E
and function
S
de-
scribing specular light shape.
•
Find geometric center
p
sc
of
A
S
—the importance point of the specular
integral.
Calculate
Specular
(
p,ω
o
)asif
p
sc
was a point light, therefore vector
−−→
•
pp
sc
.
•
Normalize the result by the actual area of
A
S
as an effective solid angle
differential.
Applying this to equation (1.12) results in
L
n
D
(
h
)
F
(
ω
o
,h
)
G
(
ω
i
,
−−→
pp
sc
h
)
Specular
(
p,ω
o
)
∼
dω
−−→
pp
sc
,
(1.19)
4(
cosθ
o
)
ω
o
,
−−→
h
=
pp
sc
.
After substituting the solid angle differential from equation (1.19) by
A
S
normal-
ization, we get
L
n
D
(
h
)
F
(
ω
o
,h
)
G
(
ω
i
,
−−→
pp
sc
h
)
Specular
(
p,ω
o
)
∼
.
(1.20)
4(
cosθ
o
)
A
S
When solving for specific light, we use the appropriate method per light type
to calculate
A
S
. The following section focuses on approximations for various
light-shape intersections with the specular importance cone.
Intersection area calculation.
Finding an accurate area of intersection, between
various 2D shapes, at runtime is not a trivial task. In our case we are looking
at ellipse-disk or ellipse-rectangle intersections. Disks and rectangles are axis
aligned in light space and centered at (0
,
0), as they represent the actual light
shape. Ellipses can be rotated. See Figures 1.14 and 1.15 for reference. To
minimize shader complexity, we decided to approximate an ellipsoid by a simple
disk. Calculating the area of intersection of two disks, or an axis-aligned box
and a disk, is a reasonably easy problem to solve. In the case of a disk-disk
intersection, we use the known smooth step approximation proposed by [Oat 06]:
A
D
0
D
1
=
A
min
smoothstep
0
,
1
,
1
,
(1.21)
|
r
0
−
r
1
|
−
c
0
−
c
1
−
r
0+
r
1
−|
r
0
−
r
1
|
where
c
0,
r
0,
c
1, and
r
1 are the center and radius of disks
D
0and
D
1, respectively
(see Figure 1.16).