Monte Carlo Integration COS 323 Acknowledgment: Tom Funkhouser.

Slides:



Advertisements
Similar presentations
Monte Carlo Methods and Statistical Physics
Advertisements

Advanced Computer Graphics
Photorealistic Rendering. Ray tracing v. photorealistic rendering What illumination effects are not captured by ray tracing? What illumination effects.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Monte Carlo Integration Robert Lin April 20, 2004.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lectures 18, 19: Monte Carlo Integration Ravi Ramamoorthi Acknowledgements.
CSCE 641: Photon Mapping Jinxiang Chai. Outline Rendering equation Photon mapping.
Photon Tracing with Arbitrary Materials Patrick Yau.
Advanced Computer Graphics (Fall 2009) CS 294, Rendering Lecture 5: Monte Carlo Path Tracing Ravi Ramamoorthi
Machine Learning CUNY Graduate Center Lecture 7b: Sampling.
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 10: Global Illumination Ravi Ramamoorthi Some images courtesy.
Statistics.
Everything on Global Illumination Xavier Granier - IMAGER/UBC.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
#10 MONTE CARLO SIMULATION Systems Fall 2000 Instructor: Peter M. Hahn
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 20: Monte Carlo Path Tracing Ravi Ramamoorthi Acknowledgements.
1 Monte Carlo Global Illumination Brandon Lloyd COMP 238 December 16, 2002.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Computer Graphics (Spring 2008) COMS 4160, Lecture 22: Global Illumination
CSC418 Computer Graphics n Raytracing n Shadows n Global Illumination.
Monte Carlo Integration Digital Image Synthesis Yung-Yu Chuang with slides by Pat Hanrahan and Torsten Moller.
Global Illumination Jian Huang, CS 594, Fall 2002 This set of slides reference text book and the course note of Dutre et. al on SIGGRAPH 2001.
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
Simulation of Random Walk How do we investigate this numerically? Choose the step length to be a=1 Use a computer to generate random numbers r i uniformly.
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
01/24/05© 2005 University of Wisconsin Last Time Raytracing and PBRT Structure Radiometric quantities.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Distribution Ray Tracing.
Machine Learning Lecture 23: Statistical Estimation with Sampling Iain Murray’s MLSS lecture on videolectures.net:
Monte Carlo I Previous lecture Analytical illumination formula This lecture Numerical evaluation of illumination Review random variables and probability.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
1 Lesson 8: Basic Monte Carlo integration We begin the 2 nd phase of our course: Study of general mathematics of MC We begin the 2 nd phase of our course:
Monte Carlo Methods.
02/10/03© 2003 University of Wisconsin Last Time Participating Media Assignment 2 –A solution program now exists, so you can preview what your solution.
Monte Carlo Methods So far we have discussed Monte Carlo methods based on a uniform distribution of random numbers on the interval [0,1] p(x) = 1 0  x.
Monté Carlo Simulation  Understand the concept of Monté Carlo Simulation  Learn how to use Monté Carlo Simulation to make good decisions  Learn how.
Importance Resampling for Global Illumination Justin F. Talbot Master’s Thesis Defense Brigham Young University Provo, UT.
Importance Resampling for Global Illumination Justin Talbot, David Cline, and Parris Egbert Brigham Young University Provo, UT.
CPSC 641 Computer Graphics: Radiosity Jinxiang Chai.
Real-Time High Quality Rendering
CS348B Lecture 9Pat Hanrahan, Spring 2005 Overview Earlier lecture Statistical sampling and Monte Carlo integration Last lecture Signal processing view.
On robust Monte Carlo algorithms for multi-pass global illumination Frank Suykens – De Laet 17 September 2002.
Monte-Carlo Ray Tracing and
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Hybrid Algorithms K. H. Ko School of Mechatronics Gwangju Institute.
Pure Path Tracing: the Good and the Bad Path tracing concentrates on important paths only –Those that hit the eye –Those from bright emitters/reflectors.
02/12/03© 2003 University of Wisconsin Last Time Intro to Monte-Carlo methods Probability.
Computer Graphics III – Monte Carlo integration Direct illumination
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju.
Slide 1Lastra, 2/14/2016 Monte-Carlo Methods. Slide 2Lastra, 2/14/2016 Topics Kajiya’s paper –Showed that existing rendering methods are approximations.
Gil McVean, Department of Statistics Thursday February 12 th 2009 Monte Carlo simulation.
01/26/05© 2005 University of Wisconsin Last Time Raytracing and PBRT Structure Radiometric quantities.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Monte Carlo Integration Digital Image Synthesis Yung-Yu Chuang 12/3/2008 with slides by Pat Hanrahan and Torsten Moller.
Advanced Computer Graphics
Advanced Computer Graphics
Lesson 8: Basic Monte Carlo integration
Introduction to Monte Carlo Method
Sampling and Reconstruction of Visual Appearance
Sampling and Reconstruction of Visual Appearance
The Rendering Equation
Path Tracing (some material from University of Wisconsin)
Monte Carol Integration
Efficient Importance Sampling Techniques for the Photon Map
Monte Carlo I Previous lecture Analytical illumination formula
Monte Carlo Rendering Central theme is sampling:
Foundations of Computer Graphics (Spring 2012)
Monte Carlo Integration
Photon Density Estimation using Multiple Importance Sampling
Presentation transcript:

Monte Carlo Integration COS 323 Acknowledgment: Tom Funkhouser

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

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

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

Estimating the average x1x1x1x1 f(x) xNxNxNxN E(f(x)) E(f(x)) Slide courtesy of Peter Shirley

Other Domains x=b f(x) ab ab x=a Slide courtesy of Peter Shirley

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

Variance x1x1x1x1 xNxNxNxN E(f(x)) E(f(x))

Variance x1x1x1x1 xNxNxNxN Variance decreases as 1/N Error decreases as 1/sqrt(N)

Variance Problem: variance decreases with 1/NProblem: variance decreases with 1/N – Increasing # samples removes noise slowly x1x1x1x1 xNxNxNxN E(f(x)) E(f(x))

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

Stratified Sampling Estimate subdomains separatelyEstimate subdomains separately x1x1x1x1 xNxNxNxN E k (f(x)) E k (f(x)) Arvo

Stratified Sampling This is still unbiasedThis is still unbiased x1x1x1x1 xNxNxNxN E k (f(x)) E k (f(x))

Stratified Sampling Less overall variance if less variance in subdomainsLess overall variance if less variance in subdomains x1x1x1x1 xNxNxNxN E k (f(x)) E k (f(x))

Importance Sampling Put more samples where f(x) is biggerPut more samples where f(x) is bigger x1x1x1x1 xNxNxNxN E(f(x)) E(f(x))

Importance Sampling This is still unbiasedThis is still unbiased x1x1x1x1 xNxNxNxN E(f(x)) E(f(x)) for all N

Importance Sampling Zero variance if p(x) ~ f(x)Zero variance if p(x) ~ f(x) x1x1 xNxN E(f(x)) Less variance with better importance sampling

Generating Random Points Uniform distribution:Uniform distribution: – Use pseudorandom number generator Probability 0 1 

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

Pseudorandom Numbers To get floating-point numbers in [0..1), divide integer numbers by c + 1To 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 uTo 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

Generating Random Points Uniform distribution:Uniform distribution: – Use pseudorandom number generator Probability 0 1 

Importance Sampling Specific probability distribution:Specific probability distribution: – Function inversion – Rejection

Importance Sampling “Inversion method”“Inversion method” – Integrate f ( x ): Cumulative Distribution Function 11

Importance Sampling “Inversion method”“Inversion method” – Integrate f ( x ): Cumulative Distribution Function – Invert CDF, apply to uniform random variable 11

Importance Sampling Specific probability distribution:Specific probability distribution: – Function inversion – Rejection

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

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

Monte Carlo in Computer Graphics

or, Solving Integral Equations for Fun and Profit

or, Ugly Equations, Pretty Pictures

AnimationAnimation Computer Graphics Pipeline RenderingRendering LightingandReflectanceLightingandReflectance ModelingModeling

Rendering Equation Surface Light [Kajiya 1986] Viewer

Rendering Equation This is an integral equationThis is an integral equation Hard to solve!Hard to solve! – Can’t solve this in closed form – Simulate complex phenomena Jensen

Rendering Equation This is an integral equationThis is an integral equation Hard to solve!Hard to solve! – Can’t solve this in closed form – Simulate complex phenomena Heinrich

Rendering Equation This is an integral equationThis is an integral equation Hard to solve!Hard to solve! – Can’t solve this in closed form – Simulate complex phenomena Jensen

Monte Carlo Integration f(x) Shirley

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

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics SurfaceEyePixel x x

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics Surface Eye Light x x’

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics Herf

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics Surface Eye Light x  Surface ’’’’

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics Debevec

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics Diffuse Surface Eye Light x  Specular Surface ’’’’

Monte Carlo Global Illumination Rendering = integrationRendering = integration – Antialiasing – Soft shadows – Indirect illumination – Caustics Jensen

Challenge Rendering integrals are difficult to evaluateRendering integrals are difficult to evaluate – Multiple dimensions – Discontinuities Partial occludersPartial occluders HighlightsHighlights CausticsCaustics Drettakis

Challenge Rendering integrals are difficult to evaluateRendering integrals are difficult to evaluate – Multiple dimensions – Discontinuities Partial occludersPartial occluders HighlightsHighlights CausticsCaustics Jensen

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

Monte Carlo Path Tracing 1000 paths/pixel Jensen

Monte Carlo Path Tracing Drawback: can be noisy unless lots of paths simulatedDrawback: can be noisy unless lots of paths simulated 40 paths per pixel:40 paths per pixel: Lawrence

Monte Carlo Path Tracing Drawback: can be noisy unless lots of paths simulatedDrawback: can be noisy unless lots of paths simulated 1200 paths per pixel:1200 paths per pixel: Lawrence

Reducing Variance Observation: some paths more important (carry more energy) than othersObservation: some paths more important (carry more energy) than others – For example, shiny surfaces reflect more light in the ideal “mirror” direction Idea: put more samples where f(x) is biggerIdea: put more samples where f(x) is bigger

Importance Sampling Idea: put more samples where f(x) is biggerIdea: put more samples where f(x) is bigger

Effect of Importance Sampling Less noise at a given number of samplesLess noise at a given number of samples Equivalently, need to simulate fewer paths for some desired limit of noiseEquivalently, need to simulate fewer paths for some desired limit of noise Uniform random sampling Importance sampling