University of California Riverside Why we need shading
Suppose we build a model of a red sphere We get something like
But we want - lighting
facing light
shadow
Shading
Why does a real sphere look like this? Shading - lighting
Why does a real sphere look like this? facing light
shadow Shading - material properties
shiny
matte
Image source: [1] Shading - viewing location
What if I move?
Image source: [1] Shading - surface orientation
well lit
poorly lit
Image source: [1] General rendering
Based on physics conservation of energy Surfaces can absorb light emit light reflect light transmit light Idealized light sources
ambient point light
spotlight directional light Ambient light
Achieve uniform light level No shadows Same light level everywhere Point light
Light emitted from a point p Uniform in all directions 1 Falls off with distance: `(x) = L kx − pk2 Point light - limitations
rapid falloff
no light
sharp shadow Soft shadows Spotlight
Light emitted from a point p Emited in a cone Brightest in middle of cone Falls off with distance Spotlight
p cose φ `(x) = L kx − pk2
θ cos φ φ
x −θ θ Spotlight - exploring e
e = 1
−θ θ e = 20 e = 60 Directional light
Light source at infinity Rays come in parallel No falloff Characterized by direction Lambertian reflection model
Image source: [1] Emitted a I = RL0 I = LR h RE
Lambertian reflection model
w a
n l θ n l
w h Light Absorbed Intensity LL0 Energy E = Lwa E = L0wh a I = LR h
Lambertian reflection model
w a
n l θ n l
w h Light Absorbed Emitted Intensity LL0 I = RL0 Energy E = Lwa E = L0wh RE Lambertian reflection model
w a
n l θ n l
w h Light Absorbed Emitted a Intensity LL0 I = RL0 I = LR h Energy E = Lwa E = L0wh RE = LRcos θ = LRn · l
Avoid bug: I = LR max(n · l, 0)
Lambertian reflection model
a
n l θ n l
θ a θ h a I = LR h = LRn · l
Avoid bug: I = LR max(n · l, 0)
Lambertian reflection model
a
n l θ n l
θ a θ h a I = LR = LRcos θ h Avoid bug: I = LR max(n · l, 0)
Lambertian reflection model
a
n l θ n l
θ a θ h a I = LR = LRcos θ = LRn · l h Lambertian reflection model
a
n l θ n l
θ a θ h a I = LR = LRcos θ = LRn · l h Avoid bug: I = LR max(n · l, 0) Ambient reflection
I = LR max(n · l, 0) l Surfaces facing away from the light will be totally black n Ambient reflection
I = LaRa + LdRd max(n · l, 0) l All surfaces get the same amount of ambient light n Phong reflection model
Image source: [1] Phong reflection model
Efficient n v Reasonably realistic l r 3 components 4 vectors Phong reflection model
I = Ia + Id + Is α = RaLa + RdLd max(n · l, 0) + RsLs max(cos φ, 0) Ambient reflection
Ia = RaLa 0 ≤ Ra ≤ 1 Diffuse reflection Diffuse reflection
a
Id = RdLd max(n · l, 0) n l
θ a θ h Specular reflection
Ideal reflector θi = θr
r is the mirror reflection direction Specular reflection
Specular surface
specular reflection is strongest in reflection direction Specular reflection
α Is = RsLs max(cos φ, 0)
specular reflection drops off with increasing φ Phong reflection model
I = Ia + Id + Is α = RaLa + RdLd max(n · l, 0) + RsLs max(v · r, 0)
n v l r Attribution
[1] Andrea Fisher Fine Pottery. jody-folwell-jar05big.jpg. https://www.eyesofthepot.com/santa-clara/jody folwell.