How to move a directional light according to the camera movement?

Posted by Andrea Benedetti on Game Development See other posts from Game Development or by Andrea Benedetti
Published on 2012-10-24T09:30:48Z Indexed on 2012/10/24 11:18 UTC
Read the original article Hit count: 311

Filed under:
|
|

Given a light direction, how can I move it according to the camera movement, in a shader?

Think that an artist has setup a scene (e.g., in 3DSMax) with a mesh in center of that and a directional light with a position and a target. From this position and target I've calculated the light direction. Now I want to use the same direction in my lighting equation but, obviously, I want that this light moves correctly with the camera.

Thanks.

© Game Development or respective owner

Related posts about shaders

Related posts about lighting