1 / 53

Monte Carlo Integration

Monte Carlo Integration. COS 323. Acknowledgment: Tom Funkhouser. Integration in 1D. f(x). x=1. Slide courtesy of Peter Shirley. We can approximate. g(x). f(x). x=1. Slide courtesy of Peter Shirley. Or we can average. f(x). E(f(x)). x=1. Slide courtesy of Peter Shirley.

nakisha
Download Presentation

Monte Carlo Integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Monte Carlo Integration COS 323 Acknowledgment: Tom Funkhouser

  2. Integration in 1D f(x) x=1 Slide courtesy of Peter Shirley

  3. We can approximate g(x) f(x) x=1 Slide courtesy of Peter Shirley

  4. Or we can average f(x) E(f(x)) x=1 Slide courtesy of Peter Shirley

  5. Estimating the average f(x) E(f(x)) x1 xN Slide courtesy of Peter Shirley

  6. Other Domains f(x) < f >ab x=a x=b Slide courtesy of Peter Shirley

  7. Benefits of Monte Carlo • No “exponential explosion” in required number of samples with increase in dimension • Resistance to badly-behaved functions

  8. Variance E(f(x)) x1 xN

  9. Variance Variance decreases as 1/N Error decreases as 1/sqrt(N) E(f(x)) x1 xN

  10. Variance • Problem: variance decreases with 1/N • Increasing # samples removes noise slowly E(f(x)) x1 xN

  11. Variance Reduction Techniques • Problem: variance decreases with 1/N • Increasing # samples removes noise slowly • Variance reduction: • Stratified sampling • Importance sampling

  12. Stratified Sampling • Estimate subdomains separately Arvo Ek(f(x)) x1 xN

  13. Stratified Sampling • This is still unbiased Ek(f(x)) x1 xN

  14. Stratified Sampling • Less overall variance if less variance in subdomains Ek(f(x)) x1 xN

  15. Importance Sampling • Put more samples where f(x) is bigger E(f(x)) x1 xN

  16. Importance Sampling • This is still unbiased E(f(x)) for all N x1 xN

  17. Importance Sampling • Zero variance if p(x) ~ f(x) E(f(x)) Less variance with better importance sampling x1 xN

  18. Generating Random Points • Uniform distribution: • Use pseudorandom number generator 1 Probability 0 W

  19. Pseudorandom Numbers • Deterministic, but have statistical properties resembling true random numbers • Common approach: each successive pseudorandom number is function of previous • Linear congruential method: • Choose constants carefully, e.g.a = 1664525b = 1013904223c = 232 – 1

  20. Pseudorandom Numbers • To get floating-point numbers in [0..1),divide integer numbers by c + 1 • To get integers in range [u..v], divide by(c+1)/(v–u+1), truncate, and add u • Better statistics than using modulo (v–u+1) • Only works if u and v small compared to c

  21. Generating Random Points • Uniform distribution: • Use pseudorandom number generator 1 Probability 0 W

  22. Importance Sampling • Specific probability distribution: • Function inversion • Rejection

  23. Importance Sampling • “Inversion method” • Integrate f(x): Cumulative Distribution Function 1

  24. Importance Sampling • “Inversion method” • Integrate f(x): Cumulative Distribution Function • Invert CDF, apply to uniform random variable 1

  25. Importance Sampling • Specific probability distribution: • Function inversion • Rejection

  26. Generating Random Points • “Rejection method” • Generate random (x,y) pairs,y between 0 and max(f(x))

  27. Generating Random Points • “Rejection method” • Generate random (x,y) pairs,y between 0 and max(f(x)) • Keep only samples where y < f(x)

  28. Monte Carlo in Computer Graphics

  29. or, Solving Integral Equationsfor Fun and Profit

  30. or, Ugly Equations, Pretty Pictures

  31. Computer Graphics Pipeline Modeling Animation Rendering Lighting and Reflectance

  32. Viewer Rendering Equation Surface Light [Kajiya 1986]

  33. Rendering Equation • This is an integral equation • Hard to solve! • Can’t solve thisin closed form • Simulate complexphenomena Heinrich

  34. Rendering Equation • This is an integral equation • Hard to solve! • Can’t solve thisin closed form • Simulate complexphenomena Jensen

  35. Monte Carlo Integration f(x) Shirley

  36. Monte Carlo Path Tracing Estimate integral for each pixel by random sampling

  37. Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics

  38. Eye Pixel x Surface Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics

  39. Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics Light x’ Eye x Surface

  40. Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics Herf

  41. Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics Surface Light Eye w w’ x Surface

  42. Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics Debevec

  43. Monte Carlo Global Illumination SpecularSurface • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics Light Eye w w’ x Diffuse Surface

  44. Monte Carlo Global Illumination • Rendering = integration • Antialiasing • Soft shadows • Indirect illumination • Caustics Jensen

  45. Challenge • Rendering integrals are difficult to evaluate • Multiple dimensions • Discontinuities • Partial occluders • Highlights • Caustics Drettakis

  46. Challenge • Rendering integrals are difficult to evaluate • Multiple dimensions • Discontinuities • Partial occluders • Highlights • Caustics Jensen

  47. Monte Carlo Path Tracing Big diffuse light source, 20 minutes Jensen

  48. Monte Carlo Path Tracing 1000 paths/pixel Jensen

  49. Monte Carlo Path Tracing • Drawback: can benoisy unless lots ofpaths simulated • 40 paths per pixel: Lawrence

  50. Monte Carlo Path Tracing • Drawback: can benoisy unless lots ofpaths simulated • 1200 paths per pixel: Lawrence

More Related