Title: Shading
1Shading Material Appearance
Lots of slides from Addy Ngan
2Discussion about mass-spring
- Possible topics
- Implementation is hard
- Stability
- Damping
- Euler vs. Runge Kutta
- Constant tuning
- Difficulty of assignments
3Assignment 4 Ray casting
- Lots of code design, more than for assignment 3
- We give you
- Image class
- VL
- parser
- Ray, Hit classes
- You have to design code
- Object3D, Sphere, plane, triangle
- Group, transform
- Material, diffuse shading
- Camera, orthographic, perspective
- different visualization (color, normal, t)
- Will be used in assignment 5 ray tracing
- Used to be two one-week assignment
- Prove that you can manage your time!
4Material appearance
- Input for realistic rendering
- Geometry, Lighting and Materials
- Materials appearance
- Color
- Texture
- Intensity and shape of highlights
- Glossiness
Slide Addy Ngan
5BRDF
- Bidirectional Reflectance Distribution Function
- Ratio of light coming from one directionthat
gets reflected in another direction - Focuses on angular aspects, not spatial variation
of the material - How many dimensions?
Incoming direction
Outgoing direction
6BRDF
- Bidirectional Reflectance Distribution Function
- 4D
- 2 angles for each direction
- R(?i ,?i ?o, ?o)
7Slice at constant incidence
highlight
incoming
incoming
Example Plot of PVC BRDF at 55 incidence
8Laser demo
9Unit issues - radiometry
- We will not be too formal in this lecture
- Typical issues
- Directional quantities vs. integrated over all
directions - Differential terms per solid angle, per area,
per time - Power, intensity, flux
10Light sources
- Today, we only consider point light sources
- For multiple light sources, use linearity
- We can add the solutions for two light sources
- I(ab)I(a)I(b)
- We simply multiply the solution when we scale the
light intensity - I(s a) s I(a)
a
b
11Light intensity
- 1/r2 falloff
- Why?
- Same power in all concentric circles
- but in graphics we often cheat with or ignore
this term. - In particular, 1/(arb) is popular
12Incoming radiance
- The amount of light received by a surface depends
on incoming angle - Bigger at normal incidence
- Similar to Winter/Summer difference
- By how much?
- Cos ? law
- Dot product with normal
- This term is sometimes included in the BRDF,
sometimes not
n
?
13Questions?
14Ideal Diffuse Reflectance
- Assume surface reflects equally in all
directions. - An ideal diffuse surface is, at the microscopic
level, a very rough surface. - Example chalk, clay, some paints
15Ideal Diffuse Reflectance
- Ideal diffuse reflectors reflect light according
to Lambert's cosine law.
16Ideal Diffuse Reflectance recap
- Single Point Light Source
- kd diffuse coefficient.
- n Surface normal.
- l Light direction.
- Li Light intensity
- r Distance to source
n
?
r
l
17Ideal Diffuse Reflectance More Details
- If n and l are facing away from each other, n l
becomes negative. - Using max( (n l),0 ) makes sure that the result
is zero. - From now on, we mean max() when we write .
- Do not forget to normalize your vectors for the
dot product!
18Questions?
19Ideal Specular Reflectance
- Reflection is only at mirror angle.
- View dependent
- Microscopic surface elements are usually oriented
in the same direction as the surface itself. - Examples mirrors, highly polished metals.
n
?
?
l
r
20Non-ideal Reflectors
- Real materials tend to deviate significantly from
ideal mirror reflectors. - Highlight is blurry
- They are not ideal diffuse surfaces either
21Non-ideal Reflectors
- Simple Empirical Model
- We expect most of the reflected light to travel
in the direction of the ideal ray. - However, because of microscopic surface
variations we might expect some of the light to
be reflected just slightly offset from the ideal
reflected ray. - As we move farther and farther, in the angular
sense, from the reflected ray we expect to see
less light reflected.
22The Phong Model
- How much light is reflected?
- Depends on the angle between the ideal reflection
direction and the viewer direction ?.
n
r
?
?
l
Camera
?
v
23The Phong Model
- Parameters
- ks specular reflection coefficient
- q specular reflection exponent
n
r
?
?
l
Camera
?
v
24The Phong Model
- Effect of the q coefficient
25Phong Examples
- The following spheres illustrate specular
reflections as the direction of the light source
and the coefficient of shininess is varied.
Phong
26How to get the mirror direction?
n
r
?
?
l
r
27The Phong Model
- Sum of three components
- diffuse reflection
- specular reflection
- ambient.
28Ambient Illumination
- Represents the reflection of all indirect
illumination. - This is a total hack!
- Avoids the complexity of global illumination.
29Putting it all together
30Questions?
31Adding color
- Diffuse coefficients
- kd-red, kd-green, kd-blue
- Specular coefficients
- ks-red, ks-green, ks-blue
- Specular exponent
- q
32Fresnel Reflection
- Increasing specularity near grazing angles.
Source Lafortune et al. 97
33Questions?
34Material appearance techniques
- BRDF models specular lobe
- Intuition
- maximum when view aligned with the reflected
light - Reflection-vector lobe
- (V R)n
- e.g. Phong 75, Lafortune 97
- Half-vector lobe
- (H N)n
- e.g. Ward 92, Cook-Torrance 81
35Blinn-Torrance Variation of Phong
- Uses the halfway vector h between l and v.
n
h
?
l
Camera
v
36Lobe Comparison
- Half vector lobe
- Gradually narrower when approaching grazing
- Mirror lobe
- Always circular
Half vector lobe
Mirror lobe
37Half vector lobe
- Consistent with what we observe in the dataset.
- More details in our paper
Example Plot of PVC BRDF at 55 incidence
38Questions?
39Microfacet Theory
- Example
- Water surface as a microfacet distribution
- Bright pixels
- Microfacets aligned with the vector between sun
and eye - But not the ones in shadow
- And not the ones that are occluded
40Microfacet Theory
- Model surface by tiny mirrors Torrance Sparrow
1967
41Microfacet Theory
- Value of BRDF at (L,V) is a product of
- number of mirrors oriented halfway between L and
V
42Microfacet Theory
- Value of BRDF at (L,V) is a product of
- number of mirrors oriented halfway between L and
V
43Microfacet Theory
- Value of BRDF at (L,V) is a product of
- number of mirrors oriented halfway between L and
V
44Microfacet Theory
- Value of BRDF at (L,V) is a product of
- number of mirrors oriented halfway between L and
V - ratio of the un(shadowed/masked) mirrors
45Microfacet Theory
- Value of BRDF at (L,V) is a product of
- number of mirrors oriented halfway between L and
V - ratio of the un(shadowed/masked) mirrors
- Fresnel coefficient
46Microfacet Theory-based Models
- Develop BRDF models by imposing simplifications
Torrance-Sparrow 67, Blinn 77, Cook-Torrance
81 - Microfacet normal distribution p(H)
- Gaussian-like
spherical plot of a Gaussian-like p(H)
47Microfacet Theory-based Models
- Develop BRDF models by imposing simplifications
Torrance-Sparrow 67, Blinn 77, Cook-Torrance
81 - Microfacet normal distribution p(H)
- Gaussian-like
- Shadowing/Masking
- Assume V-cavities
- Independent of p(H)
spherical plot of a Gaussian-like p(H)
48Dark blue paint
Acquired data
Lighting
Material Dark blue paint
49Dark blue paint
Acquired data
Blinn-Phong
Material Dark blue paint
50Dark blue paint
Acquired data
Cook-Torrance
Material Dark blue paint
51Questions?
52Observations
- Some materials impossible to represent with a
single lobe
Acquired data
Cook-Torrance
Material Red Christmas Ball
53Adding a second lobe
- Some materials impossible to represent with a
single lobe
Acquired data
Cook-Torrance 2 lobes
Material Red Christmas Ball
54Questions?
55Anisotropic BRDFs
- Surfaces with strongly oriented microgeometry
elements - Examples
- brushed metals,
- hair, fur, cloth, velvet
Source Westin et.al 92
56Anisotropic measurement
- Extension to Marschner 00, Matusik 03
- Cut multiple strips from material sample at
different orientations
Cutting material strips at different orientations
57Anisotropic Materials
Brushed Aluminum
Yellow Satin
Purple Satin
Red Velvet
58Purple Satin
- Split specular reflection
- Impossible to model with Gaussian-like
distribution
spherical plot of a Gaussian-like p(H)
Measured data
59Purple Satin
- Split specular reflection
- Our estimated distribution shows two main peaks
spherical plot of the estimated p(H)
Measured data
60Purple Satin
- Split specular reflection
- Possible explanation from the microgeometry
spherical plot of the estimated p(H)
Macro photograph cone pairs overlay
61Questions
62Spatially-varying materials
- Bidirectional Texture Function (BTF)
- 6D (2D for space, 2D for incoming light, 2D view)
Texture mapped
BTF
Sattler 03
Sattler 03
63BTFs
- BTF acquired by Addy Ngan
64Questions?
65Questions?
66Shaders (Material class)
- Functions executed when light interacts with a
surface - Constructor
- set shader parameters
- Inputs
- Incident radiance
- Incident reflected light directions
- surface tangent (anisotropic shaders only)
- Output
- Reflected radiance
67Shader
- Initially for production (slow) rendering
- Renderman in particular
- Now used for real-time (Games)
- Evaluated by graphics hardware
68Questions?
69Procedural Textures
Image by Turner Whitted
70Procedural Textures
- Advantages
- easy to implement in ray tracer
- more compact than texture maps (especially for
solid textures) - infinite resolution
- Disadvantages
- non-intuitive
- difficult to match existing texture
71Questions?
Justin Legakis
Ken Perlin
Justin Legakis
72(No Transcript)
73BRDFs in the movie industry
- http//www.virtualcinematography.org/publications/
acrobat/BRDF-s2003.pdf - For the Matrix movies
- Clothes of the agent Smith are CG, with measured
BRDF
74How do we obtain BRDFs?
- Gonioreflectometer
- 4 degrees of freedom
Source Greg Ward
75BRDFs in the movie industry
- http//www.virtualcinematography.org/publications/
acrobat/BRDF-s2003.pdf - For the Matrix movies
gonioreflectometer
Measured BRDF
Measured BRDF
Test rendering
76Photo
CG
Photo
CG
77Questions?