Title: Advanced Global Illumination
1Advanced Global Illumination
- Brian Chen
- Thursday, February 12, 2004
2Global Illumination
Physical Simulation of Light Transport Accuracy
account for ALL light pathsconservation of
energy Predictionforward renderingcalculate
light meter readings Analysisinverse rendering!
find surface properties ! Realism?perceptually
necessary?
3Global Illumination
- Everything is lit by Everything Else
- Screen color entire scenes lighting surface
reflectance - Refinements Models of area light sources,
caustics, soft-shadowing, fog/smoke,
photometric calibration,
H. Rushmeier et al., SIGGRAPH98 Course 05 A
Basic Guide to Global Illumination
4Overview
- Physics (Optics) concepts
- Models of Light
- Radiometry
- BRDFs Rendering Equation
- Monte Carlo Methods
- Photon Mapping
5Optics Definitions
- Reflection when light bounces off a surface
- Refraction the bending of light when it goes
through different mediums (ex. air and glass) - Diffraction the phenomenon where light bends
around obstructing objects - Dispersion when white light splits into its
components colors, result of refraction
6Lights Dual Nature
- Is light a wave? Or is it a beam of particles?
- Wave Theory of Light Thomas Youngs double-slit
experiment - Particle Theory of Light Newton, refraction
dispersion
7Light Models
- Models of light are used to capture/explain the
different behaviors of light that stem from its
dual nature - Quantum Optics
- Wave Model
- Geometric Optics
8Quantum Optics
- Explains dual wave-particle nature at the
submicroscopic level of electrons - Way too detailed for purposes of image generation
for computer graphics scenes - Therefore, it is not used
9Wave Model
- Simplification of Quantum Model
- Captures effects that occur when light interacts
with objects of size comparable to the wavelength
of light (diffraction, polarization) - This model is also ignored, too complex and
detailed
10Geometric Optics
- Simplest and most commonly used light model
- Assumes light is emitted, reflected, and
transmitted (refraction) - Also assumes
- Light travels in straight lines, no diffraction
- Light travels instantaneously through a medium
(travels at infinite speed) - Light is not influenced by gravity, magnetic
fields
11Radiometry
- Radiometry area of study involved in the
physical measurement of light - Goal of illumination algorithm is to compute the
steady-state distribution of light energy in a
scene
12Radiometric Quantities
- Radiant Power
- flux (in Watts Joule/sec), F
- How much total energy flows from/to/through a
surface per unit time - Irradiance (ear)
- incoming radiant power on a surface per unit
surface area (Watt/m2) - E dF/dA
13More Radiometric Quantities
- Radiosity
- Outgoing radiant power per unit surface area
(Watt/m2) - B dF/dA
14Radiance
- Flux per unit projected area per unit solid angle
(W/(steradian x m2)) - How much power arrives at (or leaves from) a
certain point on a surface, per unit solid angle,
and per unit projected area - L(x, ?) d2F / (d? dA cos?)
- The most important quantity in global
illumination because it captures the appearance
of objects
15Radiance contd
- Radiance The Pointwise Measure of Light
- Free-space light power L (energy/time)
- At least a 5D scalar function L(x, y, z, ?, ?,
) - Position (x,y,z), Angle (?,?) and more (t, ?, )
- Power density units, but tricky
Taken with permission from Jack Tumblin
16Yet More Radiance
- Tricky think Hemispheres
- with a floor
Solid Angle (steradians) d? fraction of
a hemispheres area (4?)
Projected Area
cos ? dA
?
dA
Taken with permission from Jack Tumblin
17Properties of Radiance
- 1 Radiance is invariant along straight paths and
does not attenuate with distance - Radiance leaving point x directed towards point y
is equal to the radiance arriving at point y from
the point x - 2 Sensors, such as cameras and human eye, are
sensitive to radiance - The response of our eyes is proportional to the
radiance incident upon them. - It is now clear that radiance is the quantity
that global illumination algorithms must compute
and display to the observer
18BRDF (Bidirectional Reflectance Distribution
Function)
- Intuitively the BRDF represents, for each
incoming angle, the amount of light that is
scattered in each outgoing angle - BRDF at a point x is defined as the ratio of the
radiance reflected in an exitant direction (?),
and the irradiance incident in a differential
solid angle (?). - fr(x,?-gt?) dL(x-gt?) / (L(xlt-?)cos(Nx,?)d??)
- cos(Nx,?) cos of angle formed by normal
incident direction vector
19Point-wise Reflectance BRDF
Bidirectional Reflectance Distribution Function
?(?i , ?i , ?r , ?r , ?i , ?r , ) (Lr /
Li) a scalar (sr-1)
Illuminant Li
Reflected Lr
Infinitesimal Solid Angle
?
?
20BRDF Properties
- Value of BRDF remains unchanged if the incident
and outgoing directions are interchanged - Law of conservation of energy requires that the
total amount of power reflected all directions
must be less than or equal to the total amount of
power incident on the surface
21BRDF Examples, Diffuse
Fr (x,?lt-gt?) ?d/p, constant ?d is the
fraction of incident energy that is reflected at
a surface, 0-1
Andrew Glassner et al.. SIGGRAPH94 Course
18 Fundamentals and Overview of Computer
Graphics
22BRDF Examples, Specular
Exitant direction R 2(N dot ?)N ?
Andrew Glassner et al.. SIGGRAPH94 Course
18 Fundamentals and Overview of Computer
Graphics
23For Most Surfaces
Most Materials Combination of Diffuse
Speculartheir BRDF is difficult to model with
formulas
Andrew Glassner et al.. SIGGRAPH94 Course
18 Fundamentals and Overview of Computer
Graphics
24Practical Shading Models (BRDF)
- Lambert kd ?d/p
- Phong fr ks((R?n)/(N?)) kd
- Blinn-Phong ks((NH)/(N?)) kd, Hhalfway
vector between ? ? - Modified Blinn-Phong ks(NH)n kd
- Cook-Torrance
- Ward
25Lambert BRDF
26Phong BRDF
27Blinn-Phong BRDF
28Ward Anisotropic BRDF
29Rendering Equation
Finally! Putting radiance and the BRDF together
to get
30BRDF Rendering Eq.
- For example, suppose that we wish to determine
the illumination of a scene containing n light
sources light source 1 to light source n. In
this case, the local illumination of a surface is
given by, - where Lij is the intensity of the jth light
source and wij (?ij,?ij) is the direction to
the jth light source.
31BRDF Rendering Eq.
- For a single point light source, the light
reflected in the direction of an observer is - This is the general BRDF lighting equation for a
single point light source
32Rendering Equation
- Opportunities
- Scalar operations only ?() and L(), indep. of ?,
x,y,z, ?,? - Linearity
- Solution weighted sum of one-light solns.
- Many BRDFs ? weighted sum of diffuse, specular,
gloss terms - Difficulties
- Almost no nontrivial analytic solutions exist
MUST use approximate methods to solve - Verification tough to measure real-world ?() and
L() well - Notable wavelength-dependent surfaces exist
(iridescent insect wings casing, CD grooves,
oil) - BRDF doesnt capture important subsurface
scattering
33Review 1
- Big Ideas
- Measure Light Radiance
- Measure Light Attenuation BRDF
- Light will bounce around endlessly, decaying on
each bounce The Rendering Equation
(intractable must
approximate)
34Monte Carlo Techniques
- Mathematical techniques that use statistical
sampling to simulate phenomena or evaluate values
of functions - Use a probability distribution function (PDF) to
generate random samples, p(x)
35Estimators
- Unbiased when the expected value of the
estimator is exactly the value of the integral - Biased when the above property is not true
- Bias the difference between the expected value
of the estimator and the actual value of the
integral - As number of samples N increases, the estimate
becomes closer
36Monte Carlo Techniques
- The reliability of Monte-Carlo sampling is
measured by the variance of the estimators. The
variance of the estimators is given as -
- where is the primary estimator, while
its average is a secondary estimator
37Monte Carlo Techniques
- As a consequence of the above formula, the
Monte-Carlo technique requires a large number of
samples to reduce the variance of the primary
estimator - The error of the
approximation is itself a random variable with
zero mean, i.e. the estimator is unbiased. The
standard deviation of this estimator is reduced
only proportional to which is known as
the diminishing return of the Monte-Carlo
technique, i.e. the number of samples must be
quadrupled to reduce the standard deviation by
one half.
38Monte Carlo Techniques
- For importance sampling we adjust the pdf p to be
similar in shape to the integrand f. If we were
able to choose p(x) Cf(x), with a constant
factor C 1/I, the variance of the primary
estimator would be zero and a single sample would
always give the correct result. - Unfortunately, the constant C is determined by
the integral we want to compute and is therefore
unavailable. On the other hand, some a priori
knowledge about the shape of f is often available
and can be used to adjust p to reduce the
variance of the estimators.
39Monte Carlo Example
- Computing a one-dimensional integral
- Samples are selected randomly over the domain of
the integral to get a close approximation
(estimator ltIgt - ltIgt (1/N) S f(xi) / p(xi)
40Another Example
- Integration over a hemisphere
- Estimate the radiance at a point by integrating
the contribution of light sources in the scene - Light source L
- I ?Lsourcecos?d?? ?02p ?0 p/2
Lsourcecos?sin?d?df - ltIgt(1/N)S (Lsource(?i) cos?sin?) / p(?i)
- p(?i) cos?sin?/ p
- ltIgt(1/N)S Lsource(?i)
41Steps
- General
- Sampling according to a probability distribution
function - Evaluation of the function at that sample
- Averaging these appropriately weighted sampled
values - Graphics
- Generate random photon paths from source (lights
or pixels) - Set a discrete random length for the path
- Count how many photons terminate in state i,
average radiances for that point
42http//graphics.stanford.edu/courses/cs348b-02/lec
tures/lecture15/walk014.html
43http//graphics.stanford.edu/courses/cs348b-02/lec
tures/lecture15/walk014.html
44Advantages/Disadvantages
- Advantages
- Simple just sample signal/function and average
estimates - Widely applicable nuclear physics, graphics,
high-dimensional integrations of complicated
functions - Can be used with radiosity
- Disadvantages
- Very slow, take many, many samples to converge to
correct solution - Need 4x samples to decrease error by half
45Monte Carlo Images
46Monte Carlo Images
47Photon Mapping
- One of the fastest algorithms available for
global illumination - Monte-Carlo based
- 2-pass algorithm
48Photon Mapping, 1st pass
- 1st pass
- photons shot from the light into the scene
- they bounce around interacting with all the types
of surfaces they encounter - Clever twists
- 1st, instead of redoing those same computations
over and over, a few thousand of time for each
pixels, the photons are stored only once in a
special data structure called a photon map for
later reuse - 2nd, instead of trying to completely fill the
whole scene with billions of photons, a few
thousands to a million photons are sparsely
stored and the rest is statistically estimated
from the density of the stored photons. - After all the photons have been stored in the
map, a statistical estimate of the irradiance at
each photon position is computed.
49Photon Mapping, 2nd Pass
- Direct illumination is computed just like regular
ray tracing, but the indirect illumination, which
comes from the walls and other objects around, is
computed from querying the stored photons in the
photon map - At each secondary hit, the photon map is queried
in order to gather the radiance coming from the
objects around in the environment.
50Photon Mapping Images
51Summary
- Global illuminations goal is to calculate the
steady-state distribution of light energy in a
scene - BRDFs used to calculate reflection radiances
- Rendering Equation used to calculate the radiance
sent out from an object - Monte-Carlo techniques used to calculate
irradiance at random locations throughout scene - Photon Maps used to accurately calculate
caustics, inter-object reflections