Lecture2
Lecture2
Shading
CSE 803– Fall 2024, MSU
Xiaoming Liu
Thank many researchers who have made their slides and course materials available
Recap: Projection
Image 𝑷= 𝑲 𝑹, 𝒕 𝑿 World
Intrinsic Extrinsic
X
Photo. Material
Source: D Fouhey
Recap: Lenses
Pinhole Model Reality: Lenses
Photosensitive Material
Source: D Fouhey
Today
Controls pupil
Lens…
Pigmented
epithelium
Ganglion axons
Ganglion cell layer
Bipolar cell layer
Receptor layer
Slide Credit: J. Hays
Two Type of Photo Receptors
Cones
cone-shaped
less sensitive
operate in high light
color vision
Rods
rod-shaped
highly sensitive
operate at night
gray-scale vision
# Photons
# Photons
400 500 600 700 400 500 600 700
Wavelength (nm.) Wavelength (nm.)
# Photons
Estimate RGB
at ‘G’ cells from
neighboring
values
Green Blue
im[y,x,c]
B
row y, column x, channel c
im[H-1,W-1,2]
bottom right blue
Source: D Fouhey
Representing Colored Light
S
(H=1,V=1)
V
(H=1,S=0)
Y=0 Y = 0.5 Cb
(Y=0.5,
Cr=0.5)
Cr
(Y=0.5,
Cb=05)
UV planes
Slide Credit: J. Hays, YUV cube: https://en.wikipedia.org/wiki/YUV
YCbCr
b
(L=65,a=0)
2.3m
NEAR
Source: D Fouhey
Surface Normals
Room
[0.06,0.99,0.12]
Legend
Source: D Fouhey
Science Data
Magnetic Field in:
x, y, z
Light at 9 ~wavelenths:
9.4nm, 13.1nm, 17.1nm
19.3nm, 21.1nm, 30.4nm
33.5nm, 160nm, 170nm
NASA Solar Dynamics
Observatory observing solar flare
Volumes
Emerge in 3D
reconstruction,
medical imaging,
temporal data
From: Girdhar et al., Learning a predictable and generative vector representation for objects.
ECCV 2016
Other Images
Source: D Fouhey
Now
Now
Photo. Material
Source: D Fouhey
Light and Surfaces
What happens when
light hits a surface?
Surface
Source: D Fouhey
Light and Surfaces
What happens when
light hits a surface?
1. Absorbed
It’s absorbed and
converted into some other
Surface
form of energy (e.g., a
black shirt getting hot in
the sun)
Source: D Fouhey
Light and Surfaces
What happens when
light hits a surface?
2. Transmitted
Possibly bouncing around
before going through or
Surface
out (e.g. lenses bend and
go through, milk bounces
around)
Source: D Fouhey
Light and Surfaces
What happens when
light hits a surface?
3. Reflected
It’s reflected back, in one
or more directions with
Surface
varying amounts (e.g.,
mirror, or a white surface)
Source: D Fouhey
Light and Surfaces
What happens when
light hits a surface?
4. Everything
All of the above! Real
surfaces often have
Surface
combinations of all of
these options.
Source: D Fouhey
Modeling Light and Surfaces
Opaque Reflections
Bi-directional reflectance
function: % reflected given
incident angle to light
reflected angle to the
Surface
viewer.
Source: D Fouhey
Specular and Diffuse Reflection
Diffuse Specular
Totally
Basically different
same
Source: D Fouhey
Diffuse Reflection
Lambertian Surface
Light depends only on
orientation of surface
ϕi, θi
to light. Result of random
Surface
small facets. Looks
identical at all views.
𝜙! , 𝜃!
Source: D Fouhey
Diffuse Reflection
N Lambert’s Law
N: surface normal
𝜃! S: source direction and
S strength
ρ: how much is reflected
Surface 𝐵 = 𝜌𝑵 ⋅ 𝑺
𝐵 = 𝜌 𝑺 cos 𝜃
Source: D Fouhey
Specular Reflection
Specular Surface
Light reflected like a
mirror, but spreads out
in a “lobe” around the
reflection ray
Surface
Source: D Fouhey
Specular Reflection
Phong Model
V V: vector to viewer
R: reflection ray
R α: shininess constant
𝐵= !
𝑉 𝑅 "
Surface
Source: D Fouhey
BRDFs can be incredibly complicated…
55
Roth, Tong, Liu, CVPR 15,16, PAMI 17
Algorithm Overview
56
Photometric Stereo
Lambertian reflectance model
I x = ρ x (ka + kd ℓ ⋅ n x )
Image Albedo Ambient Diffuse
57
Photometric Stereo: Illumination Matrix
• Each row is the intensity of the projected shape.
• Missing data for obscured locations.
• Use matrix completion* to fill in missing data.
F M
p
…
* Lin et al., The augmented lagrange multiplier method for exact recovery of corrupted low-rank matrices. UIUC Tech. Report,
2009. 58
Photometric Stereo:
Lighting / Shape Estimation
M LT
= x
S
ρ( 1, nx, ny, nz )T
( ka, kdlx, kdly, kdlz )
59
Results: Jennifer Lawrence
60
Shape from Shading in Practice
https://www.youtube.com/watch?v=4GiLAOtjHNo
3min video