CS 445 / 645 Introduction To Computer Graphics: Shading
CS 445 / 645 Introduction To Computer Graphics: Shading
No:
• For point sources, the direction to light varies across the
facet
C2
c1 + t1(c2-c1) + t3(c1 + t2(c3-c1)- c1 + t1(c2-c1)) c1 + t2(c3-c1)
Gouraud Shading
Artifacts
• Often appears dull, chalky
• Lacks accurate specular component
– If included, will be averaged over entire polygon
C1
C3
C4
C3
C2
Discontinuity in rate
of color change
occurs here
Phong Shading
Phong shading is not the same as Phong lighting,
though they are sometimes mixed up
• Phong lighting: the empirical model we’ve been discussing
to calculate illumination at a point on a surface
• Phong shading: linearly interpolating the surface normal
across the facet, applying the Phong lighting model at
every pixel
– Same input as Gouraud shading
– Usually very smooth-looking results:
– But, considerably more expensive
Phong Shading
Linearly interpolate the vertex normals
• Compute lighting equations at each pixel
• Can use specular component
N1
#lights
I i kd Nˆ Lˆi k s Vˆ Rˆi
nshiny
I total ka I ambient
i 1
Gouraud Phong
Perspective Distortion
Image
plane
Break up large polygons
with many smaller ones
i
i
i
i
i
i
uu u u u u
Z – into the scene
Image
plane Break up large polygons
with many smaller ones
A
Rotate -90o
B
and color
i same point C
B D A
D
C
Interpolate between Interpolate between
AB and AD CD and AD
Problems at Shared Vertices
Vertex B is shared by the two
rectangles on the right, but not by the
D C H one on the left
Global Illumination
• The notion that a point is illuminated by more than light from local
lights; it is illuminated by all the emitters and reflectors in the
global scene
The ‘Rendering Equation’
Jim Kajiya (Current head of Microsoft Research) developed this in
1986
I x, x' g x, x'e x, x' r x, x' , x' 'I x' , x' 'dx' '
S