12/6/2010 12/6/2010 1 Monte Carlo Integration Monte Carlo Integration for Image Synthesis for Image Synthesis COS 526, Fall 2010 COS 526, Fall 2010 Tom Tom Funkhouser Funkhouser Slides from Slides from Rusinkiewicz Rusinkiewicz, Shirley , Shirley Outline Outline • Motivation Motivation • Monte Carlo integration Monte Carlo integration • Monte Carlo path tracing Monte Carlo path tracing • Variance reduction techniques Variance reduction techniques • Sampling techniques Sampling techniques • Conclusion Conclusion Motivation Motivation • Rendering = integration Rendering = integration – Antialiasing Antialiasing – Soft shadows Soft shadows – Indirect illumination Indirect illumination – Caustics Caustics Surface Surface Eye Eye Light Light x ϖ Surface Surface ϖ’ w d n w ) w (x, L w w x f ) w (x, L ) w (x, L i r e o r r r r r r r r ) ( ) , , ( • ′ ′ ′ + = ∫ Ω Challenge Challenge • Rendering integrals are difficult to evaluate Rendering integrals are difficult to evaluate – Multiple dimensions Multiple dimensions – Discontinuities Discontinuities • Partial occluders Partial occluders • Highlights Highlights • Caustics Caustics Jensen Jensen dA x x G x x x)V x L( e x x x x f e) (x,x L ) w L(x, S r e ) , ( ) , ( ) , , ( ′ ′ → ′ → → ′ + → = ∫ r Outline Outline • Motivation Motivation • Monte Carlo integration Monte Carlo integration • Monte Carlo path tracing Monte Carlo path tracing • Variance reduction techniques Variance reduction techniques • Sampling techniques Sampling techniques • Conclusion Conclusion Integration in 1D Integration in 1D x=1 x=1 f(x) f(x) ? ) ( 1 0 ∫ = dx x f Slide courtesy of Slide courtesy of Peter Shirley Peter Shirley
9
Embed
Monte Carlo Integration for Image Synthesis · 12/6/2010 1 Monte Carlo Integration for Image Synthesis COS 526, Fall 2010 Tom Tom Funkhouser Funkhouser Slides from Slides from Rusinkiewicz
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
12/6/201012/6/2010
11
Monte Carlo Integration Monte Carlo Integration
for Image Synthesisfor Image Synthesis
COS 526, Fall 2010COS 526, Fall 2010
Tom Tom FunkhouserFunkhouser
Slides from Slides from RusinkiewiczRusinkiewicz, Shirley, Shirley
OutlineOutline
•• MotivationMotivation
•• Monte Carlo integrationMonte Carlo integration
•• Monte Carlo path tracingMonte Carlo path tracing
•• Integrate radiance Integrate radiance for each pixel for each pixel by sampling pathsby sampling pathsrandomlyrandomly
Diffuse SurfaceDiffuse Surface
EyeEye
LightLight
xx
SpecularSpecularSurfaceSurface
PixelPixel
wdnw)w(x,Lwwxf)w(x,L)w(x,L ireo
rrrrrrrr)(),,( •′′′+= ∫
Ω
Simple Monte Carlo Path TracerSimple Monte Carlo Path Tracer
•• Step 1:Step 1: Choose a ray p=camera, d=(Choose a ray p=camera, d=(θθ,,φφ); assign); assign weight = 1weight = 1
•• Step 2:Step 2: Trace ray to find intersection with nearest surfaceTrace ray to find intersection with nearest surface
•• Step 3:Step 3: Randomly choose between emitted and reflected lightRandomly choose between emitted and reflected light–– Step 3a:Step 3a: If emitted,If emitted,
return weight * Lereturn weight * Le
–– Step 3b:Step 3b: If reflected,If reflected,weight *= reflectanceweight *= reflectanceGenerate ray in random directionGenerate ray in random directionGo to step 2Go to step 2
Simple Monte Carlo Path TracerSimple Monte Carlo Path Tracer
•• Step 1:Step 1: Choose a ray (u,v,Choose a ray (u,v,θθ,,φφ); assign); assign weight = 1weight = 1
•• Step 2:Step 2: Trace ray to find intersection with nearest surfaceTrace ray to find intersection with nearest surface
•• Step 3:Step 3: Randomly choose between emitted and reflected lightRandomly choose between emitted and reflected light–– Step 3a:Step 3a: If emitted,If emitted,
return weight * Lereturn weight * Le
–– Step 3b:Step 3b: If reflected,If reflected,weight *= reflectanceweight *= reflectanceGenerate ray in random directionGenerate ray in random directionGo to step 2Go to step 2
12/6/201012/6/2010
66
Sampling TechniquesSampling Techniques
•• Problem: how do we generate random Problem: how do we generate random points/directions during path tracing?points/directions during path tracing?–– NonNon--rectilinear domainsrectilinear domains
–– Importance (BRDF)Importance (BRDF)
–– StratifiedStratified
SurfaceSurface
EyeEye
xx
Generating Random PointsGenerating Random Points
•• Uniform distribution:Uniform distribution:–– Use random number generatorUse random number generator
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolisC
umul
ativ
eC
umul
ativ
eP
roba
bilit
yP
roba
bilit
y
00
11
ΩΩ
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Cum
ulat
ive
Cum
ulat
ive
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
yy
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Cum
ulat
ive
Cum
ulat
ive
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
yy
12/6/201012/6/2010
77
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Cum
ulat
ive
Cum
ulat
ive
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
yy
xx
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Cum
ulat
ive
Cum
ulat
ive
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Pro
babi
lity
Pro
babi
lity
00
11
ΩΩ
xxxx
xxxx
xxxx
xxxx xxxx
xxxxxxxx
xxxx
xxxx xxxx
Generating Random PointsGenerating Random Points
•• Specific probability distribution:Specific probability distribution:–– Function inversionFunction inversion
–– RejectionRejection
–– MetropolisMetropolis
Pro
babi
lity
0
1
Ω
xx
xx
xx
xx xx
xxxx
xx
xx xx
Combining Multiple PDFsCombining Multiple PDFs
•• Balance heuristicBalance heuristic–– Use combination of samples generated for each PDFUse combination of samples generated for each PDF
–– Number of samples for each PDF chosen by weightsNumber of samples for each PDF chosen by weights
–– Metropolis light transportMetropolis light transport
•• Biased, but consistentBiased, but consistent–– Noise filteringNoise filtering
–– Adaptive samplingAdaptive sampling
–– Irradiance cachingIrradiance caching
JensenJensen
12/6/201012/6/2010
99
SummarySummary
•• Monte Carlo Integration MethodsMonte Carlo Integration Methods–– Very generalVery general
–– Good for complex functions with high dimensionalityGood for complex functions with high dimensionality
–– Converge slowly (but error appears as noise)Converge slowly (but error appears as noise)
•• ConclusionConclusion–– Preferred method for difficult scenesPreferred method for difficult scenes
–– Noise removal (filtering) and Noise removal (filtering) and irradiance caching (photon maps)irradiance caching (photon maps)used in practiceused in practice
More InformationMore Information
•• BooksBooks–– Realistic Ray TracingRealistic Ray Tracing, Peter Shirley, Peter Shirley
–– Realistic Image Synthesis Using Photon MappingRealistic Image Synthesis Using Photon Mapping, Henrik Wann Jensen, Henrik Wann Jensen
•• ThesesTheses–– Robust Monte Carlo Methods for Light Transport SimulationRobust Monte Carlo Methods for Light Transport Simulation, Eric Veach, Eric Veach
–– Mathematical Models and Monte Carlo Methods for Physically Based Mathematical Models and Monte Carlo Methods for Physically Based RenderingRendering, Eric La Fortune, Eric La Fortune
•• Course NotesCourse Notes–– Mathematical Models for Computer GraphicsMathematical Models for Computer Graphics, Stanford, Fall 1997, Stanford, Fall 1997
–– State of the Art in Monte Carlo Methods for Realistic Image SynthesisState of the Art in Monte Carlo Methods for Realistic Image Synthesis, , Course 29, SIGGRAPH 2001Course 29, SIGGRAPH 2001