Computer Graphics - Shading
Computer Graphics - Shading
- Shading -
Hanyang University
Jong-Il Park
Objectives
But we want
shadow
multiple reflection
translucent surface
Spotlight
Restrict light from ideal point source
Ambient light
Same amount of light everywhere in scene
Can model contribution of many sources and reflecting
surfaces
r = 2 (l · n ) n - l
specular
highlight
Ir ~ ks I cosaf
cosa f
-90 f 90
Roughness
I =kd Id l · n + ks Is (v · r )a + ka Ia
h = ( l + v )/ | l + v |
Only differences in
these teapots are
the parameters
in the modified
Phong model
n = (p2-p0) × (p1-p0)
n = (n1+n2+n3+n4)/ |n1+n2+n3+n4|
I1 ( ys y2 ) I 2 ( y1 ys )
Ia
y1 y2
I1 ( ys y3 ) I 3 ( y1 ys )
I1 Ib
y1 y3
y1
I a ( xb x p ) I b ( x p xa )
Ip
xb xa
Ia Ip Ib
ys
y2 Scan line
I2
y3 I3
v
l
n1 n2
I1 = 0 I2 = 0
area of
desired
highlight
I1 = 0 I2 = 0
Gouraud Shading
Find average normal at each vertex (vertex normals)
Apply modified Phong model at each vertex
Interpolate vertex shades across each polygon
Phong shading
Find vertex normals
Interpolate vertex normals across edges
Interpolate edge normals across polygon
Apply modified Phong model at each fragment