I'm learning Phong shading and get some confuses:
- What coordinate of light position in Phong shading? (model space, modelview or what else?)
- According to this: http://www.ozone3d.net/tutorials/glsl_lighting_phong_p2.php:
Vertex shader is:
varying vec3 normal, lightDir, eyeVec;
void main()
{
normal = gl_NormalMatrix * gl_Normal;
vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
lightDir = vec3(gl_LightSource[0].position.xyz - vVertex);
eyeVec = -vVertex;
gl_Position = ftransform();
}
Why eyeVec = -vVertex?