77
Frames, Quadratures and Global Illumination: New Math for Games Robin Green Microsoft Corp Manny Ko PDI/Dreamworks

Gdc2012 frames, sparsity and global illumination

Embed Size (px)

DESCRIPTION

Slides from the GDC 2012 talk.

Citation preview

Page 1: Gdc2012 frames, sparsity and global illumination

Frames, Quadratures and Global Illumination: New Math for Games

Robin Green – Microsoft CorpManny Ko – PDI/Dreamworks

Page 2: Gdc2012 frames, sparsity and global illumination

WARNING

• This talk is MATH HEAVY

• We assume you understand the basics of:– Linear Algebra, Calculus, 3D Mathematics

– Spherical Harmonic Lighting, Visibility, BRDF, Cosine Term

– Monte Carlo Integration, Unbiased Spherical Sampling

– Precomputed Radiance Transfer, Rendering Equation

• This is bleeding edge research.

• There are still a lot of unanswered questions.

Page 3: Gdc2012 frames, sparsity and global illumination

The Mission

• We need to find a spherical basis that is

– Is defined natively on the sphere

– Retains the norm as a Parseval Tight Frame

– Allows us to select the number of coefficients

– Is spectrally and spatially concentrated

– Is cheap to project

– Is cheap to rotate

– Exhibits rotational invariance

Page 4: Gdc2012 frames, sparsity and global illumination

Spherical Harmonics

• The Real SH functions are a family of orthonormal basis function on the sphere.

Page 5: Gdc2012 frames, sparsity and global illumination

Spherical Harmonics

Page 6: Gdc2012 frames, sparsity and global illumination

SH the Good

• Analysis is simple projection due to orthonormal basis

• Reconstruction as weighted-sum

• Successive approximation property

• Product-integral is dot-product of two coefficient vectors

Page 7: Gdc2012 frames, sparsity and global illumination

SH Deficiencies

• SH produces signed values yet all visibility functions, BRDFs and light probes are strictly positive.

• SH projections are global and smooth, visibility functions are local and sharp.

• SH reproduces a signal at the limit. There is no guarantee the result is close to the original at low orders. Even at high orders it “rings” espwhen restricted to the hemisphere.

Page 8: Gdc2012 frames, sparsity and global illumination

SH Deficiencies II

• SH support is well localized in frequencies but its spatial support is global. Limiting them to the hemisphere produces ringing – Gibbs.

• More important it is not just a problem with SH, all ONB will have the same issue (see Strang ‘The search for a good Basis’ http://www-math.mit.edu/~gs)

Page 9: Gdc2012 frames, sparsity and global illumination

Strang

• “Smooth variations are well represented by low frequency terms. But edges that are easy in the standard basis have become extremely expensive – because of the slow 1/k decay of Fourier coefficients, and the ripple from the Gibbs phenomenon when the series is truncated. These shadows near a discontinuity are called ringing.” G. Strang

Page 10: Gdc2012 frames, sparsity and global illumination

Haar Wavelets

• Haar wavelets are spatially compact and produce a lot of zero coefficients.

• Generating 6 times the coefficients, papers rely on compression and highly conditional code.

• Projecting cube faces onto the sphere introduces distortions, and seams for filtering and rotation.

Page 11: Gdc2012 frames, sparsity and global illumination

Spherical Wavelets?

• Spherical wavelets typical are tensored-1D wavelets lifted onto the sphere using inverse stereographic projection– Often realized as separable filters. However, directions in images are

not limited to the two axes.

• All the vanishing moments and other properties don’t automatically carry over from 1D to 2D

• The parameterization often is non-manifold since they are based on tangent-plane arguments.

• Antonine & McEwen’s directional wavelets still worth a look

Page 12: Gdc2012 frames, sparsity and global illumination

Radial Basis Functions

• Radial Basis Functions are also used, usually sums of Gaussian lobes.

• Need to solve two variables –direction and spread. Leads to conditional code that is not GPU friendly.

• Zonal Harmonics are another form of steerable RBF built out of orthogonal parts.

Page 13: Gdc2012 frames, sparsity and global illumination

• Haar and SH are two ends of a continuum – one smooth and global, the other highly local and unsmooth. This is Spatial vs. Spectral compactness.

Q: What lives in the middle ground?

Smoothness vs. Localization

Page 14: Gdc2012 frames, sparsity and global illumination

Spatial vs. Spectral

• It turns out, the Spatial vs. Spectral problem is exactly Heisenberg’s Uncertainty Principle.

• You cannot have both spatial compactness and spectral compactness at the same time – e.g. The Fourier transform of a delta function is infinitely spread out spectrally.

• But… thanks to a solution by David Slepian to the Concentration Problem you can get pretty close.

Page 15: Gdc2012 frames, sparsity and global illumination

Fundamental Questions

1. Where do these Orthonormal Basis Functions come from?

2. How can we loosen the rules so we can define better functions for our own use cases?

3. What are the key properties we need to retain for our functions to be useful?

Page 16: Gdc2012 frames, sparsity and global illumination

What You Need To Know

• We are going to introduce Frame Theory and Spherical Quadrature, just enough to understand two key concepts:

Parseval Tight Frames

Spherical t-Designs

Page 17: Gdc2012 frames, sparsity and global illumination

Hilbert Spaces

Page 18: Gdc2012 frames, sparsity and global illumination

Orthonormal Basis

Page 19: Gdc2012 frames, sparsity and global illumination

Orthonormal Bases

x

3.142 3.142

1.571

1.571

Page 20: Gdc2012 frames, sparsity and global illumination

Orthonormal Bases

x

1 1

1

1

Page 21: Gdc2012 frames, sparsity and global illumination

Orthonormal Bases

Page 22: Gdc2012 frames, sparsity and global illumination

Orthonormal Basis Characteristics

Page 23: Gdc2012 frames, sparsity and global illumination

Orthonormal Basis Characteristics

Page 24: Gdc2012 frames, sparsity and global illumination

Orthonormal Basis Characteristics

Page 25: Gdc2012 frames, sparsity and global illumination

ONB Characteristics

Page 26: Gdc2012 frames, sparsity and global illumination

General Bases

• We use Orthonormal Bases all the time

• Every rotation matrix in 3D is an Orthonormal Basis

Page 27: Gdc2012 frames, sparsity and global illumination

General Bases

• What if you chose vectors that are not orthogonal?

Page 28: Gdc2012 frames, sparsity and global illumination

General Base

• We can still represent points, but we need a “helper” basis to get us there.

Page 29: Gdc2012 frames, sparsity and global illumination

General Bases

Page 30: Gdc2012 frames, sparsity and global illumination

Biorthogonal Bases

Page 31: Gdc2012 frames, sparsity and global illumination

Matrix Notation

Page 32: Gdc2012 frames, sparsity and global illumination

Matrix Notation

Page 33: Gdc2012 frames, sparsity and global illumination

Breaking the Rules

• What happens if we add another vector to the basis?

• Now we have an overcomplete system, and coordinates are now linearly dependent

Page 34: Gdc2012 frames, sparsity and global illumination

Breaking the Rules

Page 35: Gdc2012 frames, sparsity and global illumination

Breaking the Rules

• We can still project a point and reconstruct it

Page 36: Gdc2012 frames, sparsity and global illumination

General Biorthogonal Bases

Page 37: Gdc2012 frames, sparsity and global illumination

Frames

Page 38: Gdc2012 frames, sparsity and global illumination

Mercedes Benz Frame

Page 39: Gdc2012 frames, sparsity and global illumination

Parseval Tight Frame

Page 40: Gdc2012 frames, sparsity and global illumination

PTF-Mercedes Benz is Self Dual

Page 41: Gdc2012 frames, sparsity and global illumination

Parseval Tight Frame

Page 42: Gdc2012 frames, sparsity and global illumination

Frame Bounds

Page 43: Gdc2012 frames, sparsity and global illumination

Frame Bounds

• We can categorize frames based on their construction

• Any tight frame can be factored into a PTF

Unit Frame

Tight Frame

Parseval Tight Frame

Page 44: Gdc2012 frames, sparsity and global illumination

Tight Frames

• Self-dual– Dual preserves any structure in the frame – e.g. wavelet property, or

spatial/spectral locality.

– Not true for general frames

• Computational tractable

• The ratio B/A for a frame is critical as it controls the condition-number of the frame operator. The closer B/A=1 the better.

Page 45: Gdc2012 frames, sparsity and global illumination

Gram Matrix

Page 46: Gdc2012 frames, sparsity and global illumination

Gram Matrix II

Page 47: Gdc2012 frames, sparsity and global illumination

TF vs. ONB

• Analysis is no longer simple projection– Frame operator etc.

• Reconstruction as weighted-sum

• Successive approximation property

• Product-integral is dot-product of two coefficient vectors – Need to add the Gram-matrix

Page 48: Gdc2012 frames, sparsity and global illumination

Spherical Polynomials

Page 49: Gdc2012 frames, sparsity and global illumination

Integrating on the Sphere

Page 50: Gdc2012 frames, sparsity and global illumination

Gaussian Quadrature

• If you are integrating a fixed order polynomial over a closed range, Gaussian quadrature can find the integral using a small number of evaluations

• Trapezium Rule is a quadrature for linear curves.

• Simpson’s Rule is a quadrature for quadratic curves.

Simpson’s rule graph

Page 51: Gdc2012 frames, sparsity and global illumination

Spherical Quadrature

Page 52: Gdc2012 frames, sparsity and global illumination

Spherical t-designs

Page 53: Gdc2012 frames, sparsity and global illumination

Minimum Order t-designs

order 2verts 4

order 3verts 6

order 4verts 14

order 5verts 20

order 6verts 26

order 7verts 24

Page 54: Gdc2012 frames, sparsity and global illumination

Spherical Needlet

Page 55: Gdc2012 frames, sparsity and global illumination

Simplifications

Page 56: Gdc2012 frames, sparsity and global illumination

Legendre Polynomials

Page 57: Gdc2012 frames, sparsity and global illumination

Littlewood-Paley Decomposition

Page 58: Gdc2012 frames, sparsity and global illumination

Littlewood Paley Decomposition

Page 59: Gdc2012 frames, sparsity and global illumination

Spherical Needlet

A single needlet

over the sphere

quadrature weight

Littlewood-Paley weighting

Legendre polynomial

quadrature direction

Page 60: Gdc2012 frames, sparsity and global illumination

Spherical Needlet

Page 61: Gdc2012 frames, sparsity and global illumination

What does this integrate to?

Page 62: Gdc2012 frames, sparsity and global illumination

What does this integrate to?

Page 63: Gdc2012 frames, sparsity and global illumination

Needlet B=2.0 and j=1

Page 64: Gdc2012 frames, sparsity and global illumination

Needlet B=2.0 and j=2

Page 65: Gdc2012 frames, sparsity and global illumination

Needlet B=2.0 and j=3

Page 66: Gdc2012 frames, sparsity and global illumination

Needlet B=3.0 and j=1

Page 67: Gdc2012 frames, sparsity and global illumination

Needlet B=2.4 and j=1

Page 68: Gdc2012 frames, sparsity and global illumination

Spherical Basis

Page 69: Gdc2012 frames, sparsity and global illumination

Approximation Order

Page 70: Gdc2012 frames, sparsity and global illumination

Needlet vs. SH

Page 71: Gdc2012 frames, sparsity and global illumination

Monte Carlo Sampling

• Sampling needlets correctly requires non-uniform sampling

Page 72: Gdc2012 frames, sparsity and global illumination

Fast Projection

Plot error of lerp LUT versus actual function.

Page 73: Gdc2012 frames, sparsity and global illumination

Key Features of a Spherical Basis

• Radially symmetric basis– Allows fast projection– Allows fast and stable rotation

• Defined from natively embedded atoms– No parameterization problems– Use lifting to construct a more performant basis– Spherical concentration shows that localization is possible

• Using Frames– Allows simpler definition of the problem– Who needs successive approximation anyway?

Page 74: Gdc2012 frames, sparsity and global illumination

Future Work

• Littlewood-Paley is just one partition of unity optimized for spectral concentration. Other papers have optimized for spatial and other metrics.

• Ridgelets, Curvelets, Bandlets, Shearlets etc. – all utilizes frame construct and theories

• Compressive Sensing & Sparsity

Page 75: Gdc2012 frames, sparsity and global illumination

Key References

• D. Marinucci et al, “Spherical Needlets for CMB Data Analysis”, arxiv.org/pdf/7070.0844.pdf, 2008

• F. Guilloux et al, “Practical Wavelet Design on the Sphere”, Applied and Computational Harmonic Analysis, 2008

• J. Kovacevic et al, “Life Beyond Bases: The Advent of Frames”, Signal Processing Magazine, IEEE, Vol.24, No.4, July 2007

• T. Hines, “An Introduction to Frame Theory”, Aug 2009, http://mathpost.asu.edu/~hines/docs/090727IntroFrames.pdf

Page 76: Gdc2012 frames, sparsity and global illumination

References

• [Dhillon] “Inverse Eigenvalue Problem in Wireless Communications”

• [Gilles] “Image Decomposition: Theory, Numerical Schemes, and Performance Evaluation”.

• [Strang] “The Search for a Good Basis”.

Page 77: Gdc2012 frames, sparsity and global illumination

A single needlet

over the sphere

quadrature weight

Littlewood-Paley weighting

Legendre polynomial

quadrature direction