Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I use a single shadow map for a small demo scene. A scene is illuminated by a directional light. I need to set appropriate projection and view matrices for a light space. I use an orthographic projection matrix:

glm::ortho(-100.0f, 100.0f, -100.0f, 100.0f, 0.0f, 400.0f);

A view matrix is built this way:

glm::lookAt(glm::normalize(directionToLight), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));

All objects are covered by the shadow map.

What do you think about that ? Is it correct ? How do you set those matrices ?

share|improve this question
1  
Looks fine, although you could get better shadow map resolution by tightening the bounds to fit the bounds of your scene, if it's actually smaller than the 200x200x400 box you're using. –  Nathan Reed Aug 12 '13 at 1:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.