As I understand it, Gouraud shading calculates light color for each vertex and does interpolation on that color, whereas Phong shading interpolates the normal for each pixel and calculates light color based on that interpolated value.
However, when I tried to derive the light color mathematically, I ended up with the same formula for both ways!
(Where n1 and n2 are the normals of the two vertices, t is the coefficient for interpolation, L is the light direction, and the plane on the top and the dotted line means screen and a pixel.)
The light colors for the two methods are derived as:
Gouraud: L = t*dot(n1,L) + (1-t)*dot(n2,L)
Phong: L = dot(t*n1+(1-t)*n2,L)
and the results are the same.
Can anyone tell me what's wrong with my derivations?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…