Function Representation & Spherical Harmonics
Function approximation • G (x) ... function to represent • B 1 (x), B 2 (x), … B n (x) … basis functions • G (x) is a linear combination of basis functions n ∑ = G ( x ) c B ( x ) i i = i 1 • Storing a finite number of coefficients c i gives an approximation of G (x)
Examples of basis functions Tent function (linear interpolation) Associated Legendre polynomials
Function approximation • Linear combination – sum of scaled basis functions = × c 1 = × c 2 × = c 3
Function approximation • Linear combination – sum of scaled basis functions n ( ) = ∑ c B x i i = i 1
Finding the coefficients • How to find coefficients c i ? – Minimize an error measure • What error measure? – L 2 error ∑ 2 ∫ 2 = − E [ G ( x ) c B ( x ) ] L i i i I Original function Approximated function
Finding the coefficients • Minimizing E L2 leads to B B B B B B c G B 1 1 1 2 1 n 1 1 B B B B c G B = 2 1 2 2 2 2 B B B B B B c G B n 1 n 2 n n n n Where ∫ = F H F ( x ) H ( x ) dx I
Finding the coefficients • Matrix B B B B B B 1 1 1 2 1 n B B B B = 2 1 2 2 B B B B B B B n 1 n 2 n n does not depend on G(x) – Computed just once for a given basis
Finding the coefficients • Given a basis {B i (x)} 1. Compute matrix B 2. Compute its inverse B -1 • Given a function G(x) to approximate 1. Compute dot products [ ] T G B G B G B 1 2 n 2. … (next slide)
Finding the coefficients 2. Compute coefficients as c G B 1 1 c G B − = 2 2 1 B c G B n n
Orthonormal basis • Orthonormal basis means = 1 i j = B B ≠ i j 0 i j • If basis is orthonormal then B B B B B B 1 0 1 1 1 2 1 n B B B B 1 = = = 2 1 2 2 B I B B B B B B 0 1 n 1 n 2 n n
Orthonormal basis • If the basis is orthonormal, computation of approximation coefficients simplifies to c G B 1 1 c G B = 2 2 c G B n n • We want orthonormal basis functions
Orthonormal basis • Projection: How “similar” is the given basis function to the function we’re approximating ∫ = × c 1 ∫ = × c 2 ∫ = × c 3 Original function Basis functions Coefficients
Another reason for orthonormal basis functions • Intergral of product = dot product of coefficients f(x) = f i B i (x) ∫ f(x)g(x)dx = f i g i g(x) = g i B i (x)
Application to GI • Illumination integral L o = ∫ L i ( ω i ) BRDF ( ω i ) cos θ i d ω i
Spherical Harmonics
Spherical harmonics • Spherical function approximation • Domain I = unit sphere S – directions in 3D • Approximated function: G( θ , φ ) • Basis functions: Y i ( θ , φ )= Y l , m ( θ , φ ) – indexing: i = l (l+1) + m
The SH Functions
Spherical harmonics • K … normalization constant • P … Associated Legendre polynomial – Orthonormal polynomial basis on (0,1) • In general: Y l,m ( θ , φ ) = K . Ψ ( φ ) . P l , m (cos θ ) – Y l , m ( θ , φ ) is separable in θ and φ
Function approximation with SH − = n 1 m l ∑ ∑ θ ϕ = θ ϕ G ( , ) c l Y ( , ) , m l , m = = − l 0 m l • n …approximation order • There are n 2 harmonics for order n
Function approximation with SH • Spherical harmonics are orthonormal • Function projection π π – Computing the SH coefficients 2 ∫ ∫∫ = = ω ω ω = θ ϕ θ ϕ θ θ ϕ c G Y G ( ) Y ( ) d G ( , ) Y ( , ) sin d d l , m l , m l , m l , m S 0 0 – Usually evaluated by numerical integration • Low number of coefficients low-frequency signal
Function approximation with SH
Product integral with SH • Simplified indexing – Y i = Y l,m – i = l ( l +1) + m • Two functions 2 2 n n ∑ ∑ ω = ω ω = ω represented by SH F ( ) f i Y ( ) G ( ) g i Y ( ) i i = = i 0 i 0 2 n ∑ ∫ ω ω ω = F ( ) G ( ) d f g i i = i 0 S
Recommend
More recommend