I’ve implemented per-pixel phong shading in GLSL. On curved surfaces, like the stanford bunny,
the results look fine to me; however, when applying the same shading to a plane ( geometry: just 2 triangles… ),
a weird distortion of the specular highlight appears.
http://fs1.directupload.net/images/141124/rnb7rund.png
The highlight seems to be broken up in two parts along the diagonal.
I’ve had the fragment shader output normals, view vector & light vector as fragment color,
and they looked fine to me - no obvious discontiniuties or anything.
Is there an explanation for this? ( Other than me doing something wrong in the shader )
It reminds me of the effect you get when UV coordinates are not perspective corrected.
However, I used the smooth interpolation qualifier for all attributes, so that can’t be the reason.
Also, the distortion effect starts to disappear when I tessellate the plane. It’s less obvious when
I use 8 triangles instead of 2, and more or less gone when I use 32 triangles.