function approximation & spherical harmonics

27
Function Approximation & Spherical Harmonics

Upload: others

Post on 12-Dec-2021

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Function Approximation & Spherical Harmonics

Function Approximation & Spherical Harmonics

Page 2: Function Approximation & Spherical Harmonics

Function approximation

• G(x) ... function to approximate

• B1(x), B2(x), … Bn(x) … basis functions

• G(x) is a linear combination of bases

• Storing a finite number of coefficients ci gives an approximation of G(x)

)()(1

xBcxG i

n

ii∑

=

=

Page 3: Function Approximation & Spherical Harmonics

Basis functions

Page 4: Function Approximation & Spherical Harmonics

Function approximation

• Linear combination – sum of scaled basis functions

×1c =

=

=

×2c

×3c

Page 5: Function Approximation & Spherical Harmonics

Function approximation

• Linear combination – sum of scaled basis functions

( ) =∑=

xBcn

iii

1

Page 6: Function Approximation & Spherical Harmonics

Finding the coefficients

• How to find coefficients ci?– Minimize an error measure

• What error measure?– L2 error

2])()([

2 ∫ ∑−=I i

iiL xBcxGE

Approximated function

Original function

Page 7: Function Approximation & Spherical Harmonics

Finding the coefficients

• Minimizing EL2 leads to

Where

=

nnnnnn

n

BG

BGBG

c

cc

BBBBBB

BBBBBBBBBB

2

1

2

1

21

2212

12111

∫=I

dxxHxFHF )()(

Page 8: Function Approximation & Spherical Harmonics

Finding Coefficients

• Matrix

does not depend on G(x)– Computed just once for a given basis

=

nnnn

n

BBBBBB

BBBBBBBBBB

21

2212

12111

B

Page 9: Function Approximation & Spherical Harmonics

Finding the coefficients

• Given a basis {Bi(x)}1. Compute matrix B

2. Compute its inverse B-1

• Given a function G(x) to approximate1. Compute dot products

2. … (next slide)

[ ]TnBGBGBG 21

Page 10: Function Approximation & Spherical Harmonics

Finding the coefficients

2. Compute coefficients as

=

nn BG

BGBG

c

cc

2

1

12

1

B

Page 11: Function Approximation & Spherical Harmonics

Orthonormal basis

• Orthonormal basis means

• If basis is orthonormal then

≠=

=jiji

BB ji 01

IB =

=

=

10

101

21

2212

12111

nnnn

n

BBBBBB

BBBBBBBBBB

Page 12: Function Approximation & Spherical Harmonics

Orthonormal basis

• If the basis is orthonormal, computation of approximation coefficients simplifies to

• We want orthonormal basis functions

=

nn BG

BGBG

c

cc

2

1

2

1

Page 13: Function Approximation & Spherical Harmonics

Orthonormal basis

• Projection: How “similar” is the given basis function to the function we’re approximating

∫ ×

×

×

∫∫

1c=

2c=

3c=

Original function Basis functions Coefficients

Page 14: Function Approximation & Spherical Harmonics

Another reason for orthonormalbasis 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 Approximation & Spherical Harmonics

Application to GI

• Illumination integral

Lo = ∫ Li(ωi) BRDF (ωi) cosθi dωi

Page 16: Function Approximation & Spherical Harmonics

Spherical Harmonics

Page 17: Function Approximation & Spherical Harmonics

Spherical 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 Approximation & Spherical Harmonics

The SH Functions

Page 19: Function Approximation & Spherical Harmonics

Spherical 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 Approximation & Spherical Harmonics

Function approximation with SH

• n…approximation order

• There are n2 harmonics for order n

),(),( ,

1

0, ϕθϕθ ml

n

l

lm

lmml YcG ∑∑

=

=

−=

=

Page 21: Function Approximation & Spherical Harmonics

Function approximation with SH

Page 22: Function Approximation & Spherical Harmonics

Function 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

Smlmlml

Page 23: Function Approximation & Spherical Harmonics

Product 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 ωωω

Page 24: Function Approximation & Spherical Harmonics

SH rotation

• Closed under rotation

• SH rotation matrix

• Fast rotation procedures exist

Page 25: Function Approximation & Spherical Harmonics

Representing BRDFs with SH

• For each ωo, the BRDF lobe is a spherical function

• Idea:– Discretize ωo

– For each such ωo, represent BRDF by a set of coeffs

Page 26: Function Approximation & Spherical Harmonics

Discretizing the hemisphere

• Want mapping between hemisphere and square – Low distortion (as uniform as possible)

– Continuous

– Fast mapping formulas

• Paraboloid mapping

Page 27: Function Approximation & Spherical Harmonics

Paraboloid mapping

s = x / (1-z)t = y / (1-z)