![Page 1: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/1.jpg)
Function Representation & Spherical HarmonicsFunction Representation & Spherical Harmonics
![Page 2: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/2.jpg)
Function approximationFunction approximation
• G(x) ... function to represent
• B1(x), B2(x), … Bn(x) … basis functions
• G(x) is a linear combination of basis functions
• Storing a finite number of coefficients ci gives an
approximation of G(x)
)()(1
xBcxG i
n
ii
![Page 3: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/3.jpg)
Examples of basis functionsExamples of basis functions
Tent function (linear interpolation) Associated Legendre polynomials
![Page 4: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/4.jpg)
Function approximationFunction approximation
• Linear combination
– sum of scaled basis functions
1c
2c
3c
![Page 5: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/5.jpg)
Function approximationFunction approximation
• Linear combination
– sum of scaled basis functions
xBcn
iii
1
![Page 6: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/6.jpg)
Finding the coefficientsFinding the coefficients
• How to find coefficients ci?
– Minimize an error measure
• What error measure?
– L2 error2
])()([2
I iiiL xBcxGE
Approximated function
Original function
![Page 7: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/7.jpg)
Finding the coefficientsFinding the coefficients
• Minimizing EL2 leads to
Where
nnnnnn
n
BG
BG
BG
c
c
c
BBBBBB
BBBB
BBBBBB
2
1
2
1
21
2212
12111
I
dxxHxFHF )()(
![Page 8: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/8.jpg)
Finding the coefficientsFinding the coefficients
• Matrix
does not depend on G(x)
– Computed just once for a given basis
nnnn
n
BBBBBB
BBBB
BBBBBB
21
2212
12111
B
![Page 9: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/9.jpg)
Finding the coefficientsFinding the coefficients
• Given a basis {Bi(x)}
1. Compute matrix B
2. Compute its inverse B-1
• Given a function G(x) to approximate
1. Compute dot products
2. … (next slide)
TnBGBGBG 21
![Page 10: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/10.jpg)
Finding the coefficientsFinding the coefficients
2. Compute coefficients as
nn BG
BG
BG
c
c
c
2
1
12
1
B
![Page 11: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/11.jpg)
Orthonormal basisOrthonormal basis
• Orthonormal basis means
• If basis is orthonormal then
ji
jiBB ji 0
1
IB
10
1
01
21
2212
12111
nnnn
n
BBBBBB
BBBB
BBBBBB
![Page 12: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/12.jpg)
Orthonormal basisOrthonormal basis
• If the basis is orthonormal, computation of approximation coefficients simplifies to
• We want orthonormal basis functions
nn BG
BG
BG
c
c
c
2
1
2
1
![Page 13: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/13.jpg)
Orthonormal basisOrthonormal basis
• Projection: How “similar” is the given basis function to the function we’re approximating
1c
2c
3cOriginal function Basis functions Coefficients
![Page 14: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/14.jpg)
Another reason for orthonormal basis functionsAnother reason for orthonormal basis functions
f(x) = fi Bi(x)
g(x) = gi Bi(x)
f(x)g(x)dx = fi gi
• Intergral of product = dot product of coefficients
![Page 15: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/15.jpg)
Application to GIApplication to GI
• Illumination integral
Lo = ∫ Li(i) BRDF (i) cosi di
![Page 16: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/16.jpg)
Spherical HarmonicsSpherical Harmonics
![Page 17: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/17.jpg)
Spherical harmonicsSpherical harmonics
• Spherical function approximation
• Domain I = unit sphere S
– directions in 3D
• Approximated function: G(θ,φ)
• Basis functions: Yi(θ,φ)= Yl,m(θ,φ)
– indexing: i = l (l+1) + m
![Page 18: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/18.jpg)
The SH FunctionsThe SH Functions
![Page 19: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/19.jpg)
Spherical harmonicsSpherical harmonics
• K … normalization constant
• P … Associated Legendre polynomial
– Orthonormal polynomial basis on (0,1)
• In general: Yl,m(θ,φ) = K . Ψ(φ) . Pl,m(cos θ)
– Yl,m(θ,φ) is separable in θ and φ
![Page 20: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/20.jpg)
Function approximation with SHFunction approximation with SH
• n…approximation order
• There are n2 harmonics for order n
),(),( ,
1
0, ml
n
l
lm
lmml YcG
![Page 21: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/21.jpg)
Function approximation with SHFunction approximation with SH
• Spherical harmonics are orthonormal
• Function projection
– Computing the SH coefficients
– Usually evaluated by numerical integration
• Low number of coefficients
low-frequency signal
2
0 0
,,,, sin),(),()()( ddYGdYGYGc ml
S
mlmlml
![Page 22: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/22.jpg)
Function approximation with SHFunction approximation with SH
![Page 23: Function Representation & Spherical Harmonics](https://reader035.vdocuments.us/reader035/viewer/2022081419/56812cd3550346895d919094/html5/thumbnails/23.jpg)
Product integral with SHProduct integral with SH
• Simplified indexing
– Yi= Yl,m
– i = l (l+1) + m
• Two functions represented by SH )()(
2
0
i
n
iiYfF
)()(2
0
i
n
iiYgG
2
0
)()(n
iii
S
gfdGF