Fixed an issue where some occluders were wrongly culled out from the shadow map at very steep light angle, and when the view cam was almost align with light direction.

This commit is contained in:
Nehon 2016-11-20 19:02:02 +01:00
parent ed817507d4
commit 35de6d9fda
2 changed files with 2 additions and 2 deletions

View File

@ -145,7 +145,7 @@ public class DirectionalLightShadowRenderer extends AbstractShadowRenderer {
float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f); float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f);
ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points); ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points);
//shadowCam.setDirection(direction); shadowCam.setFrustumFar(zFar);
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp());
shadowCam.update(); shadowCam.update();
shadowCam.updateViewProjection(); shadowCam.updateViewProjection();

View File

@ -465,7 +465,7 @@ public class ShadowUtil {
shadowCam.setProjectionMatrix(null); shadowCam.setProjectionMatrix(null);
if (ortho) { if (ortho) {
shadowCam.setFrustum(-1, 1, -1, 1, 1, -1); shadowCam.setFrustum(-shadowCam.getFrustumFar(), shadowCam.getFrustumFar(), -1, 1, 1, -1);
} }
// create transform to rotate points to viewspace // create transform to rotate points to viewspace