Shadow mapping view frustum clean-up (more intuitive LookAt Up vector).

This commit is contained in:
J. de Vries
2016-03-28 01:07:11 +02:00
parent d5c3be70ab
commit d7ed65ff5d

View File

@@ -164,7 +164,7 @@ int main()
GLfloat near_plane = 1.0f, far_plane = 7.5f; GLfloat near_plane = 1.0f, far_plane = 7.5f;
lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane); lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
//lightProjection = glm::perspective(45.0f, (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // Note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene. //lightProjection = glm::perspective(45.0f, (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // Note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene.
lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(1.0)); lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));
lightSpaceMatrix = lightProjection * lightView; lightSpaceMatrix = lightProjection * lightView;
// - now render scene from light's point of view // - now render scene from light's point of view
simpleDepthShader.Use(); simpleDepthShader.Use();