spherical harmonic lighting jaroslav křivánek. overview function approximation function...

27
Spherical Harmonic Lighting Spherical Harmonic Lighting Jaroslav K Jaroslav K řivánek řivánek

Upload: jena-venard

Post on 01-Apr-2015

236 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Spherical Harmonic LightingSpherical Harmonic Lighting

Jaroslav KJaroslav Křivánekřivánek

Page 2: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

OverviewOverview

• Function approximationFunction approximation

• Spherical harmonicsSpherical harmonics

• Some other timeSome other time Illumination from environment mapsIllumination from environment maps

•BRDF representation by spherical harmonics

•Spherical harmonics rotation Hemispherical harmonicsHemispherical harmonics Radiance CachingRadiance Caching Precomputed Radiance TransferPrecomputed Radiance Transfer

•Clustered Principal Component Analysis

•Wavelet Methods

Page 3: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

I) Function ApproximationI) Function Approximation

Page 4: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Function ApproximationFunction Approximation

• G(x) ... function to approximateG(x) ... function to approximate

• BB11(x), B(x), B22(x), … B(x), … Bnn(x) … basis functions(x) … basis functions

• We wantWe want

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

)()(1

xBcxG i

n

ii

Page 5: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Function ApproximationFunction Approximation

• How to find coefficients cHow to find coefficients cii?? Minimize an error measureMinimize an error measure

• What error measure?What error measure? LL22 error error

2])()([

2 I i

iiL xBcxGE

Page 6: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Function ApproximationFunction Approximation

• Minimizing Minimizing EELL22 leads to leads to

• WhereWhere

(function scalar product)(function scalar product)

nnnnnn

n

BG

BG

BG

c

c

c

BBBBBB

BBBB

BBBBBB

2

1

2

1

21

2212

12111

I

dxxGxFGF )()(

Page 7: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Function ApproximationFunction Approximation

• Orthonormal basisOrthonormal basis

• If basis is orthonormal thenIf basis is orthonormal then

we want our bases to be orthonormalwe want our bases to be orthonormal

ji

jiGG ji 0

1

nn BG

BG

BG

c

c

c

2

1

2

1

Page 8: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

II) Spherical HarmonicsII) Spherical Harmonics

Page 9: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Spherical HarmonicsSpherical Harmonics

• Spherical function approximationSpherical function approximation

• Domain Domain II = unit sphere = unit sphere SS = directions in 3D= directions in 3D

• Approximated function: G(Approximated function: G(θθ,,φφ))

• Basis functions: YBasis functions: Yii((θθ,,φφ)= Y)= Yll,,mm((θθ,,φφ)) indexing: i = indexing: i = ll (l+1)(l+1) ++ mm

Page 10: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Spherical HarmonicsSpherical Harmonics

Y0,0

Y1,-1

Y2,-2 Y2,-1 Y2,0 Y2,1 Y2,2

Y1,0 Y1,1

band 0 band 0 (l=0)(l=0)

band 1 band 1 (l=1)(l=1)

band 2 band 2 (l=2)(l=2)

Page 11: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Spherical HarmonicsSpherical Harmonics

• K … normalization constantK … normalization constant• P … Associted Legendre polynomialP … Associted Legendre polynomial

Orthonormal polynomial basis on (0,1)Orthonormal polynomial basis on (0,1)

• In general: In general:

YYl,ml,m((θθ,,φφ) = K . ) = K . ΨΨ((φφ) . P) . Pl,ml,m(cos (cos θθ)) YYl,ml,m((θθ,,φφ) is separable in ) is separable in θθ and and φφ

Page 12: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Function Approximation with SHFunction Approximation with SH

• n…approximation ordern…approximation order

• There are There are nn22 harmonics for order harmonics for order nn

),(),( ,

1

0, ml

n

l

lm

lmml YcG

Page 13: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Function Approximation with SHFunction Approximation with SH

• Spherical harmonics are ORTHONORMALSpherical harmonics are ORTHONORMAL

• Function projectionFunction projection Computing the SH coefficients Computing the SH coefficients

Usually evaluated by numerical integrationUsually evaluated by numerical integration

• Low number of coefficients Low number of coefficients

low-frequency signallow-frequency signal

2

0 0

,,,, sin),(),()()( ddYGdYGYGc ml

S

mlmlml

Page 14: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Product Integral with SHProduct Integral with SH

• Simplified indexing Simplified indexing YYii= = YYl,ml,m

ii = = ll ((ll+1)+1) ++ mm

• 2 functions represented by SH2 functions represented by SH

• Integral of F(Integral of F(ωω).G().G(ωω) is the dot product of ) is the dot product of F’s and G’s SH coefficientsF’s and G’s SH coefficients

)()(2

0

i

n

iiYfF

)()(2

0

i

n

iiYgG

2

0

)()(n

iii

S

gfdGF

Page 15: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Product Integral with SHProduct Integral with SH

F(ω) = fi Yi(ω)

G(ω) =gi Yi(ω)

G(ω)F(ω)dx = fi gi

Page 16: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Product Integral with SHProduct Integral with SH

• Fundamental property for graphicsFundamental property for graphics

• ProofProof

Page 17: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

III) Illumination from environment III) Illumination from environment mapsmaps

Page 18: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Direct LightingDirect Lighting

• Illumination integral at a pointIllumination integral at a point

• How it simplifies for a parallel directional How it simplifies for a parallel directional lightlight

• Environment mapsEnvironment maps Approximate specular reflectionApproximate specular reflection Lighting does not depend on positionLighting does not depend on position General illumination integral for an environment General illumination integral for an environment

mapmap How it simplifies for a specular BRDFHow it simplifies for a specular BRDF What if the BRDF is not perfectly specular?What if the BRDF is not perfectly specular?

Page 19: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Illumination from environment mapsIllumination from environment maps

• SH representation for lighting & BRDFSH representation for lighting & BRDF

• RotationRotation

Page 20: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

III) Hemispherical harmonicsIII) Hemispherical harmonics

Page 21: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Hemispherical harmonicsHemispherical harmonics

• New set of basis functions

• Designed for representing hemispherical functions

• Definition similar to spherical harmonics

Page 22: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Hemispherical harmonicsHemispherical harmonics

Shifting

Page 23: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Hemispherical harmonicsHemispherical harmonics

(0,0)

(1,-1)

(2,-2) (2,-1) (2,0) (2,1) (2,2)

(1,0) (1,1)

SH: YSH: Yl,ml,m((θθ,,φφ) = K . ) = K . ΨΨ((φφ) . P) . Pl,ml,m(cos (cos θθ))

HSH: HHSH: Hl,ml,m((θθ,,φφ) = K . ) = K . ΨΨ((φφ) . P) . Pl,ml,m(2cos (2cos θθ-1)-1)

Page 24: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Hemispherical HarmonicsHemispherical Harmonics

• videovideo

Page 25: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

III) Radiance cachingIII) Radiance caching

Page 26: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Radiance CachingRadiance Caching

• Irradiance caching [Ward88]Irradiance caching [Ward88] Diffuse indirect illumination is smoothDiffuse indirect illumination is smooth Sample only sparsely, cache and interpolate Sample only sparsely, cache and interpolate

laterlater

• Low-frequency view BRDFLow-frequency view BRDF Indirect illumination smooth as wellIndirect illumination smooth as well But the illumination is view dependentBut the illumination is view dependent Irradiance does not describe view dependenceIrradiance does not describe view dependence Cache radiance instead of irradianceCache radiance instead of irradiance RADIANCE CACHINGRADIANCE CACHING

Page 27: Spherical Harmonic Lighting Jaroslav Křivánek. Overview Function approximation Function approximation Spherical harmonics Spherical harmonics Some other

Radiance CachingRadiance Caching

• Incoming radiance representationIncoming radiance representation

• BRDF representationBRDF representation

• InterpolationInterpolation

• AlignmentAlignment

• GradientsGradients

• VideoVideo