advanced computer graphics rendering equation · · 2015-07-13university of freiburg –computer...
TRANSCRIPT
Matthias Teschner
Computer Science DepartmentUniversity of Freiburg
Advanced Computer Graphics
Rendering Equation
University of Freiburg – Computer Science Department – Computer Graphics - 2
Outline
rendering equation
Monte Carlo integration
sampling of random variables
University of Freiburg – Computer Science Department – Computer Graphics - 3
Reflection and Rendering Equation
reflection equation at point p for reflective surfaces
incident radiance - weighted with the BRDF - is integrated over the hemisphere to compute the outgoing radiance
expresses energy balance between surfaces
outgoing radiance from a surface can be incident to another surface
rendering equation at point p for reflective surfaces
adds emissive surfaces to the reflection equation
exitant radiance is the sum of emitted and reflected radiance
expresses the steady state of radiance in a scene including light sources
University of Freiburg – Computer Science Department – Computer Graphics - 4
Ray-Casting Operator
in general, the incoming radiance is not only determined by light sources, but also by outgoing radiance of reflective surfaces
incident radiance can be computed bytracing a ray from p into direction
ray-casting operator nearest hit point from p into direction
if no surface is hit, radiance from a back-ground or light source can be returned
[Suffern]
University of Freiburg – Computer Science Department – Computer Graphics - 5
Rendering Equation with Ray-Casting Operator
using the ray-casting operator,
can be rewritten as
goal: computation of the outgoing radiance at all points p into all directions towards the camera to compute the image
towards other surface points to account for indirect illumination
University of Freiburg – Computer Science Department – Computer Graphics - 6
Forms of the Rendering Equation
hemisphere form
area form p is a sample point on a surface dA
visibility function
solid angle vs. area
[Suffern]
University of Freiburg – Computer Science Department – Computer Graphics - 7
Forms of the Rendering Equation
the area form works with a visibility term useful for direct illumination from area lights
the hemisphere form works with the ray-casting operator useful for indirect illumination
[Suffern]hemisphere form area form
University of Freiburg – Computer Science Department – Computer Graphics - 8
Solving the Rendering Equation
recursively cast rays into the scene
maximum recursion depth due to absorption of light
for point lights, directional lights, perfect reflection andtransmission, the integrals reduce to simple sums radiance from only a few directions contributes
to the outgoing radiance
for area lights and indirect illumination, i. e. diffuse-diffuse light transport, Monte Carlo techniques are used to numerically evaluate the multi-dimensional integrals
University of Freiburg – Computer Science Department – Computer Graphics - 9
Outline
rendering equation
Monte Carlo integration
sampling of random variables
University of Freiburg – Computer Science Department – Computer Graphics - 10
approximately evaluate the integral by
randomly sampling the hemisphere tracing rays into the sample directions computing the incoming radiance from the sample directions
challenge approximate the integral as exact as possible trace as few rays as possible trace relevant rays
for diffuse surfaces, rays in normal direction are more relevant than rays perpendicular to the normal
for specular surfaces, rays in reflection direction are relevant rays to light sources are relevant
Introduction
University of Freiburg – Computer Science Department – Computer Graphics - 11
Properties
benefits processes only evaluations of the integrand
at arbitrary points in the domain
works for a large variety of integrands, e.g., it handles discontinuities
appropriate for integrals of arbitrary dimensions
drawbacks using n samples, the scheme converges to the correct
result with O (n½), i.e. to half the error, 4n samples are required
errors are perceived as noise, i.e. pixels are arbitrarily too bright or dark
evaluation of the integrand at a point is expensive
University of Freiburg – Computer Science Department – Computer Graphics - 12
continuous random variables canonical uniform random variable
samples from arbitrary distributions can be computed from
probability density function (PDF) the probability of a random variable taking certain value ranges
cumulative distribution function (CDF) describes the probability of a random variable to be less or equal to x
Continuous Random Variables
The probability, that the random variable is in the specified domain, is 1.
The probability, that the random variable has a certain exact value, is 0.
infinite number of possible values(in contrast to discrete random variable)
University of Freiburg – Computer Science Department – Computer Graphics - 13
motivation: expected value of an estimator functionis equal to the integral in the rendering equation
expected value of a function is defined as the weighted average value of the function over a domain
with
properties
example for uniform
Expected Value
for independent random variables Xi
processes an infinite number of samples x according to a PDF p(x)
University of Freiburg – Computer Science Department – Computer Graphics - 14
motivation: quantifies the error of a Monte Carlo algorithm
variance of a function is the expected deviation of the function from its expected value
properties
Variance
for independent random variables Xi
University of Freiburg – Computer Science Department – Computer Graphics - 15
motivation: approximation of the integral in the rendering equation
goal: computation of uniformly distributed random variables probability density function Monte Carlo estimator expected value of is equal to the integral
variance convergence rate of independent from the dimensionality appropriate for high-dimensional integrals
Monte Carlo EstimatorUniform Random Variables
constant and integration to one
University of Freiburg – Computer Science Department – Computer Graphics - 16
Monte Carlo EstimatorUniform Random Variables
University of Freiburg – Computer Science Department – Computer Graphics - 17
integral
estimator
for an increasing number of uniformly distributed random variables Xi , the estimator converges to one
Examples - Uniform Random Variables
[Suffern]
uniformly distributedrandom samples
University of Freiburg – Computer Science Department – Computer Graphics - 18
Monte Carlo estimator
Monte Carlo EstimatorNon-uniform Random Variables
p (Xi) 0
University of Freiburg – Computer Science Department – Computer Graphics - 19
samples Xi are multidimensional
e.g.
uniformly distributed random samples
probability density function
Monte Carlo estimator
N can be arbitrary, N is independent from the dimensionality
Monte Carlo EstimatorMultiple Dimensions
University of Freiburg – Computer Science Department – Computer Graphics - 20
approximate computation of the irradiance at a point
estimator
probability distribution should be similar to the shape of the integrand
as incident radiance is weighted with cos , it is appropriate to generate more samples close to the top of the hemisphere
Monte Carlo EstimatorIntegration over a Hemisphere
University of Freiburg – Computer Science Department – Computer Graphics - 21
probability distribution (cont.)
estimator
Monte Carlo EstimatorIntegration over a Hemisphere
University of Freiburg – Computer Science Department – Computer Graphics - 22
Monte Carlo IntegrationSteps
choose an appropriate probability density function
generate random samples according to the PDF
evaluate the function for all samples
average the weighted function values
University of Freiburg – Computer Science Department – Computer Graphics - 23
variance
estimator
for increasing N the variance decreases with O(N)
the standard deviation decreases with O(N½)
variance is perceived as noise
Monte Carlo EstimatorError
University of Freiburg – Computer Science Department – Computer Graphics - 24
importance sampling motivation: contributions of larger
function values are more important PDF should be similar to the shape
of the function optimal PDF e.g., if incident radiance is weighted with cos , the PDF should
choose more samples close to the normal direction
stratified sampling domain subdivision into strata does not increase the variance
multi-jittered sampling alternative to random samples for, e.g.,
uniform sampling of area lights
Monte Carlo EstimatorVariance Reduction / Error Reduction
[Suffern]
University of Freiburg – Computer Science Department – Computer Graphics - 25
Outline
rendering equation
Monte Carlo integration
sampling of random variables inversion method
rejection method
transforming between distributions
2D sampling
examples
University of Freiburg – Computer Science Department – Computer Graphics - 26
mapping of a uniform random variable to a goal distribution
discrete example four outcomes with probabilities
and
computation of the cumulative distribution function
Inversion Method
[Pharr, Humphreys]
University of Freiburg – Computer Science Department – Computer Graphics - 27
discrete example cont. take a uniform random variable
has the desired distribution
continuous case and are continuous functions
start with the desired PDF
compute
compute the inverse
obtain a uniformly distributed variable
compute which adheres to
Inversion Method
[Pharr, Humphreys]
University of Freiburg – Computer Science Department – Computer Graphics - 28
power distribution e.g., for sampling the Blinn microfacet model
computation of the PDF
CDF
inverse of the CDF
sample generation generate uniform random samples
are samples from the power distribution
Inversion MethodExample 1
University of Freiburg – Computer Science Department – Computer Graphics - 29
exponential distribution e.g., for considering participating media
computation of the PDF
CDF
inverse of the CDF
sample generation generate uniform random samples
are samples from the power distribution
Inversion MethodExample 2
University of Freiburg – Computer Science Department – Computer Graphics - 30
piecewise-constant distribution e.g., for environment lighting
PDFwith
Inversion MethodExample 3
[Pharr, Humphreys]
University of Freiburg – Computer Science Department – Computer Graphics - 31[Pharr, Humphreys]
CDF
CDF is linear between and with slope
sample generation generate uniform random samples
compute with and
compute with
are samples from
Inversion MethodExample 3
University of Freiburg – Computer Science Department – Computer Graphics - 32
Outline
rendering equation
Monte Carlo integration
sampling of random variables inversion method
rejection method
transforming between distributions
2D sampling
examples
University of Freiburg – Computer Science Department – Computer Graphics - 33
draws samples according to a function dart-throwing approach works with a PDF and a scalar with
properties is not necessarily a PDF PDF, CDF and inverse CDF
do not have to be computed simple to implement useful for debugging purposes
sample generation generate a uniform random sample generate a sample according to accept if
Rejection Method
[Pharr, Humphreys]
a b
University of Freiburg – Computer Science Department – Computer Graphics - 34
Outline
rendering equation
Monte Carlo integration
sampling of random variables inversion method
rejection method
transforming between distributions
2D sampling
examples
University of Freiburg – Computer Science Department – Computer Graphics - 35
computation of a resulting PDF, when a function isapplied to samples from an arbitrary distribution random variables are drawn from bijective transformation (one-to-one mapping) How does the distribution look like?
example
Transforming Between Distributions
University of Freiburg – Computer Science Department – Computer Graphics - 36
multiple dimensions is an n-dimensional random variable
is a bijective transformation
transformation of the PDF
example (polar coordinates) samples with density
corresponding density with and
Transforming Between Distributions
University of Freiburg – Computer Science Department – Computer Graphics - 37
example (spherical coordinates)
example (solid angle)
Transforming Between Distributions
University of Freiburg – Computer Science Department – Computer Graphics - 38
Outline
rendering equation
Monte Carlo integration
sampling of random variables inversion method
rejection method
transforming between distributions
2D sampling
examples
University of Freiburg – Computer Science Department – Computer Graphics - 39
Concept
generation of samples from a 2D joint density function
general case compute the marginal density function
compute the conditional density function
generate a sample according to
generate a sample according to
marginal density function integral of for a particular over all -values
conditional density function density function for given a particular
University of Freiburg – Computer Science Department – Computer Graphics - 40
Outline
rendering equation
Monte Carlo integration
sampling of random variables inversion method
rejection method
transforming between distributions
2D sampling
examples
University of Freiburg – Computer Science Department – Computer Graphics - 41
Uniform Sampling of a Hemisphere
PDF is constant with respect to a solid angle
marginal density function
conditional density for
inversion method
[Suffern]
University of Freiburg – Computer Science Department – Computer Graphics - 42
Uniform Sampling of a Hemisphere
inversion method cont. inverse functions of the cumulative distribution functions
generating uniformly sampled random values and
applying the inverse CDFs to obtain and
conversion to Cartesian space
is a normalized direction
University of Freiburg – Computer Science Department – Computer Graphics - 43
Uniform Sampling of a Hemisphere
illustration for
generate less samples for smaller angles
University of Freiburg – Computer Science Department – Computer Graphics - 44
Uniform Sampling of a Unit Disk
PDF is constant with respect to area
marginal density function
conditional density
inversion method
University of Freiburg – Computer Science Department – Computer Graphics - 45
Uniform Sampling of a Unit Disk
inversion method cont. inverse functions of the cumulative distribution functions
generating uniformly sampled random values and
applying the inverse CDFs to obtain and
generate less samples for smaller radii
1
r
University of Freiburg – Computer Science Department – Computer Graphics - 46
Uniform Sampling of a Cosine-Weighted Hemisphere
PDF is proportional to
marginal density function
conditional density for
inversion method
[Suffern]
University of Freiburg – Computer Science Department – Computer Graphics - 47
Uniform Sampling of a Cosine-Weighted Hemisphere
inversion method cont. inverse functions of the cumulative distribution functions
generating uniformly sampled random values and
applying the inverse CDFs to obtain and
conversion to Cartesian space
is a normalized direction
x- y- values uniformly sample a unitdisk, i. e., cosine-weighted samplesof the hemisphere can also be obtainedby uniformly sampling a unit sphereand projecting the samples onto thehemisphere
University of Freiburg – Computer Science Department – Computer Graphics - 48
Uniform Sampling of a Cosine-Weighted Hemisphere
illustration for
generate less samples for smaller and larger angles
cosine-weightedhemisphere
(top view, side view)
uniformhemisphere(top view)
[Suffern]
University of Freiburg – Computer Science Department – Computer Graphics - 49
Uniform Sampling of a Triangle
sampling an isosceles right triangle of area 0.5 u, v can be interpreted as
Barycentric coordinates can be used to generate samples
for arbitrary triangles
marginal density function
conditional density
inversion method
u
v(u, 1-u)
[Pharr, Humphreys]
University of Freiburg – Computer Science Department – Computer Graphics - 50
Uniform Sampling of a Triangle
inversion method cont. inverse functions of the cumulative distribution functions
generating uniformly sampled random values and
applying the inverse CDFs to obtain and
u is generated between 0 and 1
v is generated between 0 and 1-u=½
University of Freiburg – Computer Science Department – Computer Graphics - 51
Piecewise-Constant 2D Distribution
samples defined over e.g., an environment map
is defined by a set of values
is the value of in the range
with and
integral over the domain
University of Freiburg – Computer Science Department – Computer Graphics - 52
Piecewise-Constant 2D Distribution
marginal density function
piecewise-constant 1D function
defined by values
conditional density
piecewise-constant 1D function
sample generation see example 3 of the inversion method
University of Freiburg – Computer Science Department – Computer Graphics - 53
Piecewise-Constant 2D Distribution
environment map
low-resolution of the marginal density function and the con-ditional distributions for rows
first, a row is selected accordingto the marginal density function
then, a column is selected fromthe row's 1D conditional distribution
[Pharr, Humphreys]
Paul Debevec, Grace Cathedral