How to do directional per fragment lighting in world space?

Posted by user on Game Development See other posts from Game Development or by user
Published on 2013-06-29T19:07:39Z Indexed on 2013/06/29 22:29 UTC
Read the original article Hit count: 306

Filed under:
|
|
|

I am attempting to create a GLSL shader for simple, per-fragment directional light. So far, after following many tutorials, I have continually ran into the issue: my light is specified in world coordinates, however, the shader treats the light's position as being in eye space, thus, the light direction changes when I move the camera. My question is, how to I transform a directional light position such as (50, 50, 50, 0) into eye space, or, would doing things this way be the incorrect approach to the problem?

© Game Development or respective owner

Related posts about opengl

Related posts about glsl