LPV (Light Propagation Volumes)
RSM (Reflective Shadow Map)
Radiometric and Photometric quantities
Quantity
Radiometric Name
Radiometric Unit
Photometric Name
Photometric Unit
Power
\displaystyle \text{Power}
Power
Radiant Flux
Φ
\displaystyle \mathrm{\Phi}
Φ
W
\displaystyle W
W
Luminous Flux
Φ
\displaystyle \mathrm{\Phi}
Φ
Lumen
l
m
\displaystyle \mathrm{lm}
lm
Power
Solid Angle
\displaystyle
\frac{\text{Power}}{\text{Solid Angle}}
Solid Angle Power
Radiant Intensity
I
\displaystyle \mathrm{I}
I
W
s
r
\displaystyle \frac{W}{\mathrm{sr}}
sr W
Luminous Intensity
I
\displaystyle \mathrm{I}
I
Candela
c
d
\displaystyle \mathrm{cd}
cd
Power
Area
\displaystyle
\frac{\text{Power}}{\text{Area}}
Area Power
Radiant Exitance
M
\displaystyle \mathrm{M}
M (Radiosity
B
\displaystyle \mathrm{B}
B )
W
m
2
\displaystyle \frac{W}{m^2}
m 2 W
Luminous Exitance
M
\displaystyle \mathrm{M}
M (Luminosity
B
\displaystyle \mathrm{B}
B )
Lux
l
x
\displaystyle \mathrm{lx}
lx
Power
Area
\displaystyle
\frac{\text{Power}}{\text{Area}}
Area Power
Irradiance
E
\displaystyle \mathrm{E}
E
W
m
2
\displaystyle \frac{W}{m^2}
m 2 W
Illuminance
E
\displaystyle \mathrm{E}
E
Lux
l
x
\displaystyle \mathrm{lx}
lx
Power
Area
⋅
Solid Angle
\displaystyle
\frac{\text{Power}}{\text{Area} \cdot \text{Solid Angle}}
Area ⋅ Solid Angle Power
Radiance
L
\displaystyle \mathrm{L}
L
W
m
2
⋅
s
r
\displaystyle \frac{W}{m^2 \cdot
\mathrm{sr}}
m 2 ⋅ sr W
Luminance
L
\displaystyle \mathrm{L}
L
Nit
n
t
\displaystyle \mathrm{nt}
nt
For directional light, by "4.6 Sun" of [Lagarde 2014], the illuminance
E
\displaystyle \mathrm{E}
E for the surface perpendicular to the
light direction is specified.
For point light, by "4.4 Punctual lights" [Lagarde 2014], the luminous flux
Φ
\displaystyle \mathrm{\Phi}
Φ is specified, and we have the
luminous intensity
I
=
Φ
4
π
\displaystyle \mathrm{I} = \frac{\mathrm{\Phi}}{4
\pi}
I = 4 π Φ . By the inverse
square law, we have the illuminance for the surface perpendicular to the light direction
E
=
I
distance
2
\displaystyle \mathrm{E} =
\frac{\mathrm{I}}{{\text{distance}}^2}
E = distance 2 I . But the light
radius and the attenuation windowing function are usually specified, and the illuminance
E
\displaystyle \mathrm{E}
E will smoothly reach zero at the light
radius.
SH (Spherical Harmonics)
SH Basis
Let
Υ
l
m
(
ω
→
)
\displaystyle
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})
Υ l m ( ω
) be the SH basis function of which l is the
degree (or band) and m is the basis function index from -l to l.
The SH basis function
Υ
l
0
(
ω
→
)
\displaystyle
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega})
Υ l 0 ( ω
) of which the m is zero is called
ZH (zonal harmonics) .
By "Appendix A2" of [Sloan 2008], we have the polynomial forms of SH basis
Υ
l
m
(
ω
→
)
\displaystyle
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})
Υ l m ( ω
) . These polynomial forms are calculated by
sh_eval_basis_1
in DirectXMath, and SHBasisFunction
in UE4.
Note that the direction vector
ω
→
=
[
x
y
z
]
\displaystyle \overrightarrow{\omega} =
\begin{bmatrix} x & y & z\end{bmatrix}
ω
= [ x y z ] should be
normalized before using the polynomial forms. By "13.5.3 Spherical Coordinates" of PBR
Book V3 and "Spherical Coordinates" of "3.8.3 Spherical Parameterizations" of PBR
Book V4 , we have
ω
→
=
[
x
y
z
]
=
[
sin
θ
cos
ϕ
sin
θ
sin
ϕ
cos
θ
]
\displaystyle \overrightarrow{\omega} =
\begin{bmatrix} x & y & z\end{bmatrix} = \begin{bmatrix} \sin \theta \cos \phi
& \sin \theta \sin \phi & \cos \theta \end{bmatrix}
ω
= [ x y z ] = [ sin θ cos ϕ sin θ sin ϕ cos θ ] where
ϕ
\displaystyle \phi
ϕ is the azimuth and
θ
\displaystyle \theta
θ is the zenith (in
physics, while in mathmatics
θ
\displaystyle \theta
θ is the azimuth and
ϕ
\displaystyle \phi
ϕ
is the zenith).
l
m
Υ
l
m
(
ω
→
)
\displaystyle
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})
Υ l m ( ω
)
0
0
1
2
π
=
0.282094791773878140
\displaystyle \frac{1}{2 \sqrt{\pi}} =
0.282094791773878140
2 π
1 = 0.282094791773878140
1
-1
−
3
2
π
y
=
−
0.488602511902919920
y
\displaystyle - \frac{\sqrt{3}}{2
\sqrt{\pi}} y = -0.488602511902919920 y
− 2 π
3
y = − 0.488602511902919920 y
1
0
3
2
π
z
=
0.488602511902919920
z
\displaystyle \frac{\sqrt{3}}{2
\sqrt{\pi}} z = 0.488602511902919920 z
2 π
3
z = 0.488602511902919920 z
1
1
−
3
2
π
x
=
−
0.488602511902919920
x
\displaystyle - \frac{\sqrt{3}}{2
\sqrt{\pi}} x = -0.488602511902919920 x
− 2 π
3
x = − 0.488602511902919920 x
SH Rotation
Let
R
\displaystyle \mathrm{R}
R be the rotation matrix. By "A.
Rotation of Spherical Harmonics" of "4. SPHERICAL HARMONIC REPRESENTATION" of [Ramamoorthi 2001
A], for each degree (or band) l, we have
Υ
l
m
(
R
ω
→
)
=
∑
j
=
0
2
l
D
m
j
l
(
R
)
Υ
l
j
−
l
(
ω
→
)
\displaystyle
\operatorname{\Upsilon_l^m}(\mathrm{R} \overrightarrow{\omega}) = \sum_{j = 0}^{2 l}
\operatorname{D_{mj}^l}(\mathrm{R}) \operatorname{\Upsilon_l^{j -
l}}(\overrightarrow{\omega})
Υ l m ( R ω
) = j = 0 ∑ 2 l D mj l ( R ) Υ l j − l ( ω
) where
D
l
(
R
)
\displaystyle \operatorname{D_l}(\mathrm{R})
D l ( R ) is the Wigner D-matrix .
This means that
[
Υ
l
−
l
(
R
ω
→
)
⋮
Υ
l
0
(
R
ω
→
)
⋮
Υ
l
l
(
R
ω
→
)
]
=
D
l
(
R
)
[
Υ
l
−
l
(
ω
→
)
⋮
Υ
l
0
(
ω
→
)
⋮
Υ
l
l
(
ω
→
)
]
\displaystyle \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\mathrm{R} \overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\mathrm{R} \overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\mathrm{R} \overrightarrow{\omega}) \end{bmatrix} =
\operatorname{D_l}(\mathrm{R}) \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\overrightarrow{\omega}) \end{bmatrix}
⎣
⎡ Υ l − l ( R ω
) ⋮ Υ l 0 ( R ω
) ⋮ Υ l l ( R ω
) ⎦
⎤ = D l ( R ) ⎣
⎡ Υ l − l ( ω
) ⋮ Υ l 0 ( ω
) ⋮ Υ l l ( ω
) ⎦
⎤
.
By "Appendix: SH Rotation" of [Kautz 2002], for each degree (or band) l, each element of the
Wigner D-matrix can be calculated as
D
i
j
l
(
R
)
=
∫
S
2
Υ
l
i
−
l
(
R
ω
→
)
Υ
l
j
−
l
(
ω
→
)
d
ω
→
\displaystyle \operatorname{D_{ij}^l}(\mathrm{R}) =
\int_{\mathrm{S}^2} \operatorname{\Upsilon_l^{i - l}}(\mathrm{R}
\overrightarrow{\omega}) \operatorname{\Upsilon_l^{j - l}}(\overrightarrow{\omega}) \,
d\overrightarrow{\omega}
D ij l ( R ) = ∫ S 2 Υ l i − l ( R ω
) Υ l j − l ( ω
) d ω
.
For l = 0, we have
D
00
0
=
∫
S
2
Υ
0
0
(
R
ω
→
)
Υ
0
0
(
ω
→
)
d
ω
→
=
∫
S
2
1
2
π
1
2
π
d
ω
→
=
1
4
π
∫
S
2
1
d
ω
→
=
1
4
π
4
π
=
1
\displaystyle \mathrm{D_{00}^0} =
\int_{\mathrm{S}^2} \operatorname{\Upsilon_0^0}(\mathrm{R} \overrightarrow{\omega})
\operatorname{\Upsilon_0^0}(\overrightarrow{\omega}) \, d\overrightarrow{\omega} =
\int_{\mathrm{S}^2} \frac{1}{2 \sqrt{\pi}} \frac{1}{2 \sqrt{\pi}} \,
d\overrightarrow{\omega} = \frac{1}{4\pi} \int_{\mathrm{S}^2} 1 \,
d\overrightarrow{\omega} = \frac{1}{4\pi} 4\pi = 1
D 00 0 = ∫ S 2 Υ 0 0 ( R ω
) Υ 0 0 ( ω
) d ω
= ∫ S 2 2 π
1 2 π
1 d ω
= 4 π 1 ∫ S 2 1 d ω
= 4 π 1 4 π = 1 . This means that
D
l
(
R
)
=
[
1
]
\displaystyle \operatorname{D_l}(\mathrm{R}) =
\begin{bmatrix} 1 \end{bmatrix}
D l ( R ) = [ 1 ] .
For l = 1, it is too complex to calculate the intergral for each element of the Wigner D-matrix. The
trick by [Hable 2014] can be used to calculate the Wigner D-matrix. Since the equation
[
Υ
1
−
1
(
R
ω
→
)
Υ
1
0
(
R
ω
→
)
Υ
1
1
(
R
ω
→
)
]
=
D
l
(
R
)
[
Υ
1
−
1
(
ω
→
)
Υ
1
0
(
ω
→
)
Υ
1
1
(
ω
→
)
]
\displaystyle \begin{bmatrix}
\operatorname{\Upsilon_1^{-1}}(\mathrm{R} \overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^0}(\mathrm{R} \overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^1}(\mathrm{R} \overrightarrow{\omega}) \end{bmatrix} =
\operatorname{D_l}(\mathrm{R}) \begin{bmatrix}
\operatorname{\Upsilon_1^-1}(\overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^0}(\overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^1}(\overrightarrow{\omega}) \end{bmatrix}
⎣
⎡ Υ 1 − 1 ( R ω
) Υ 1 0 ( R ω
) Υ 1 1 ( R ω
) ⎦
⎤ = D l ( R ) ⎣
⎡ Υ 1 − 1 ( ω
) Υ 1 0 ( ω
) Υ 1 1 ( ω
) ⎦
⎤
holds for arbitrary direction
ω
→
\displaystyle \overrightarrow{\omega}
ω
, we can apply this equation to three linearly independent vectors
[
1
0
0
]
\displaystyle \begin{bmatrix} 1 \\ 0 \\ 0
\end{bmatrix}
⎣
⎡ 1 0 0 ⎦
⎤
,
[
0
1
0
]
\displaystyle \begin{bmatrix} 0 \\ 1 \\ 0
\end{bmatrix}
⎣
⎡ 0 1 0 ⎦
⎤
and
[
0
0
1
]
\displaystyle \begin{bmatrix} 0 \\ 0 \\ 1
\end{bmatrix}
⎣
⎡ 0 0 1 ⎦
⎤
to construct an invertible matrix. By the polynomial forms of SH basis, we have
[
Υ
1
−
1
(
R
ω
→
)
Υ
1
0
(
R
ω
→
)
Υ
1
1
(
R
ω
→
)
]
=
D
l
(
R
)
[
Υ
1
−
1
(
ω
→
)
Υ
1
0
(
ω
→
)
Υ
1
1
(
ω
→
)
]
⇒
\displaystyle \begin{bmatrix}
\operatorname{\Upsilon_1^{-1}}(\mathrm{R} \overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^0}(\mathrm{R} \overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^1}(\mathrm{R} \overrightarrow{\omega}) \end{bmatrix} =
\operatorname{D_l}(\mathrm{R}) \begin{bmatrix}
\operatorname{\Upsilon_1^-1}(\overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^0}(\overrightarrow{\omega}) \\
\operatorname{\Upsilon_1^1}(\overrightarrow{\omega}) \end{bmatrix} \Rightarrow
⎣
⎡ Υ 1 − 1 ( R ω
) Υ 1 0 ( R ω
) Υ 1 1 ( R ω
) ⎦
⎤ = D l ( R ) ⎣
⎡ Υ 1 − 1 ( ω
) Υ 1 0 ( ω
) Υ 1 1 ( ω
) ⎦
⎤ ⇒
[
0
−
3
2
π
0
0
0
3
2
π
−
3
2
π
0
0
]
R
ω
→
=
D
l
(
R
)
[
0
−
3
2
π
0
0
0
3
2
π
−
3
2
π
0
0
]
ω
→
⇒
[
0
−
3
2
π
0
0
0
3
2
π
−
3
2
π
0
0
]
R
[
1
0
0
0
1
0
0
0
1
]
=
D
l
(
R
)
[
0
−
3
2
π
0
0
0
3
2
π
−
3
2
π
0
0
]
[
1
0
0
0
1
0
0
0
1
]
\displaystyle \color{red} \begin{bmatrix} 0 & -
\frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 \\ 0 & 0 & \frac{\sqrt{3}}{2 \sqrt{\pi}}
\\ - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 & 0 \end{bmatrix} \mathrm{R}
\color{green} \overrightarrow{\omega} \color{red} = \operatorname{D_l}(\mathrm{R})
\begin{bmatrix} 0 & - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 \\ 0 & 0 &
\frac{\sqrt{3}}{2 \sqrt{\pi}} \\ - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 & 0
\end{bmatrix} \color{green} \overrightarrow{\omega} \color{red} \Rightarrow
\begin{bmatrix} 0 & - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 \\ 0 & 0 &
\frac{\sqrt{3}}{2 \sqrt{\pi}} \\ - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 & 0
\end{bmatrix} \mathrm{R} \color{green} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1
& 0 \\ 0 & 0 & 1 \end{bmatrix} \color{red} = \operatorname{D_l}(\mathrm{R})
\begin{bmatrix} 0 & - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 \\ 0 & 0 &
\frac{\sqrt{3}}{2 \sqrt{\pi}} \\ - \frac{\sqrt{3}}{2 \sqrt{\pi}} & 0 & 0
\end{bmatrix} \color{green} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0
& 0 & 1 \end{bmatrix} \color{red}
⎣
⎡ 0 0 − 2 π
3
− 2 π
3
0 0 0 2 π
3
0 ⎦
⎤ R ω
= D l ( R ) ⎣
⎡ 0 0 − 2 π
3
− 2 π
3
0 0 0 2 π
3
0 ⎦
⎤ ω
⇒ ⎣
⎡ 0 0 − 2 π
3
− 2 π
3
0 0 0 2 π
3
0 ⎦
⎤ R ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤ = D l ( R ) ⎣
⎡ 0 0 − 2 π
3
− 2 π
3
0 0 0 2 π
3
0 ⎦
⎤ ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤
⇒
[
0
−
1
0
0
0
1
−
1
0
0
]
R
[
1
0
0
0
1
0
0
0
1
]
=
D
l
(
R
)
[
0
−
1
0
0
0
1
−
1
0
0
]
[
1
0
0
0
1
0
0
0
1
]
\displaystyle \Rightarrow \begin{bmatrix} 0 &
-1 & 0 \\ 0 & 0 & 1 \\ -1 & 0 & 0 \end{bmatrix} \mathrm{R}
\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1
\end{bmatrix} = \operatorname{D_l}(\mathrm{R}) \begin{bmatrix} 0 & -1 & 0 \\ 0
& 0 & 1 \\ -1 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\
0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}
⇒ ⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ R ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤ = D l ( R ) ⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤
. Evidently,
[
0
−
1
0
0
0
1
−
1
0
0
]
[
1
0
0
0
1
0
0
0
1
]
\displaystyle \begin{bmatrix} 0 & -1 & 0 \\
0 & 0 & 1 \\ -1 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0
\\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}
⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤
is invertible and we have
D
l
(
R
)
=
[
0
−
1
0
0
0
1
−
1
0
0
]
R
[
1
0
0
0
1
0
0
0
1
]
(
[
0
−
1
0
0
0
1
−
1
0
0
]
[
1
0
0
0
1
0
0
0
1
]
)
−
1
=
[
0
−
1
0
0
0
1
−
1
0
0
]
R
[
1
0
0
0
1
0
0
0
1
]
[
0
0
−
1
−
1
0
0
0
1
0
]
=
[
0
−
1
0
0
0
1
−
1
0
0
]
R
[
0
0
−
1
−
1
0
0
0
1
0
]
=
[
−
R
10
−
R
11
−
R
12
R
20
R
21
R
22
−
R
00
−
R
01
−
R
02
]
[
0
0
−
1
−
1
0
0
0
1
0
]
=
[
R
11
−
R
12
R
10
−
R
21
R
22
−
R
20
R
01
−
R
02
R
00
]
\displaystyle \operatorname{D_l}(\mathrm{R}) =
\begin{bmatrix} 0 & -1 & 0 \\ 0 & 0 & 1 \\ -1 & 0 & 0
\end{bmatrix} \mathrm{R} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0
& 0 & 1 \end{bmatrix} {\left \lparen \begin{bmatrix} 0 & -1 & 0 \\ 0
& 0 & 1 \\ -1 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\
0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \right \rparen}^{-1} =
\begin{bmatrix} 0 & -1 & 0 \\ 0 & 0 & 1 \\ -1 & 0 & 0
\end{bmatrix} \mathrm{R} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0
& 0 & 1 \end{bmatrix} \begin{bmatrix} 0 & 0 & -1 \\ -1 & 0 & 0
\\ 0 & 1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & -1 & 0 \\ 0 & 0
& 1 \\ -1 & 0 & 0 \end{bmatrix} \mathrm{R} \begin{bmatrix} 0 & 0 &
-1 \\ -1 & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix} = \begin{bmatrix}
-{\mathrm{R}}_{10} & -{\mathrm{R}}_{11} & -{\mathrm{R}}_{12} \\
{\mathrm{R}}_{20} & {\mathrm{R}}_{21} & {\mathrm{R}}_{22} \\ -{\mathrm{R}}_{00}
& -{\mathrm{R}}_{01} & -{\mathrm{R}}_{02} \end{bmatrix} \begin{bmatrix} 0 &
0 & -1 \\ -1 & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix} = \begin{bmatrix}
{\mathrm{R}}_{11} & -{\mathrm{R}}_{12} & {\mathrm{R}}_{10} \\ -{\mathrm{R}}_{21}
& {\mathrm{R}}_{22} & -{\mathrm{R}}_{20} \\ {\mathrm{R}}_{01} &
-{\mathrm{R}}_{02} & {\mathrm{R}}_{00} \end{bmatrix}
D l ( R ) = ⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ R ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤ ⎝
⎛ ⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤ ⎠
⎞ − 1 = ⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ R ⎣
⎡ 1 0 0 0 1 0 0 0 1 ⎦
⎤ ⎣
⎡ 0 − 1 0 0 0 1 − 1 0 0 ⎦
⎤ = ⎣
⎡ 0 0 − 1 − 1 0 0 0 1 0 ⎦
⎤ R ⎣
⎡ 0 − 1 0 0 0 1 − 1 0 0 ⎦
⎤ = ⎣
⎡ − R 10 R 20 − R 00 − R 11 R 21 − R 01 − R 12 R 22 − R 02 ⎦
⎤ ⎣
⎡ 0 − 1 0 0 0 1 − 1 0 0 ⎦
⎤ = ⎣
⎡ R 11 − R 21 R 01 − R 12 R 22 − R 02 R 10 − R 20 R 00 ⎦
⎤
.
The Wigner D-matrix is calculated by DirectX::XMSHRotate
and DirectX::XMSHRotateZ
in DirectXMath.
l
D
l
(
R
)
\displaystyle
\operatorname{D_l}(\mathrm{R})
D l ( R )
0
[
1
]
\displaystyle \begin{bmatrix} 1
\end{bmatrix}
[ 1 ]
1
[
R
11
−
R
12
R
10
−
R
21
R
22
−
R
20
R
01
−
R
02
R
00
]
\displaystyle \begin{bmatrix}
{\mathrm{R}}_{11} & -{\mathrm{R}}_{12} & {\mathrm{R}}_{10} \\
-{\mathrm{R}}_{21} & {\mathrm{R}}_{22} & -{\mathrm{R}}_{20} \\
{\mathrm{R}}_{01} & -{\mathrm{R}}_{02} & {\mathrm{R}}_{00}
\end{bmatrix}
⎣
⎡ R 11 − R 21 R 01 − R 12 R 22 − R 02 R 10 − R 20 R 00 ⎦
⎤
SH Projection
Let
S
H
\displaystyle \operatorname{\mathcal{SH}}
S H be
the SH (Spherical Harmonics) projection operation . Analogous to the Fourier
transform , we have
f
l
m
=
S
H
(
f
(
ω
→
)
)
=
∫
S
2
f
(
ω
→
)
Υ
l
m
(
ω
→
)
d
ω
→
\displaystyle f_l^m =
\operatorname{\mathcal{SH}}(\operatorname{f}(\overrightarrow{\omega})) =
\int_{\mathrm{S}^2} \operatorname{f}(\overrightarrow{\omega})
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) \, d\overrightarrow{\omega}
f l m = S H ( f ( ω
)) = ∫ S 2 f ( ω
) Υ l m ( ω
) d ω
, and the original function can be reconstructed as the SH series
f
(
ω
→
)
=
∑
l
=
0
∞
∑
m
=
−
l
l
f
l
m
Υ
l
m
(
ω
→
)
=
∑
l
=
0
∞
[
f
l
−
l
⋯
f
l
0
⋯
f
l
l
]
[
Υ
l
−
l
(
ω
→
)
⋮
Υ
l
0
(
ω
→
)
⋮
Υ
l
l
(
ω
→
)
]
\displaystyle
\operatorname{f}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin} \sum_{m = -l}^l f_l^m
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin}
\begin{bmatrix} f_l^{-l} & \cdots & f_l^0 & \cdots & f_l^l \end{bmatrix}
\begin{bmatrix} \operatorname{\Upsilon_l^{-l}}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\overrightarrow{\omega}) \end{bmatrix}
f ( ω
) = l = 0 ∑ ∞ m = − l ∑ l f l m Υ l m ( ω
) = l = 0 ∑ ∞ [ f l − l ⋯ f l 0 ⋯ f l l ] ⎣
⎡ Υ l − l ( ω
) ⋮ Υ l 0 ( ω
) ⋮ Υ l l ( ω
) ⎦
⎤
.
SH Rotational Invariance
Let
R
\displaystyle \mathrm{R}
R be the rotation matrix. Let
f
′
(
ω
→
)
=
f
(
R
ω
→
)
\displaystyle
\operatorname{f'}(\overrightarrow{\omega}) =
\operatorname{f}(\mathrm{R}\overrightarrow{\omega})
f ′ ( ω
) = f ( R ω
) and
f
′
(
ω
→
)
=
∑
l
=
0
∞
∑
m
=
−
l
l
f
′
l
m
Υ
l
m
(
ω
→
)
\displaystyle
\operatorname{f'}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin} \sum_{m = -l}^l
{f'}_l^m \operatorname{\Upsilon_l^m}(\overrightarrow{\omega})
f ′ ( ω
) = l = 0 ∑ ∞ m = − l ∑ l f ′ l m Υ l m ( ω
) . By "Basic Properties" of
"3. Review of Spherical Harmonics" of [Sloan 2002], we have
[
f
′
l
−
l
⋯
f
′
l
0
⋯
f
′
l
l
]
=
[
f
l
−
l
⋯
f
l
0
⋯
f
l
l
]
D
l
(
R
)
\displaystyle \begin{bmatrix} {f'}_l^{-l}
& \cdots & {f'}_l^0 & \cdots & {f'}_l^l \end{bmatrix} =
\begin{bmatrix} f_l^{-l} & \cdots & f_l^0 & \cdots & f_l^l \end{bmatrix}
\operatorname{D_l}(\mathrm{R})
[ f ′ l − l ⋯ f ′ l 0 ⋯ f ′ l l ] = [ f l − l ⋯ f l 0 ⋯ f l l ] D l ( R ) where
D
l
(
R
)
\displaystyle \operatorname{D_l}(\mathrm{R})
D l ( R ) is the Wigner D-matrix.
Proof
By "SH Projection", we have
f
(
ω
→
)
=
∑
l
=
0
∞
∑
m
=
−
l
l
f
l
m
Υ
l
m
(
ω
→
)
=
∑
l
=
0
∞
[
f
l
−
l
⋯
f
l
0
⋯
f
l
l
]
[
Υ
l
−
l
(
ω
→
)
⋮
Υ
l
0
(
ω
→
)
⋮
Υ
l
l
(
ω
→
)
]
\displaystyle
\operatorname{f}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin} \sum_{m = -l}^l
f_l^m \operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin}
\begin{bmatrix} f_l^{-l} & \cdots & f_l^0 & \cdots & f_l^l
\end{bmatrix} \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\overrightarrow{\omega}) \end{bmatrix}
f ( ω
) = l = 0 ∑ ∞ m = − l ∑ l f l m Υ l m ( ω
) = l = 0 ∑ ∞ [ f l − l ⋯ f l 0 ⋯ f l l ] ⎣
⎡ Υ l − l ( ω
) ⋮ Υ l 0 ( ω
) ⋮ Υ l l ( ω
) ⎦
⎤
.
By "SH Rotation", we have
[
Υ
l
−
l
(
R
ω
→
)
⋮
Υ
l
0
(
R
ω
→
)
⋮
Υ
l
l
(
R
ω
→
)
]
=
D
l
(
R
)
[
Υ
l
−
l
(
ω
→
)
⋮
Υ
l
0
(
ω
→
)
⋮
Υ
l
l
(
ω
→
)
]
\displaystyle \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\mathrm{R} \overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\mathrm{R} \overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\mathrm{R} \overrightarrow{\omega}) \end{bmatrix} =
\operatorname{D_l}(\mathrm{R}) \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\overrightarrow{\omega}) \end{bmatrix}
⎣
⎡ Υ l − l ( R ω
) ⋮ Υ l 0 ( R ω
) ⋮ Υ l l ( R ω
) ⎦
⎤ = D l ( R ) ⎣
⎡ Υ l − l ( ω
) ⋮ Υ l 0 ( ω
) ⋮ Υ l l ( ω
) ⎦
⎤
.
This means that
f
′
(
ω
→
)
=
f
(
R
ω
→
)
=
∑
l
=
0
∞
[
f
l
−
l
⋯
f
l
0
⋯
f
l
l
]
[
Υ
l
−
l
(
R
ω
→
)
⋮
Υ
l
0
(
R
ω
→
)
⋮
Υ
l
l
(
R
ω
→
)
]
=
∑
l
=
0
∞
[
f
l
−
l
⋯
f
l
0
⋯
f
l
l
]
D
l
(
R
)
[
Υ
l
−
l
(
ω
→
)
⋮
Υ
l
0
(
ω
→
)
⋮
Υ
l
l
(
ω
→
)
]
\displaystyle
\operatorname{f'}(\overrightarrow{\omega}) =
\operatorname{f}(\mathrm{R}\overrightarrow{\omega}) = \sum_{l = 0}^{\infin}
\begin{bmatrix} f_l^{-l} & \cdots & f_l^0 & \cdots & f_l^l
\end{bmatrix} \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\mathrm{R}\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\mathrm{R}\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\mathrm{R}\overrightarrow{\omega}) \end{bmatrix} =
\sum_{l = 0}^{\infin} \begin{bmatrix} f_l^{-l} & \cdots & f_l^0 & \cdots
& f_l^l \end{bmatrix} \operatorname{D_l}(\mathrm{R}) \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\overrightarrow{\omega}) \end{bmatrix}
f ′ ( ω
) = f ( R ω
) = l = 0 ∑ ∞ [ f l − l ⋯ f l 0 ⋯ f l l ] ⎣
⎡ Υ l − l ( R ω
) ⋮ Υ l 0 ( R ω
) ⋮ Υ l l ( R ω
) ⎦
⎤ = l = 0 ∑ ∞ [ f l − l ⋯ f l 0 ⋯ f l l ] D l ( R ) ⎣
⎡ Υ l − l ( ω
) ⋮ Υ l 0 ( ω
) ⋮ Υ l l ( ω
) ⎦
⎤
where
D
l
(
R
)
\displaystyle \operatorname{D_l}(\mathrm{R})
D l ( R ) is the Wigner D-matrix.
Since
f
′
(
ω
→
)
=
∑
l
=
0
∞
∑
m
=
−
l
l
f
′
l
m
Υ
l
m
(
ω
→
)
=
∑
l
=
0
∞
[
f
′
l
−
l
⋯
f
′
l
0
⋯
f
′
l
l
]
[
Υ
l
−
l
(
ω
→
)
⋮
Υ
l
0
(
ω
→
)
⋮
Υ
l
l
(
ω
→
)
]
\displaystyle
\operatorname{f'}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin} \sum_{m =
-l}^l {f'}_l^m \operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) = \sum_{l =
0}^{\infin} \begin{bmatrix} {f'}_l^{-l} & \cdots & {f'}_l^0 &
\cdots & {f'}_l^l \end{bmatrix} \begin{bmatrix}
\operatorname{\Upsilon_l^{-l}}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^0}(\overrightarrow{\omega}) \\ \vdots \\
\operatorname{\Upsilon_l^l}(\overrightarrow{\omega}) \end{bmatrix}
f ′ ( ω
) = l = 0 ∑ ∞ m = − l ∑ l f ′ l m Υ l m ( ω
) = l = 0 ∑ ∞ [ f ′ l − l ⋯ f ′ l 0 ⋯ f ′ l l ] ⎣
⎡ Υ l − l ( ω
) ⋮ Υ l 0 ( ω
) ⋮ Υ l l ( ω
) ⎦
⎤
, we have
[
f
′
l
−
l
⋯
f
′
l
0
⋯
f
′
l
l
]
=
[
f
l
−
l
⋯
f
l
0
⋯
f
l
l
]
D
l
(
R
)
\displaystyle \begin{bmatrix} {f'}_l^{-l}
& \cdots & {f'}_l^0 & \cdots & {f'}_l^l \end{bmatrix} =
\begin{bmatrix} f_l^{-l} & \cdots & f_l^0 & \cdots & f_l^l
\end{bmatrix} \operatorname{D_l}(\mathrm{R})
[ f ′ l − l ⋯ f ′ l 0 ⋯ f ′ l l ] = [ f l − l ⋯ f l 0 ⋯ f l l ] D l ( R ) .
SH Product Integration
Let
f
(
ω
→
)
=
∑
l
=
0
∞
∑
m
=
−
l
l
f
l
m
Υ
l
m
(
ω
→
)
\displaystyle
\operatorname{f}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin} \sum_{m = -l}^l f_l^m
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})
f ( ω
) = l = 0 ∑ ∞ m = − l ∑ l f l m Υ l m ( ω
) and
g
(
ω
→
)
=
∑
l
=
0
∞
∑
m
=
−
l
l
g
l
m
Υ
l
m
(
ω
→
)
\displaystyle
\operatorname{g}(\overrightarrow{\omega}) = \sum_{l = 0}^{\infin} \sum_{m = -l}^l g_l^m
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})
g ( ω
) = l = 0 ∑ ∞ m = − l ∑ l g l m Υ l m ( ω
) . By "Basic Properties" of
"3. Review of Spherical Harmonics" of [Sloan 2002], due to the orthonormality of the SH basis, we have
∫
S
2
f
(
ω
→
)
g
(
ω
→
)
d
ω
→
=
∫
S
2
(
∑
l
=
0
∞
∑
m
=
−
l
l
f
l
m
Υ
l
m
(
ω
→
)
)
(
∑
l
=
0
∞
∑
m
=
−
l
l
g
l
m
Υ
l
m
(
ω
→
)
)
d
ω
→
=
∑
l
=
0
∞
∑
m
=
−
l
l
f
l
m
g
l
m
\displaystyle \int_{\mathrm{S}^2}
\operatorname{f}(\overrightarrow{\omega}) \operatorname{g}(\overrightarrow{\omega}) \,
d\overrightarrow{\omega} = \int_{\mathrm{S}^2} \left \lparen \sum_{l = 0}^{\infin}
\sum_{m = -l}^l f_l^m \operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) \right
\rparen \left \lparen \sum_{l = 0}^{\infin} \sum_{m = -l}^l g_l^m
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) \right \rparen \,
d\overrightarrow{\omega} = \sum_{l = 0}^{\infin} \sum_{m = -l}^l f_l^m g_l^m
∫ S 2 f ( ω
) g ( ω
) d ω
= ∫ S 2 ( l = 0 ∑ ∞ m = − l ∑ l f l m Υ l m ( ω
) ) ( l = 0 ∑ ∞ m = − l ∑ l g l m Υ l m ( ω
) ) d ω
= l = 0 ∑ ∞ m = − l ∑ l f l m g l m
.
SH Product Projection
Actually, "SH Product Projection" is related to the Clebsch–Gordan
coefficients which is too complex to be used in rendering. We only need to know that "SH
Product Projection" should be distinguished from "SH Product Integration".
Let
h
(
ω
→
)
=
f
(
ω
→
)
g
(
ω
→
)
\displaystyle
\operatorname{h}(\overrightarrow{\omega}) = \operatorname{f}(\overrightarrow{\omega})
\operatorname{g}(\overrightarrow{\omega})
h ( ω
) = f ( ω
) g ( ω
) . By "Product Projection" of
"3. Review of Spherical Harmonics" of [Sloan 2002], we have that
h
l
m
=
∫
S
2
h
(
ω
→
)
Υ
l
m
(
ω
→
)
d
ω
→
=
∫
S
2
f
(
ω
→
)
g
(
ω
→
)
Υ
l
m
(
ω
→
)
d
ω
→
≠
∫
S
2
f
(
ω
→
)
g
(
ω
→
)
d
ω
→
\displaystyle h_l^m = \int_{\mathrm{S}^2}
\operatorname{h}(\overrightarrow{\omega})
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) \, d\overrightarrow{\omega} =
\int_{\mathrm{S}^2} \operatorname{f}(\overrightarrow{\omega})
\operatorname{g}(\overrightarrow{\omega})
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega}) \, d\overrightarrow{\omega} \ne
\int_{\mathrm{S}^2} \operatorname{f}(\overrightarrow{\omega})
\operatorname{g}(\overrightarrow{\omega}) \, d\overrightarrow{\omega}
h l m = ∫ S 2 h ( ω
) Υ l m ( ω
) d ω
= ∫ S 2 f ( ω
) g ( ω
) Υ l m ( ω
) d ω
= ∫ S 2 f ( ω
) g ( ω
) d ω
which is totally different from "SH Product Integration".
SH Analytic Light
Light Distribution
By "SH Light Sources" of [Green 2003], the light position is at the Z axis and the light
distribution at the shading position is
L
(
ω
→
)
=
{
1
θ
<
α
0
θ
≥
α
\displaystyle
\operatorname{L}(\overrightarrow{\omega}) = \begin{cases} 1 & \theta < \alpha \\
0 & \theta \geq \alpha \end{cases}
L ( ω
) = { 1 0 θ < α θ ≥ α where
α
\displaystyle \alpha
α is the cone angle.
Due to circular symmetry of the light distribution at the shading position, only the coefficients on
the ZH(Zonal Harmonics) of the light distribution are non-zero.
By "Appendix A3 ZH Coefficients for Spherical Light Source" of [Sloan 2008], we have the
coefficients on the ZH(Zonal Harmonics) of the light distribution.
By "13.5.3 Spherical Coordinates" of PBR
Book V3 and "Equation (2.23)" of PBR
Book V4 , we have
∫
Ω
α
f
(
ω
→
)
d
ω
→
=
∫
0
2
π
(
∫
0
α
f
(
θ
,
ϕ
)
sin
θ
d
θ
)
d
ϕ
\displaystyle \int_{\Omega_\alpha}
\operatorname{f}(\overrightarrow{\omega}) \, d \overrightarrow{\omega} = \int_0^{2\pi}
\left\lparen \int_0^{\alpha} \operatorname{f}(\theta, \phi) \sin \theta \, d \theta
\right\rparen \, d \phi
∫ Ω α f ( ω
) d ω
= ∫ 0 2 π ( ∫ 0 α f ( θ , ϕ ) sin θ d θ ) d ϕ
.
For l = 0, we have
L
0
=
∫
S
2
L
(
ω
→
)
Υ
0
0
(
ω
→
)
d
ω
→
=
∫
S
2
L
(
ω
→
)
1
2
π
d
ω
→
=
1
2
π
∫
S
2
L
(
ω
→
)
d
ω
→
=
1
2
π
∫
Ω
α
1
d
ω
→
=
1
2
π
∫
0
2
π
(
∫
0
α
sin
θ
d
θ
)
d
ϕ
=
1
2
π
∫
0
2
π
(
(
−
cos
α
)
−
(
−
cos
0
)
)
d
ϕ
=
1
2
π
∫
0
2
π
(
1
−
cos
α
)
d
ϕ
=
1
2
π
(
1
−
cos
α
)
∫
0
2
π
1
d
ϕ
=
1
2
π
(
1
−
cos
α
)
2
π
=
π
(
1
−
cos
α
)
\displaystyle \mathrm{L_0} = \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega})
\operatorname{\Upsilon_0^0}(\overrightarrow{\omega}) \, d \overrightarrow{\omega} =
\int_{\mathrm{S}^2} \operatorname{L}(\overrightarrow{\omega}) \frac{1}{2 \sqrt{\pi}} \,
d \overrightarrow{\omega} = \frac{1}{2 \sqrt{\pi}} \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega}) \, d \overrightarrow{\omega} = \frac{1}{2
\sqrt{\pi}} \int_{\Omega_\alpha} 1 \, d \overrightarrow{\omega} = \frac{1}{2 \sqrt{\pi}}
\int_0^{2\pi} \left\lparen \int_0^{\alpha} \sin \theta \, d \theta \right\rparen \, d
\phi = \frac{1}{2 \sqrt{\pi}} \int_0^{2\pi} ( (-\cos \alpha) - (-\cos 0) ) \, d \phi =
\frac{1}{2 \sqrt{\pi}} \int_0^{2\pi} (1 - \cos \alpha) \, d \phi = \frac{1}{2
\sqrt{\pi}} (1 - \cos \alpha) \int_0^{2\pi} 1 \, d \phi = \frac{1}{2 \sqrt{\pi}} (1 -
\cos \alpha) 2 \pi = \sqrt{\pi} (1 - \cos \alpha)
L 0 = ∫ S 2 L ( ω
) Υ 0 0 ( ω
) d ω
= ∫ S 2 L ( ω
) 2 π
1 d ω
= 2 π
1 ∫ S 2 L ( ω
) d ω
= 2 π
1 ∫ Ω α 1 d ω
= 2 π
1 ∫ 0 2 π ( ∫ 0 α sin θ d θ ) d ϕ = 2 π
1 ∫ 0 2 π (( − cos α ) − ( − cos 0 )) d ϕ = 2 π
1 ∫ 0 2 π ( 1 − cos α ) d ϕ = 2 π
1 ( 1 − cos α ) ∫ 0 2 π 1 d ϕ = 2 π
1 ( 1 − cos α ) 2 π = π
( 1 − cos α )
.
For l = 1, we have
L
1
=
∫
S
2
L
(
ω
→
)
Υ
1
0
(
ω
→
)
d
ω
→
=
∫
S
2
L
(
ω
→
)
3
2
π
z
d
ω
→
=
3
2
π
∫
S
2
L
(
ω
→
)
z
d
ω
→
=
3
2
π
∫
Ω
α
cos
θ
d
ω
→
=
3
2
π
∫
0
2
π
(
∫
0
α
cos
θ
sin
θ
d
θ
)
d
ϕ
=
3
2
π
∫
0
2
π
(
∫
0
α
cos
θ
sin
θ
d
θ
)
d
ϕ
=
3
2
π
∫
0
2
π
(
sin
2
α
2
−
sin
2
0
2
)
d
ϕ
=
3
2
π
∫
0
2
π
sin
2
α
2
d
ϕ
=
3
2
π
sin
2
α
2
∫
0
2
π
1
d
ϕ
=
3
2
π
sin
2
α
2
2
π
=
3
π
2
sin
2
α
\displaystyle \mathrm{L_1} = \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega})
\operatorname{\Upsilon_1^0}(\overrightarrow{\omega}) \, d \overrightarrow{\omega} =
\int_{\mathrm{S}^2} \operatorname{L}(\overrightarrow{\omega}) \frac{\sqrt{3}}{2
\sqrt{\pi}} z \, d \overrightarrow{\omega} = \frac{\sqrt{3}}{2 \sqrt{\pi}}
\int_{\mathrm{S}^2} \operatorname{L}(\overrightarrow{\omega}) z \, d
\overrightarrow{\omega} = \frac{\sqrt{3}}{2 \sqrt{\pi}} \int_{\Omega_\alpha} \cos \theta
\, d \overrightarrow{\omega} = \frac{\sqrt{3}}{2 \sqrt{\pi}} \int_0^{2\pi} \left\lparen
\int_0^{\alpha} \cos \theta \sin \theta \, d \theta \right\rparen \, d \phi =
\frac{\sqrt{3}}{2 \sqrt{\pi}} \int_0^{2\pi} \left\lparen \int_0^{\alpha} \cos \theta
\sin \theta \, d \theta \right\rparen \, d \phi = \frac{\sqrt{3}}{2 \sqrt{\pi}}
\int_0^{2\pi} \left\lparen \frac{\sin^2 \alpha}{2} - \frac{\sin^2 0}{2} \right\rparen \,
d \phi = \frac{\sqrt{3}}{2 \sqrt{\pi}} \int_0^{2\pi} \frac{\sin^2 \alpha}{2} \, d \phi =
\frac{\sqrt{3}}{2 \sqrt{\pi}} \frac{\sin^2 \alpha}{2} \int_0^{2\pi} 1 \, d \phi =
\frac{\sqrt{3}}{2 \sqrt{\pi}} \frac{\sin^2 \alpha}{2} 2 \pi = \frac{\sqrt{3}
\sqrt{\pi}}{2} \sin^2 \alpha
L 1 = ∫ S 2 L ( ω
) Υ 1 0 ( ω
) d ω
= ∫ S 2 L ( ω
) 2 π
3
z d ω
= 2 π
3
∫ S 2 L ( ω
) z d ω
= 2 π
3
∫ Ω α cos θ d ω
= 2 π
3
∫ 0 2 π ( ∫ 0 α cos θ sin θ d θ ) d ϕ = 2 π
3
∫ 0 2 π ( ∫ 0 α cos θ sin θ d θ ) d ϕ = 2 π
3
∫ 0 2 π ( 2 sin 2 α − 2 sin 2 0 ) d ϕ = 2 π
3
∫ 0 2 π 2 sin 2 α d ϕ = 2 π
3
2 sin 2 α ∫ 0 2 π 1 d ϕ = 2 π
3
2 sin 2 α 2 π = 2 3
π
sin 2 α .
The coefficients on the ZH(Zonal Harmonics) of the light distribution is calculated by ComputeCapInt in
DirectXMath.
Transfer Function
By "Normalization" of [Sloan 2008], the normalized clamped cosine
1
π
(
cos
θ
)
+
\displaystyle \frac{1}{\pi} (\cos \theta)^+
π 1 ( cos θ ) +
can be used as the transfer function ([Sloan 2002]).
Due to circular symmetry of the normalized clamped cosine, only the coefficients on the ZH(Zonal
Harmonics) of the normalized clamped cosine are non-zero.
By "Equation (8)" of [Ramamoorthi 2001 B] and "Normalization" of [Sloan 2008], we
have the coefficients on the ZH(Zonal Harmonics) of the light distribution.
For l = 0, by "5.5.1 Integrals over Projected Solid Angle" of PBR
Book V3 and "4.2.1 Integrals over Projected Solid Angle" of PBR
Book V4 , we have
T
0
=
∫
S
2
1
π
(
cos
θ
)
+
Υ
0
0
(
ω
→
)
d
ω
→
=
∫
S
2
1
π
(
cos
θ
)
+
1
2
π
d
ω
→
=
1
π
1
2
π
∫
S
2
(
cos
θ
)
+
d
ω
→
=
1
π
1
2
π
∫
H
2
1
d
ω
⊥
→
=
1
π
1
2
π
π
=
1
2
π
\displaystyle T_0 = \int_{\mathrm{S}^2}
\frac{1}{\pi} (\cos \theta)^+ \operatorname{\Upsilon_0^0}(\overrightarrow{\omega}) \, d
\overrightarrow{\omega} = \int_{\mathrm{S}^2} \frac{1}{\pi} (\cos \theta)^+ \frac{1}{2
\sqrt{\pi}} \, d \overrightarrow{\omega} = \frac{1}{\pi} \frac{1}{2
\sqrt{\pi}}\int_{\mathrm{S}^2} (\cos \theta)^+ \, d \overrightarrow{\omega} =
\frac{1}{\pi} \frac{1}{2 \sqrt{\pi}} \int_{\mathcal{H}^2} 1 \, d
\overrightarrow{\omega^{\perp}} = \frac{1}{\pi} \frac{1}{2 \sqrt{\pi}} \pi = \frac{1}{2
\sqrt{\pi}}
T 0 = ∫ S 2 π 1 ( cos θ ) + Υ 0 0 ( ω
) d ω
= ∫ S 2 π 1 ( cos θ ) + 2 π
1 d ω
= π 1 2 π
1 ∫ S 2 ( cos θ ) + d ω
= π 1 2 π
1 ∫ H 2 1 d ω ⊥
= π 1 2 π
1 π = 2 π
1
For l = 1, we have
T
1
=
∫
S
2
1
π
(
cos
θ
)
+
Υ
1
0
(
ω
→
)
d
ω
→
=
∫
S
2
1
π
(
cos
θ
)
+
3
2
π
z
d
ω
→
=
1
π
3
2
π
∫
S
2
(
cos
θ
)
+
z
d
ω
→
=
1
π
3
2
π
∫
H
2
cos
θ
cos
θ
d
ω
→
=
1
π
3
2
π
∫
0
2
π
(
∫
0
π
2
cos
θ
cos
θ
sin
θ
d
θ
)
d
ϕ
=
1
π
3
2
π
∫
0
2
π
(
(
−
cos
3
π
2
3
)
−
(
−
cos
3
0
3
)
)
d
ϕ
=
1
π
3
2
π
∫
0
2
π
1
3
d
ϕ
=
1
π
3
2
π
1
3
∫
0
2
π
1
d
ϕ
=
1
π
3
2
π
1
3
2
π
=
3
3
π
\displaystyle \mathrm{T_1} = \int_{\mathrm{S}^2}
\frac{1}{\pi} (\cos \theta)^+ \operatorname{\Upsilon_1^0}(\overrightarrow{\omega}) \, d
\overrightarrow{\omega} = \int_{\mathrm{S}^2} \frac{1}{\pi} (\cos \theta)^+
\frac{\sqrt{3}}{2 \sqrt{\pi}} z \, d \overrightarrow{\omega} = \frac{1}{\pi}
\frac{\sqrt{3}}{2 \sqrt{\pi}} \int_{\mathrm{S}^2} (\cos \theta)^+ z \, d
\overrightarrow{\omega} = \frac{1}{\pi} \frac{\sqrt{3}}{2 \sqrt{\pi}}
\int_{\mathcal{H}^2} \cos \theta \cos \theta \, d \overrightarrow{\omega} =
\frac{1}{\pi} \frac{\sqrt{3}}{2 \sqrt{\pi}} \int_0^{2\pi} \left\lparen
\int_0^{\frac{\pi}{2}} \cos \theta \cos \theta \sin \theta \, d \theta \right\rparen \,
d \phi = \frac{1}{\pi} \frac{\sqrt{3}}{2 \sqrt{\pi}} \int_0^{2\pi} \left\lparen
\left\lparen -\frac{\cos^3 \frac{\pi}{2}}{3} \right\rparen - \left\lparen -\frac{\cos^3
0}{3} \right\rparen \right\rparen \, d \phi = \frac{1}{\pi} \frac{\sqrt{3}}{2
\sqrt{\pi}} \int_0^{2\pi} \frac{1}{3} \, d \phi = \frac{1}{\pi} \frac{\sqrt{3}}{2
\sqrt{\pi}} \frac{1}{3} \int_0^{2\pi} 1 \, d \phi = \frac{1}{\pi} \frac{\sqrt{3}}{2
\sqrt{\pi}} \frac{1}{3} 2\pi = \frac{\sqrt{3}}{3 \sqrt{\pi}}
T 1 = ∫ S 2 π 1 ( cos θ ) + Υ 1 0 ( ω
) d ω
= ∫ S 2 π 1 ( cos θ ) + 2 π
3
z d ω
= π 1 2 π
3
∫ S 2 ( cos θ ) + z d ω
= π 1 2 π
3
∫ H 2 cos θ cos θ d ω
= π 1 2 π
3
∫ 0 2 π ( ∫ 0 2 π cos θ cos θ sin θ d θ ) d ϕ = π 1 2 π
3
∫ 0 2 π ( ( − 3 cos 3 2 π ) − ( − 3 cos 3 0 ) ) d ϕ = π 1 2 π
3
∫ 0 2 π 3 1 d ϕ = π 1 2 π
3
3 1 ∫ 0 2 π 1 d ϕ = π 1 2 π
3
3 1 2 π = 3 π
3
.
Product
By "Basic Properties" of "3. Review of Spherical Harmonics" of [Sloan 2002], due
to the orthonormality of the SH basis, we have
∫
S
2
L
(
ω
→
)
1
π
(
cos
θ
)
+
d
ω
→
=
∫
S
2
(
∑
L
l
m
Υ
l
m
(
ω
→
)
)
(
∑
T
l
m
Υ
l
m
(
ω
→
)
)
d
ω
→
=
∑
L
l
m
T
l
m
\displaystyle \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega}) \frac{1}{\pi} (\cos \theta)^+ \,
d\overrightarrow{\omega} = \int_{\mathrm{S}^2} (\sum \mathrm{L}_l^m
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})) (\sum \mathrm{T}_l^m
\operatorname{\Upsilon_l^m}(\overrightarrow{\omega})) \, d\overrightarrow{\omega} = \sum
\mathrm{L}_l^m \mathrm{T}_l^m
∫ S 2 L ( ω
) π 1 ( cos θ ) + d ω
= ∫ S 2 ( ∑ L l m Υ l m ( ω
)) ( ∑ T l m Υ l m ( ω
)) d ω
= ∑ L l m T l m
.
Due to circular symmetry of the light distribution and the normalized clamped cosine, only the
coefficients on the ZH(Zonal Harmonics) of the light distribution and the normalized clamped cosine are
non-zero.
For l = 0, we have
L
0
T
0
=
π
(
1
−
cos
α
)
1
2
π
=
1
2
(
1
−
cos
α
)
\displaystyle \mathrm{L}_0 \mathrm{T}_0 =
\sqrt{\pi} (1 - \cos \alpha) \frac{1}{2 \sqrt{\pi}} = \frac{1}{2} (1 - \cos \alpha)
L 0 T 0 = π
( 1 − cos α ) 2 π
1 = 2 1 ( 1 − cos α )
.
For l = 1, we have
L
1
T
1
=
3
π
2
sin
2
α
3
3
π
=
1
2
sin
2
α
\displaystyle \mathrm{L}_1 \mathrm{T}_1 =
\frac{\sqrt{3} \sqrt{\pi}}{2} \sin^2 \alpha \frac{\sqrt{3}}{3 \sqrt{\pi}} = \frac{1}{2}
\sin^2 \alpha
L 1 T 1 = 2 3
π
sin 2 α 3 π
3
= 2 1 sin 2 α .
However, the result
L
0
T
0
=
1
2
(
1
−
cos
α
)
\displaystyle \mathrm{L}_0 \mathrm{T}_0 =
\frac{1}{2} (1 - \cos \alpha)
L 0 T 0 = 2 1 ( 1 − cos α )
and
L
1
T
1
=
3
4
sin
2
α
\displaystyle \mathrm{L}_1 \mathrm{T}_1 =
\frac{3}{4} \sin^2 \alpha
L 1 T 1 = 4 3 sin 2 α by
"11.2 Analytical generation of cone and cosine lobes" of [Kaplanyan 2009] is NOT
correct. We have the counterexample when the cone angle
α
\displaystyle \alpha
α is
π
2
\displaystyle \frac{\pi}{2}
2 π , namely, the solid
angle is the whole hemisphere. This means that
∫
S
2
L
(
ω
→
)
1
π
(
cos
θ
)
+
d
ω
→
=
∫
H
2
1
π
cos
θ
d
ω
→
=
1
π
∫
H
2
cos
θ
d
ω
→
=
1
π
∫
H
2
1
d
ω
⊥
→
=
1
π
π
=
1
\displaystyle \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega}) \frac{1}{\pi} (\cos \theta)^+ \,
d\overrightarrow{\omega} = \int_{\mathcal{H}^2} \frac{1}{\pi} \cos \theta \,
d\overrightarrow{\omega} = \frac{1}{\pi} \int_{\mathcal{H}^2} \cos \theta \,
d\overrightarrow{\omega} = \frac{1}{\pi} \int_{\mathcal{H}^2} 1 \, d
\overrightarrow{\omega^{\perp}} = \frac{1}{\pi} \pi = 1
∫ S 2 L ( ω
) π 1 ( cos θ ) + d ω
= ∫ H 2 π 1 cos θ d ω
= π 1 ∫ H 2 cos θ d ω
= π 1 ∫ H 2 1 d ω ⊥
= π 1 π = 1 . This is consistent with our result
∫
S
2
L
(
ω
→
)
1
π
(
cos
θ
)
+
d
ω
→
=
L
0
T
0
+
L
1
T
1
=
1
2
(
1
−
cos
α
)
+
1
2
sin
2
α
=
1
2
(
1
−
cos
π
2
)
+
1
2
sin
2
π
2
=
1
\displaystyle \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega}) \frac{1}{\pi} (\cos \theta)^+ \,
d\overrightarrow{\omega} = \mathrm{L}_0 \mathrm{T}_0 + \mathrm{L}_1 \mathrm{T}_1 =
\frac{1}{2} (1 - \cos \alpha) + \frac{1}{2} \sin^2 \alpha = \frac{1}{2} (1 - \cos
\frac{\pi}{2}) + \frac{1}{2} \sin^2 \frac{\pi}{2} = 1
∫ S 2 L ( ω
) π 1 ( cos θ ) + d ω
= L 0 T 0 + L 1 T 1 = 2 1 ( 1 − cos α ) + 2 1 sin 2 α = 2 1 ( 1 − cos 2 π ) + 2 1 sin 2 2 π = 1
. However, according to result by [Kaplanyan
2009], we have
∫
S
2
L
(
ω
→
)
1
π
(
cos
θ
)
+
d
ω
→
=
L
0
T
0
+
L
1
T
1
=
1
2
(
1
−
cos
α
)
+
3
4
sin
2
α
=
1
2
(
1
−
cos
π
2
)
+
3
4
sin
2
π
2
=
5
4
\displaystyle \int_{\mathrm{S}^2}
\operatorname{L}(\overrightarrow{\omega}) \frac{1}{\pi} (\cos \theta)^+ \,
d\overrightarrow{\omega} = \mathrm{L}_0 \mathrm{T}_0 + \mathrm{L}_1 \mathrm{T}_1 =
\frac{1}{2} (1 - \cos \alpha) + \frac{3}{4} \sin^2 \alpha = \frac{1}{2} (1 - \cos
\frac{\pi}{2}) + \frac{3}{4} \sin^2 \frac{\pi}{2} = \frac{5}{4}
∫ S 2 L ( ω
) π 1 ( cos θ ) + d ω
= L 0 T 0 + L 1 T 1 = 2 1 ( 1 − cos α ) + 4 3 sin 2 α = 2 1 ( 1 − cos 2 π ) + 4 3 sin 2 2 π = 4 5 which is
NOT correct.
Rotation
We need to rotate the light from the Z axis to the specific direction
[
x
y
z
]
=
[
sin
θ
cos
ϕ
sin
θ
sin
ϕ
cos
θ
]
\displaystyle \begin{bmatrix} x & y &
z\end{bmatrix} = \begin{bmatrix} \sin \theta \cos \phi & \sin \theta \sin \phi &
\cos \theta \end{bmatrix}
[ x y z ] = [ sin θ cos ϕ sin θ sin ϕ cos θ ] . And we
have the rotation matrix
R
=
R
z
(
ϕ
)
R
y
(
θ
)
=
[
cos
ϕ
−
sin
ϕ
0
sin
ϕ
cos
ϕ
0
0
0
1
]
[
cos
θ
0
sin
θ
0
1
0
−
sin
θ
0
cos
θ
]
=
[
cos
θ
cos
ϕ
−
sin
ϕ
sin
θ
cos
ϕ
cos
θ
sin
ϕ
cos
ϕ
sin
θ
sin
ϕ
−
sin
θ
0
cos
θ
]
\displaystyle \mathrm{R} = \mathrm{R_z}(\phi)
\mathrm{R_y}(\theta) = \begin{bmatrix} \cos \phi & - \sin \phi & 0 \\ \sin \phi
& \cos \phi & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \theta
& 0 & \sin \theta \\ 0 & 1 & 0 \\ - \sin \theta & 0 & \cos
\theta \end{bmatrix} = \begin{bmatrix} \cos \theta \cos \phi & - \sin \phi &
\sin \theta \cos \phi \\ \cos \theta \sin \phi & \cos \phi & \sin \theta \sin
\phi \\ - \sin \theta & 0 & \cos \theta \end{bmatrix}
R = R z ( ϕ ) R y ( θ ) = ⎣
⎡ cos ϕ sin ϕ 0 − sin ϕ cos ϕ 0 0 0 1 ⎦
⎤ ⎣
⎡ cos θ 0 − sin θ 0 1 0 sin θ 0 cos θ ⎦
⎤ = ⎣
⎡ cos θ cos ϕ cos θ sin ϕ − sin θ − sin ϕ cos ϕ 0 sin θ cos ϕ sin θ sin ϕ cos θ ⎦
⎤
. By "SH Rotation", we have the Wigner D-matrix
D
1
(
R
)
=
[
R
11
−
R
12
R
10
−
R
21
R
22
−
R
20
R
01
−
R
02
R
00
]
=
[
cos
ϕ
−
sin
θ
sin
ϕ
cos
θ
sin
ϕ
0
cos
θ
sin
θ
−
sin
ϕ
−
sin
θ
cos
ϕ
cos
θ
cos
ϕ
]
=
[
cos
ϕ
−
y
cos
θ
sin
ϕ
0
z
sin
θ
−
sin
ϕ
−
x
cos
θ
cos
ϕ
]
\displaystyle \operatorname{D_1}(\mathrm{R}) =
\begin{bmatrix} {\mathrm{R}}_{11} & -{\mathrm{R}}_{12} & {\mathrm{R}}_{10} \\
-{\mathrm{R}}_{21} & {\mathrm{R}}_{22} & -{\mathrm{R}}_{20} \\ {\mathrm{R}}_{01}
& -{\mathrm{R}}_{02} & {\mathrm{R}}_{00} \end{bmatrix} = \begin{bmatrix} \cos
\phi & - \sin \theta \sin \phi & \cos \theta \sin \phi \\ 0 & \cos \theta
& \sin \theta \\ - \sin \phi & -\sin \theta \cos \phi & \cos \theta \cos
\phi \end{bmatrix} = \begin{bmatrix} \cos \phi & - y & \cos \theta \sin \phi \\
0 & z & \sin \theta \\ - \sin \phi & -x & \cos \theta \cos \phi
\end{bmatrix}
D 1 ( R ) = ⎣
⎡ R 11 − R 21 R 01 − R 12 R 22 − R 02 R 10 − R 20 R 00 ⎦
⎤ = ⎣
⎡ cos ϕ 0 − sin ϕ − sin θ sin ϕ cos θ − sin θ cos ϕ cos θ sin ϕ sin θ cos θ cos ϕ ⎦
⎤ = ⎣
⎡ cos ϕ 0 − sin ϕ − y z − x cos θ sin ϕ sin θ cos θ cos ϕ ⎦
⎤
.
However, the result
D
1
(
R
)
=
[
?
y
?
?
−
z
?
?
x
?
]
\displaystyle \operatorname{D_1}(\mathrm{R}) =
\begin{bmatrix} ? & y & ? \\ ? & -z & ? \\ ? & x & ?
\end{bmatrix}
D 1 ( R ) = ⎣
⎡ ? ? ? y − z x ? ? ? ⎦
⎤
by "11.1 Arbitrary Rotation of function with circularly symmetry around Z" of [Kaplanyan 2009]
is NOT correct. We have the counterexample when the "vcDir" is
[
0
0
1
]
\displaystyle \begin{bmatrix} 0 & 0 & 1
\end{bmatrix}
[ 0 0 1 ] , namely,
we do NOT rotate the light at all. This means that the coefficients should be the same in this
case, namely, vResult.xyzw == half4(vZHCoeffs.x, 0, vZHCoeffs.y, 0)
. However, according to result
by [Kaplanyan 2009], we have vResult.xyzw = half4(vZHCoeffs.x, 0, -vZHCoeffs.y, 0)
which is
NOT correct.
References
[Ramamoorthi 2001 A] Ravi Ramamoorthi, Pat
Hanrahan. "On the Relationship between Radiance and Irradiance: Determining the illumination from
images of a convex Lambertian object." JOSA 2001.
[Ramamoorthi 2001 B] Ravi Ramamoorthi, Pat Hanrahan.
"An Efficient Representation for Irradiance Environment Maps." SIGGRAPH 2001.
[Sloan 2002] Peter-Pike Sloan, Jan Kautz,
John Snyder. "Precomputed Radiance Transfer for Real-Time Rendering in Dynamic, Low-Frequency Lighting
Environments." SIGGRAPH 2002.
[Kautz 2002] Jan Kautz, Peter-Pike Sloan, John
Snyder. "Fast, Arbitrary BRDF Shading for Low-Frequency Lighting Using Spherical Harmonics." EGWR
2002.
[Green 2003] Robin Green. "Spherical Harmonic Lighting: The Gritty Details." GDC 2003.
[Dachsbacher 2005] Carsten Dachsbacher, Marc Stamminger. "Reflective Shadow Maps." I3D 2005.
[Sloan 2008] Peter-Pike Sloan. "Stupid
Spherical Harmonics (SH) Tricks." GDC 2008.
[Kaplanyan 2009] Anton
Kaplanyan. "Light Propagation Volumes in CryEngine 3." SIGGRAPH 2009.
[Kaplanyan 2010] Anton Kaplanyan. "Cascaded Light Propagation Volumes for Real-Time Indirect
Illumination." I3D 2010.
[Kaplanyan 2011] Anton Kaplanyan, Wolfgang Engel, Carsten Dachsbacher. "Diffuse Global Illumination with
Temporally Coherent Light Propagation Volumes." GPU Pro 2.
[Engel 2012] Wolfgang Engel, Igor Lobanchikov, Timothy Martin. "Dynamic Global Illumination from Many
Lights." AltDevConf 2012.
[Lagarde 2014] Sebastian Lagarde, Charles
Rousiers. "Moving Frostbite to PBR." SIGGRAPH 2014.
[Hable 2014] John Hable.
"Simple and Fast Spherical Harmonic Rotation." Filmic Worlds Blog 2014.