Graphics2 04 Stochasticraytracing
Graphics2 04 Stochasticraytracing
Stochastic Raytracing 1
Matthias Teschner
From Radiosity to Raytracing
− Radiosity equation governs light transport
for diffuse surfaces. How to describe
light transport for general surfaces?
− How to solve for the light transport?
− How to compute the relevant part of
the light transport towards a sensor?
− Radiosity equation
− Governing equation for diffuse global illumination methods
− Discretization
− Propagation operator
p’ indicates the raycast operator applied to p
See, e.g.: Eric Veach: Robust Monte Carlo Methods for Light Transport Simulation, Ph.D. dissertation, Stanford University, 1997.
− Can be written as
− relates exitant radiance functions Le adds flux to a scene but T removes flux from a scene
− Neumann series
for all direction we will stop the computation when all the sensor or camera elements
are hit by a ray
◼University of Freiburg – Computer Science Department – 15
Forward Raytracing
− At a sensor: Accumulate radiance contributions of rays
after n scattering steps, i.e. compute
Light source
accumulating
the radiance
elements
Sensor
Exemplary rays
− Can be written as
− Neumann series
Light source
Sensor
Exemplary rays
Scene
Sensor
Light
source
− is the part
of visible to the sensor
− Computation of
requires towards
sensor
− is the part of
visible to the sensor
− Computation of
requires towards
p1
− Example
− Uniform PDF for
−
◼University of Freiburg – Computer Science Department – 39
Cumulative Distribution Function CDF P(x)
− Properties
−
− For independent random variables Xi
− PDF
− Estimator
− Integral
−
− Function value
− Approximate sample size
− Integral
− Estimator Sample size approx. 1/N
− PDF
− Estimator
− Integral
− larger value of p gives more samples in a domain
− Function value
− Approximate sample size
− E.g.,
− Samples are two-dimensional
− Uniformly distributed random samples
− E.g.,
− Uniformly distributed random samples
− Probability density function
− Monte Carlo estimator
− Approximate sample size
− Estimator
− Choosing a PDF This flexibility is an important aspect of Monte Carlo integration.
− Probability distribution
− Estimator
− Integral
− PDF
− Estimator
− Importance sampling
− Motivation: contributions of larger
sample values are more important
− PDF should be similar to the shape
of the function
[Suffern]
− Optimal PDF
− E.g., if incident radiance is weighted
with , the PDF should choose
more samples close to the normal
direction
University of Freiburg – Computer Science Department – 56
◼
Monte Carlo Estimator - Error Reduction
− Stratified sampling
− Domain subdivision into strata
− E.g., handling direct and indirect illumination differently
−
− Estimator
− Choosing a PDF This flexibility is an important aspect of Monte Carlo integration.
− Area form
1 2 3 4
[Pharr, Humphreys]
◼University of Freiburg – Computer Science Department – 63
Inversion Method
− Discrete example cont.
− Take a uniform random variable
− has the desired distribution
− Continuous case
− and are continuous functions 1 2 3 4
− Start with the desired PDF [Pharr, Humphreys]
− Derive
− Compute the inverse
− Obtain a uniformly distributed variable
the pdf . cdf. inversion of cdf are all continuous function
a b
[Pharr, Humphreys]
− Example
−
−
−
− Conditional density u
− Inversion method
−
−
University of Freiburg – Computer Science Department – 79
◼ [Pharr, Humphreys]
Uniform Sampling of a Triangle
− Inversion method cont.
− Inverse functions of the cumulative distribution functions
− u is generated between 0 and 1
− v is generated between 0 and 1-u=(1-)½
− PDF is proportional to :
−
−
− Marginal density function
−
− Conditional density for
−
− Inversion method
− [Suffern]
−
University of Freiburg – Computer Science Department – 84
◼
Cosine-Weighted Sampling of a Hemisphere
− Illustration for