500 likes | 943 Views
Importance Resampling for Global Illumination. Justin F. Talbot Master’s Thesis Defense Brigham Young University Provo, UT. Global Illumination. Goal: Create realistic images from virtual scenes. Global Illumination. Goal: Create realistic images from virtual scenes.
E N D
Importance Resampling for Global Illumination Justin F. Talbot Master’s Thesis Defense Brigham Young University Provo, UT
Global Illumination Goal: Create realistic images from virtual scenes.
Global Illumination Goal: Create realistic images from virtual scenes. Approach: Treat each pixel as an integral.
Monte Carlo Integration Approximation: • Generate random samples, {y1,…,yN}, from density q • Evaluate f at each sample • Compute estimate
Monte Carlo Integration • Importance Sampling • Choose q to be nearly proportional to f • Restrictions: • q must be normalized (integrate to 1) • q must be easy to sample
Thesis Question • Can we generalize importance sampling to allow • unnormalized q? • difficult to sample q? • Motivation: • If so, then we can pick a q that is more proportional to f. • More variance reduction.
Thesis Contributions • Resampled Importance Sampling (RIS) • Proofs • RIS unbiased • RIS variance • Efficiency optimal parameters • Robust approximate parameters • RIS combined with • Stratified Sampling • Multiple Importance Sampling • Application to direct lighting problem
Resampled Importance Sampling • A generalization of importance sampling that permits • unnormalized q and • difficult to sample q. • Based upon a sampling technique called importance resampling.
Importance Resampling • Goal: generate samples from q • Problems: • q may not be normalized. • q can’t be sampled using simpler techniques • Solution: use 2-stage sampling (resampling)
Importance Resampling • Generate proposals from density p.p should be easy to sample Proposals = {x1,…,xM}
Importance Resampling • Generate proposals from density p. • Compute weights.Weighted proposals form a discrete approximation of q
Importance Resampling • Generate proposals from density p. • Compute weights. • Draw samples from the proposals with probability prop. to weight.Samples are approximately distributed according to q!Samples = {y1,…,yN}
Importance Resampling • Provides a way to generate samples from a “difficult” distribution. • Limitations: • Distribution is an approximation for any finite number of proposals, M. • Samples may be repeated if drawn from same set of proposals.
Resampled Importance Sampling • How do we combine • proposals {x1,…,xM}, • weights {w(x1),…,w(xM)}, and • samples {y1,…,yN} to create an unbiased estimate of ?
Resampled Importance Sampling • How do we combine • proposals {x1,…,xM}, • weights {w(x1),…,w(xM)}, and • samples {y1,…,yN} to create an unbiased estimate of ?
Resampled Importance Sampling • How do we combine • proposals {x1,…,xM}, • weights {w(x1),…,w(xM)}, and • samples {y1,…,yN} to create an unbiased estimate of ? Same as standard Monte Carlo integration estimate (except q is not normalized)
Resampled Importance Sampling • How do we combine • proposals {x1,…,xM}, • weights {w(x1),…,w(xM)}, and • samples {y1,…,yN} to create an unbiased estimate of ? Additional term corrects: Importance Resampling approximation Unnormalized q
Thesis Question • Can we generalize importance sampling to allow • unnormalized q? • difficult to sample q? • Motivation: • If so, then we can pick a q that is more proportional to f. • More variance reduction. YES!
Resampled Importance Sampling • The variance of RIS is: • To give more variance reduction than standard importance sampling: • proposals must be computationally cheaper than samples AND • q must be more prop. to f than p (a better importance sampling density).
Resampled Importance Sampling • We also have to choose M (# of proposals) and N (# of samples). • For a fixed time constraint, we have to trade off.
Example - Choosing M and N ↔ N=1, M=450 (Better direct lighting) N=100, M=100 (Better shadows, color)
Resampled Importance Sampling • Could directly minimize variance equation • Too hard, so we approximate
Resampled Importance Sampling • M* = 0.5 * Ttotal / Tproposal • N* = 0.5 * Ttotal / Tsample • Simple • Give equal time to proposals and samples • Robust • Results in no more than twice the variance of the true optimal values
Results – Direct Lighting RIS using estimated optimal values: M* = 218, N* = 64.8 57% variance reduction (equal time)
Results – Direct Lighting N=100, M=100 N=64.8, M=218 N=1, M=450
Results II 34% variance reduction
Results III 33% variance reduction
Stratifying RIS • Stratified sampling
Stratifying RIS • Stratified sampling • Divide domain into strata • Take a single sample in each strata • Avoids clustering of samples
Stratifying RIS • In RIS • Stratify proposals • Avoids clustering • Apply standard techniques
Stratifying Proposals Proposals only RIS without stratification 34% variance reduction
Stratifying RIS • In RIS • Stratify proposals • Avoids clustering • Apply standard techniques
Stratifying RIS • In RIS • Stratify proposals • Avoids clustering • Apply standard techniques • Stratify samples • Avoids clustering • Avoids duplicates
Stratifying RIS • How do we stratify samples? • Equal-proposals • Equal-weights
Stratifying Samples Proposals only Equal-proposals Equal-weights 34% variance reduction 37% variance reduction 42% variance reduction
Multiple Importance Sampling Start at surface Start at light • We can often generate proposals from multiple densities • How can we combine them?
Multiple Importance Sampling Start at surface Start at light • We can often generate proposals from multiple densities • How can we combine them? • Multiple Importance Sampling
Multiple Importance Sampling • Generate proposals from densities p1,…,pK.p should be easy to sample, i.e. using CDF inversion or rejection samplingProposals = {x1,…,xM}
Multiple Importance Sampling • Generate proposals from densities p1,…,pK. • Compute weights.
Multiple Importance Sampling • Generate proposals from densities p1,…,pK. • Compute weights.
Multiple Importance Sampling • Generate proposals from densities p1,…,pK. • Compute weights. • Draw samples from the proposals with probability prop. to weight.
Multiple Importance Sampling Start at surface Start at light
Multiple Importance Sampling MIS without RIS MIS with RIS 30% variance reduction
Thesis Contributions • Resampled Importance Sampling (RIS) • Proofs • RIS unbiased • RIS variance • Efficiency optimal parameters • Robust approximate parameters • RIS combined with • Stratified Sampling • Multiple Importance Sampling • Application to direct lighting problem
Concluding Thoughts • RIS is better than IS when: • q is a better importance sampling density than p AND • Computing proposals is much cheaper than computing samples • Intuition: RIS takes advantage of differences in variance or computation expense
Concluding Thoughts • Future Work • Application to other problems in global illumination • Application to other fields • Development of better choices of q and p • Examine trade off between computational expense and importance sampling quality