Illumination
Outline
• Physical foundations of light
• Representing reflections
• The Rendering Equation
• Analytical intractability
• Formalizing our approximation
• Categories of illumination models
• Evaluating Illumination Models
• Shading models
• Beyond CS123
Modeling Light
Representing Reflections
• Reflections can be thought of as absorption
and prompt remission of photons
• Light comes in, a fraction goes out towards
observer (remember conservation of energy)
• This is a function.
– it takes incoming intensity, incoming wavelength,
incoming angle, and outgoing angle of interest
– it returns outgoing intensity and wavelength
– we call this a BRDF or bidirectional reflectance
distribution function
Modeling Reflection
Lambertian Reflectance
• An example of such a function is the
Lambertian BRDF
• Lambertian surfaces appear to have the
same brightness no matter where you are
observing them from - look at the walls
around you
• Such a BRDF can be defined by Lambert’s
cosine law:
N — unit normal of A
I = Ip kd cos θ, i.e., L — unit vector in direction of light
I
p
θ
N
L
A
dA
Modeling Reflection
Specular Reflectance
• Most materials are not perfectly diffuse
• This leaves us to define irregular BRDFs,
i.e., ones which are viewer-dependent
• We call this adding the specular property
of a material
• The value of this BRDF is greatest when
the outgoing angle is opposite the
incoming angle, as in a perfect mirror
• Think of a patch of water as it ripples
Modeling Reflections
Advanced Techniques
• There are many more complex and more
accurate BRDFs such as Blinn’s and
Anisotropic.
• There are even more complicated
distribution functions such as BSSDF or
bidirectional subsurface scattering function
• Furthermore researchers collect tables of
data for B*DFs of specific materials using
devices like the one pictured
Modeling Light
The Rendering Equation
• Generalized rendering equation formulated
by Jim Kajiya, 1986:
L(i → j ) = G (i ↔ j ) Le(i → j ) + ∫ f (k → i → j ) L(k → i )dk
S
• i.e.: Light energy traveling from point i to
j is equal to light emitted from i to j, plus
the integral over S (all points on all
surfaces) of reflectance from point k to i to
j, times the light from k to i, all attenuated
by a geometry factor.
– L(i → j ) is the amount of light traveling along the
ray from point i to point j.
– Le is the amount of light emitted by the surface
(luminance)
– f (k → i → j ) is the Bidirectional Reflectance
Distribution Function (BRDF) of the surface.
Describes how much of the light incident on the
surface at i from the direction of k leaves the
surface in direction of j.
– G (i ↔ j ) is a geometry term which involves
occlusion, distance, and the angle between the
surfaces
Andries van Dam October 29, 2009 Illumination Models 11/30
INTRODUCTION TO COMPUTER GRAPHIC S
Modeling Light
The Intractability
• The Universe has been simulating the
solution to the rendering equation since
the beginning of time so it would be
ridiculous if we could solve it. It is
provably unsolvable (left as an exercise to
the reader)
– this means we have to be clever in trying to
approximate the equation to trick the eye
– luckily the eye is easily fooled
• There are infinite possible wavelengths
– we will restrict our discussion to “red”, “green”,
and “blue” light because these 3 cover the
largest triangle (gamut) in the CIE space
• The world is, for our purposes, continuous,
while we need to display pixels
– this means we will compute samples of the world
at surface elements and translate them into pixel
data
• This leaves us with a discussion of how
best to make pretty pictures
Illumination Models
Local versus Global Models
• The rendering equation takes into account
non local information
– Thus the most realistic illumination
models try to take this global data into
account
– However purely local models can also
produce believable results for far
smaller costs
Illumination Models
Local Illumination
• Take only direct lighting information into
account when computing a sample
• Local illumination is an approximation to
global illumination
• Usually involves an “ambient term” to set a
sort of minimum bar for object illumination
Illumination Models
Global Illumination
• Simulates what happens when other objects
and scene elements affect light reaching a
surface element
• Lights and shadows
– most light striking a surface element comes directly
from emissive light sources in the scene (direct
illumination)
– sometimes light from a source is blocked by other
objects
– surface element is then in “shadow” from that light
source
• Inter-object reflection
– light bounces off other objects toward our surface
element
– when that light reaches our surface element, it
brightens it (indirect illumination)
object
eye
Illumination Models
Local versus Global Models
• Local models concentrate on light from
direct sources
– pro: scene can be rendered fast
– con: pay a price in lost realism; lose interesting
effects of light transport because we ignore
effects of all other objects in the scene when
considering a particular surface element
• Global models concentrate on capturing
the all illumination information
– pros: shadows, inter-object reflection, refraction,
i.e. bending of light at translucent surfaces,
volumetric effects of participating media such as
air, water, and fog
– cons: slow
Illumination Models
Phong
• Simple, NOT physically-based
• Does attempt to simulate some of the
most important observable effects of
common light interactions
• Specifies characteristics of surfaces
– ambient component: accounts for non-specific
global light
– diffuse component: accounts for the color of the
object under normal conditions using lamberts
cosine law I = Ip kd (N • L)
– specular component: accounts for highlights on
shiny objects
• Specular reflection proportional (R • V)n
– as n increases, highlight is more concentrated,
surface appears glossier
Illumination Models
Computing Results
• Variables
– λ = color component (e.g. R, G, and B)
– i = intensity of light as measured at surface
– ia= the amount of ambient light used in the scene
– k = material's efficiency at reflecting light (attenuation
coefficient)
– ka is the ambient attenuation coefficient for this object's
material (we would expect ka ~ kd)
– O = innate color of object's material at specific point on
surface
• Ambient component
– effect on surface constant regardless of orientation, no
geometric information
– total hack (crudest possible approximation to inter-
object reflection), but makes all objects a little visible
• Diffuse component
– uses Lambert's diffuse-reflection cosine law
– idir (light's intensity) and ℓ (light's direction) vary for
each light source
– kd is the diffuse attenuation coefficient
– Od = innate color of object's diffuse material property at
specific point on surface
I λ = iaλ k a Od λ + ∑ idir k d Od (N • L )
lights
Illumination Models
Computing Results
• We can add a specular hack to increase
“accuracy”
• Energy from a single light reflected by a
single surface element can be computed
Iλ = IaλkaOdλ + fattIpλ[kdOdλ(N • L) + ksOsλ(R • V)n]
l +e
h=
l +e
Specular term
δ
e = viewpoint
r = reflected image of light source
ℓ = vector from the light source
n = surface normal
h = the half vector, i.e., average of vectors e and -ℓ
δ = angle between h and n
n = specular coefficient
Andries van Dam October 29, 2009 Illumination Models 24/30
INTRODUCTION TO COMPUTER GRAPHIC S
Illumination Models
Computing Results
• Look closely at the specular term:
n
k S OSλ ( R • V )
• We can compute this term recursively
– shoot a ray from eye through a pixel on the screen
– calculate intersection of ray with a primitive in the
scene
– shoot a ray from the intersection point to calculate
the contribution of other objects in the lighting
– applying our simple illumination model at
intersection point
– can even be done in hardware thanks to modern
gpus
• We call this Ray Tracing
• Ray tracing is a pseudo global model that
you will be implementing soon (in software)
Shading Models
Flat
• We define a normal at each polygon (not
at the vertices)
• Lighting: Evaluate the BRDF the center of
each polygon using the associated normal
• Shading: Every sample point on that
polygon is taken to have that result
Shading Models
Gouraud
• We define a normal at each vertex
• Lighting: Evaluate the BRDF at each
vertex using the associated normal
• Shading: For every sample point on the
polygon we interpolate the color values at
vertices of the polygon computed in the
lighting step
Shading Models
Phong
• We define a normal at each vertex
• Lighting: Evaluate the BRDF at each
vertex using the associated normal
• Shading: For every sample point on the
polygon we interpolate the normals at
vertices of the polygon and compute the
color using the BRDF which we use to
determine the color (explained in
polygonal rendering lecture soon)
Advanced Techniques
Photon Mapping
• Photon mapping is a more accurate
approximation of the rendering equation
that uses statistical methods to improve
sampling
• Balances accuracy and speed
• Henrik Wann Jensen wrote the book on it.
Literally (as you will find out if you take
CS224)
Advanced Techniques
Others
• Metropolis Light Transport
– the most accurate feasible technique
– too slow for most purposes
• Radiosity
– Make sure to come to lecture on Novemeber 12th