我正在使用每像素照明着色器,但我不知道一件事:什么是光源的半向量?
vec3 halfVector = normalize(gl_LightSource[1].halfVector.xyz);
我希望你能用数学行来解释它,我比文字更懂数学:)
最佳答案
来自 this post :
A "halfway vector" (if you mean that by "half vector") is the unit vector at the half angle between two other vectors. Normally the halfway vector [...] is computed between the vector to the viewer v and the light source l:
h := ( v + l ) / || v + l ||
因此,半向量是单位 angle bisector View 和光矢量。
编辑:有关包括半矢量在内的照明模型的完整说明,请参阅 Blinn-Phong wikipedia article
关于math - glsl中光的半向量是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3646401/