Matrix Row-Column Sampling for the Many-Light Problem Miloš Hašan (Cornell University) Fabio Pellacini (Dartmouth College) Kavita Bala (Cornell University) Complex Illumination: A Challenge Conversion to Many Lights • Area, indirect, sun/sky Courtesy Walter et al., Lightcuts, SIGGRAPH 05/06 A Matrix Interpretation Lights (100,000) Pixels (2,000,000) Problem Statement =Σ( Lights Pixels • Compute sum of columns • Note: We don’t have the matrix data ) Indirect Illumination Many Lights = Σ ( ) 100,000 point lights Environment Map Many Lights = Σ ( ) 100,000 point lights Sun, Sky, Indirect Many Lights = Σ ( ) 100,000 point lights Brute Force Takes Minutes • Why not sum all columns? – With 100,000 lights, still several minutes 10 min 13 min 20 min Our Contribution • Fast, accurate, GPU-based approximation Brute force: 10 min 13 min 20 min 3.8 sec 13.5 sec 16.9 sec Our result: • Application: Preview for lighting design Related Work • Many lights (CPU-based): Walter et al 05/06, Ward 94, Paquette et al 98, Wald et al 03, … • Instant radiosity & related: Keller 97, Dachsbacher & Stamminger 05/06, Laine et al 07, … • Environment maps: Agarwal et al 03, Ostromoukhov et al 04, … • Precomputation-based: Sloan et al 02/03, Ng et al 03/04, Ben-Artzi et al 06, Hasan et al 06, Ritschel et al 07, … • Other global illumination: Ward et al 88, Jensen 96, Hanrahan et al 91, Christensen 97, Scheel 01/02, Gautron et al 05, Krivanek et al 06, Dachsbacher et al 07, … Insight #1: Matrix has structure 900 pixels • Compute small subset of elements • Reconstruct 643 lights A simple scene 30 x 30 image The matrix Insight #2: Sampling Pattern Matters Pixels Lights Point-to-many-points Point-to-point visibility: visibility:Ray-tracing Shadow-mapping Row-Column Duality • Columns: Regular Shadow Mapping Surface samples Shadow map at light position Row-Column Duality • Rows: Also Shadow Mapping! Shadow map at sample position Image as a Weighted Column Sum • The following is possible: compute very small subset of columns compute weighted sum • Use rows to choose a good set of columns! Exploration and Exploitation ? how tocolumns choose compute columns compute rows choose columns and (explore) and weights (exploit) weights? weighted sum Reduced Matrix Reduced columns Clustering Approach Reduced columns Choose k clusters Choose representative columns Reduced Full Representative columns Use the same representatives for the full matrix Weighted sum Visualizing the Reduced Columns Reduced columns: vectors in highdimensional space visualize as … radius = norm Clustering Illustration Columns with various intensities can be clustered Strong but similar columns Weak columns can be clustered more easily The Clustering Metric • Minimize: total cost of all clusters • where: cost of a cluster sum over all pairs in it norms of the squared distance reduced between normalized reduced columns columns How to minimize? • Problem is NP-hard • Not much previous research • Should handle large input: – 100,000 points – 1000 clusters • We introduce 2 heuristics: – Random sampling – Divide & conquer Clustering by Random Sampling Very fast (use optimized BLAS) Some clusters might be too small / large Clustering by Divide & Conquer Splitting small clusters is fast Splitting large clusters is slow Combined Clustering Algorithm Combined Clustering Algorithm Full Algorithm Assemble rows into reduced matrix Cluster reduced columns Compute rows (GPU) Choose representatives Weighted sum Compute columns (GPU) Results • We show 5 scenes: Kitchen Temple Trees Bunny Grand Central • Show reference and 5x difference image • All scenes have 100,000+ lights • Timings – NVidia GeForce 8800 GTX – Light / surface sample creation not included Results: Kitchen • • • • 5x diff 388k polygons Mostly indirect illumination Glossy surfaces Indirect shadows Our result: 13.5 sec Reference: 13 min (432 rows + 864 columns) (using all 100k lights) Results: Temple • 2.1m polygons • Mostly indirect & sky illumination • Indirect shadows 5x diff Our result: 16.9 sec Reference: 20 min (300 rows + 900 columns) (using all 100k lights) Results: Trees • 328k polygons • Complex incoherent geometry 5x diff Our result: 2.9 sec Reference: 14 min (100 rows + 200 columns) (using all 100k lights) Results: Bunny • • • • 869k polygons Incoherent geometry High-frequency lighting Kajiya-Kay hair shader 5x diff Our result: 3.8 sec Reference: 10 min (100 rows + 200 columns) (using all 100k lights) Results: Grand Central 5x diff • 1.5m polygons • Point lights between stone blocks Our result: 24.2 sec Reference: 44 min (588 rows + 1176 columns) (using all 100k lights) The Value of Exploration Our result No exploration (432 rows + 864 columns) (Using 1455 lights) Equal time comparison The Value of Exploration Our result No exploration Equal time comparison: 5x difference from reference Conclusion • Fast, high quality approximation for many lights – GPU-oriented – Sample rows to explore low-rank structure – Sample well-chosen columns • Application: Preview for lighting design – Indirect illumination – Environment maps – Arbitrary lights and shaders Future Work • How many rows + columns? – Pick automatically • Row / column alternation • Progressive algorithm: – stop when user likes the image • Render multiple frames at once? Acknowledgments • Veronica Sundstedt and Patrick Ledda – Temple scene • Bruce Walter, PCG @ Cornell • NSF CAREER 0644175 • Affinito-Stewart Award Thank You Discarded slides Indirect Illumination Many Lights • shoot photons from light sources • treat photons as point lights • deposit on every bounce • cosine-weighted emission Low Rank Assumption • Worst case: lights with very local contribution … The Value of Exploration Our result No exploration (432 rows + 864 columns) (Using 1992 lights) Equal time comparison The Value of Exploration Our result No exploration Equal time comparison: 5x difference image