【发布时间】:2012-06-04 14:35:52
【问题描述】:
我正在学习 Phong 着色并有些困惑:
- Phong 着色中灯光位置的坐标是什么? (模型空间、模型视图或其他什么?)
- 据此:http://www.ozone3d.net/tutorials/glsl_lighting_phong_p2.php:
顶点着色器是:
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();
}
为什么 eyeVec = -vVertex?
【问题讨论】: