Phong 着色和 Gouraud 着色有什么区别?

What is the difference between Phong Shading and Gouraud Shading?

据我了解,Gouraud shading 计算每个顶点的光色并对该颜色进行插值,而 Phong shading 插值每个像素的法线,并根据该插值计算光色。

然而,当我试图从数学上推导出光的颜色时,我最终得到了两种方法相同的公式!

(其中n1n2是两个顶点的法线,t是插值系数,L为光线方向,上面的平面和虚线表示屏幕和一个像素。)

两种方法的光色推导为:

结果是一样的

谁能告诉我我的推导有什么问题?

而在 Gouraud shading the light is calculates per vertex (Vertex shader), at Phong shading 时,灯光是按片段计算的(片段着色器)。
因此,Gouraud shading计算图元顶点(角)的光照,并对图元覆盖的片段进行光照插值。
使用 Phong 着色时,会为每个片段单独计算光线。

一般情况下,一个光源是由Bidirectional reflectance distribution function计算出来的。该函数计算光在表面上的反射率,并取决于入射光的矢量、视点和表面的法向量。
Gouraud shading the vertex color (reflectance) is interpolated and at Phong shading the 3 vectors are interpolated. That won't make any difference if the function c = brdf(l, v, n) is linear, where c is the color, l is the light direction, v is the view vector and n is the normal vector (e.g. Lambertian reflectance). But if the light model is not linear (e.g. Blinn–Phong)处,然后Gouraud着色的线性插值导致不同的结果。

比较Gouraud shading and Phong shading


另请参阅:
GLSL fixed function fragment program replacement

Gouraud shading / Phong shading