Skip to content

Commit 69d8e5d

Browse files
committed
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.
1 parent 4919620 commit 69d8e5d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected void updateShadowCams(Camera viewCam) {
145145
float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f);
146146
ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points);
147147

148-
//shadowCam.setDirection(direction);
148+
shadowCam.setFrustumFar(zFar);
149149
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp());
150150
shadowCam.update();
151151
shadowCam.updateViewProjection();

jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public static void updateShadowCamera(ViewPort viewPort,
465465
shadowCam.setProjectionMatrix(null);
466466

467467
if (ortho) {
468-
shadowCam.setFrustum(-1, 1, -1, 1, 1, -1);
468+
shadowCam.setFrustum(-shadowCam.getFrustumFar(), shadowCam.getFrustumFar(), -1, 1, 1, -1);
469469
}
470470

471471
// create transform to rotate points to viewspace

0 commit comments

Comments
 (0)