PowerPoint Presentation
13. Materials & Scattering
Dr. Hamish Carr
COMP 5812M: Foundations of Modelling & Rendering
Material Models
We need to model large numbers of photons
So we want statistical behaviour, capturing:
Specular reflection
Glossy reflection
Lambertian (matte) reflection
Subsurface scattering
Transmission
All captured in a scattering function
COMP 5812M: Foundations of Modelling & Rendering
Scattering Functions
Textures
Bi-directional reflectance dist. func. (BRDF)
Bi-directional transmission dist. func. (BTDF)
Bi-directional scattering dist. func. (BSDF)
Bi-dir scattering & subsurface d.f. (BSSDF)
All of which share common features
COMP 5812M: Foundations of Modelling & Rendering
Scattering Functions
Photon arrives at point P (u,v coords)
From direction
Could go any direction, so parametrise by:
– direction light goes out
And get a probability of going that way out
COMP 5812M: Foundations of Modelling & Rendering
Mathematically
Note we have a 6-D function
2D – texture coords for point
2x2D – spherical coordinates for directions
: texture coordinates
: parametrised sphere
(used for directions)
COMP 5812M: Foundations of Modelling & Rendering
Directions
Directions are assumed to be unit vectors
And can be parametrised to a sphere
Texture coordinates give:
Surface tangents
Surface normal
i.e. a local coordinate frame at P
So we can express it in these terms
COMP 5812M: Foundations of Modelling & Rendering
Finding the Surface Frame
Consider dS/du and dS/dv
These form a basis for the tangent plane
Not necessarily orthonormal
But still useful
In texture coordinates,
COMP 5812M: Foundations of Modelling & Rendering
Computation
We assume that the normal vector is known
And take two edges of a triangle
We will compute them twice:
In spatial coordinates
In texture coordinates
Then use a matrix inverse to convert them
COMP 5812M: Foundations of Modelling & Rendering
Spatial Frame
Take the vectors
These form a frame
Now ignore
Since we work in its plane
A
B
C
COMP 5812M: Foundations of Modelling & Rendering
Texture Vectors
Compute b,c in texture space
Texture Edge Vectors:
A
B
C
COMP 5812M: Foundations of Modelling & Rendering
Setting Up Equations
We can express in texture space:
And convert back to spatial coordinates:
COMP 5812M: Foundations of Modelling & Rendering
Matrix Form
COMP 5812M: Foundations of Modelling & Rendering
Problem
Storing 6D functions is impractical
32 samples per param gives 230 ~ 1 GB data
So in practice, we never actually use them
Instead we use Euclidean products of:
BSDF variation in one texture
Local basis in a second texture
Another texture if needed for orientation
COMP 5812M: Foundations of Modelling & Rendering
Sources of BSDFs
Measured (expensive, noisy):
Build a measuring device, store GBs of data
Analytic (clean, expressive):
Build a mathematical model (how?)
Artistic (cheap(er), acceptable):
Pay an artist to paint it
Requires training your artist in BSDFs
COMP 5812M: Foundations of Modelling & Rendering
Blinn-Phong Shading
Just one way to do a BSSDF:
No specular (mirrored reflections)
Gloss (called specular)
Diffuse (Lambertian)
No subsurface scattering
Ambient (substitutes for light transport)
Emissive
COMP 5812M: Foundations of Modelling & Rendering
Translucency
Translucency is transmitted light
May be in addition to reflected light
Green glass transmits green, reflects darker
High-quality rendering does refraction
Other rendering does blending (compositing)
Combines light from behind with material
And causes problems if not ray-tracing
COMP 5812M: Foundations of Modelling & Rendering
Alpha Opacity
Translucency is modelled by alpha
The percentage of (R,G,B) transmitted
Stored as an extra channel in a buffer/image
Often stored premultiplied
Can be stored in a texture
E.g. stained glass window
COMP 5812M: Foundations of Modelling & Rendering
Emission
Surfaces may emit light
In ray-tracing, these are luminaires
The rest of the time, they are an extra term
And are crucial for inter-object lighting
Lights in-scene, torches, gun blast
Often handled with extra textures
Light maps instead of lighting
COMP 5812M: Foundations of Modelling & Rendering
Radiance Function
Also known as the plenoptic function
Measures incoming light everywhere:
Units are radiance ()
Consists of direct and indirect light
COMP 5812M: Foundations of Modelling & Rendering
Ground Truth
We don’t have an ideal solution
We have lots of approximations
So this is very much a matter of choice
Which effects you want to represent
How realistic they look (the eyeball test)
And this is not likely to change soon
COMP 5812M: Foundations of Modelling & Rendering
Approaches
Empirical / phenomenological
Constructed to “look right”
Measured
Physically expensive to measure
Huge storage requirements
Limited creative control
Physically based
Mathematical analysis of physics
COMP 5812M: Foundations of Modelling & Rendering
Physical Constraints
Energy Conservation
Reciprocity
Surface vs. Subsurface
Volumetric Representations
Material Scale
Specular Representation
COMP 5812M: Foundations of Modelling & Rendering
Energy Conservation
You can’t add light once it’s created
Unless the object is a luminaire
in which case emission is dominant term
So total light output < total light input
Expressed in integral form:
COMP 5812M: Foundations of Modelling & Rendering
Reciprocity
Scattering is (almost always) symmetric
The reverse reflection is identical
Generalises to transmission as well
Often called Helmholtz Reciprocity
COMP 5812M: Foundations of Modelling & Rendering
Surface vs. Subsurface
Subsurface scattering may travel
i.e. light emerges somewhere else
This complicates matters
but for now we’ll skip that
COMP 5812M: Foundations of Modelling & Rendering
Volumetric Representation
This all still assumes that we have surfaces
We might have volumetric effects
Complex interactions in a volume of space
These are an entirely different question
Heavily used in science & medicine
Typically a different code path
So next term
COMP 5812M: Foundations of Modelling & Rendering
Material Scale
Visible light has wavelength of about 1
Human hair is about 15 across
And we can feel it with our fingers
Let alone see it visually
Scratches in a surface can cause interference
But in practice, we hand-wave this
For now . . .
COMP 5812M: Foundations of Modelling & Rendering
Specular Reflection
There are (nearly) perfect mirrors
All light reflects in a single direction
Usually (but not always)
Which means a range of 1010 in albedo
This causes numerical problems in codepath
So commonly handled as a separate case
Referred to as impulse reflection
COMP 5812M: Foundations of Modelling & Rendering
Scattering Phenomena
Reflective (all in
Transmissive (all in
Mirror (Impulse)
Glossy (Blurred Mirror)
Lambertian ( indep. of )
Retroreflective
Refractive
&c.
COMP 5812M: Foundations of Modelling & Rendering
Plotting the BSDF
Consider light with respect to surface frame
We can plot the distribution of reflection
Radiance or probability density function (pdf)
BSDF
COMP 5812M: Foundations of Modelling & Rendering
Radiance vs. PDF
Radiance is a physical quantity
pdf is integrated
Over a small patch
Uses cosines like “diffuse” reflection
Carries forward through our integration
Because samples are actually integrals
COMP 5812M: Foundations of Modelling & Rendering
Examples of Scattering
Radiance
PDF
COMP 5812M: Foundations of Modelling & Rendering
Mirror “Scattering”
Mirrors do absorb light
But reflect most of it
Insulators preserve spectral distribution
Conductors have “preferred” frequencies
So typically stored as RGB albedo
This ignores polarisation
We’ll see geometric hacks next term
COMP 5812M: Foundations of Modelling & Rendering
Lambertian vs. Phong
Lambertian ~ Phong diffuse
Effectively captured in ⍴ term
But cosine term needed for pdf
Based on dot product
Which explains success of Phong model
it’s close to the truth
COMP 5812M: Foundations of Modelling & Rendering
Lafortune Model
Measured BRDFs are not centred
i.e. the angle of reflection is off
So they generalised by adding more terms
Multiple specular lobes
With different properties
COMP 5812M: Foundations of Modelling & Rendering
Measured BRDFs
Still too expensive in practice
Massive complex measuring equipment
And 6 parameters
So storage requirements
Effectively a texturing problem anyway
And you end up interpolating in them
COMP 5812M: Foundations of Modelling & Rendering
Torrance-Sparrow Model
Light actually reflects from microfacets
These occlude each other
So the BRDF isn’t quite what you expect
COMP 5812M: Foundations of Modelling & Rendering
Cook-Torrance Model
Diffuse reflection is subsurface
Specular reflection is surface
Extra terms in the equation
COMP 5812M: Foundations of Modelling & Rendering
Oren-Nayar Model
Micro-roughness near the silhouette
Causes extra reflection towards viewer
Extra lightness near boundaries
COMP 5812M: Foundations of Modelling & Rendering
Subsurface Scattering
Light goes in at P, emerges at Q
After complex interactions & bounces
Even the textbooks say this is too complex
There are ways to approximate it (next term)
COMP 5812M: Foundations of Modelling & Rendering
The Practical Reality
People still use Phong lighting for real-time
And they add various tricks to improve it
Per-pixel shading
Texture-based material storage
Geometric hacks (next term)
Where it falls down is global illumination
The ”ambient” term
COMP 5812M: Foundations of Modelling & Rendering