gl_LightSource[i].halfVector not working on Intel HD3000


it seems the gl_LightSource[i].halfVector data is wrong on the Intel HD 3000 graphics card with the latest driver (, running OpenGL 3.1 and GLSL 1.40.

I tried computing it by myself and my phong shader now works fine.

Is this happening because the built-ins are deprecated and have been removed?

I think the reason is that most implementations try to keep it (too) simple and assume the vector to the viewer simply to be (0,0,1) for any vertex. With the default camera pointing in negative z direction (0,0,-1) this is only true if the vertex under consideration lies on the view axis of the camera (z axis). In other words the more off-centered a vertex is in device coordinates (screen), the worse it gets.

To my knowledge, this is neither hardware- nor driver dependent. Since i had the same problem on my GF560 it seems it is also not vendor specific.


thanks for the answer.
So it’s better to compute it by ourselves, right?

For a better quality, yes. However, there might be cases where the described simplification is acceptable, for example when most shaded geometry is close to the middle of the screen or maybe if there is a really hard limit on the fps to be achieved…

I do compute them myself. :wink:


Thank you

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.