diff --git a/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java index 4beb4000c..e184b7fa2 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java @@ -158,7 +158,6 @@ public class BasicShadowRenderer implements SceneProcessor { ShadowUtil.updateFrustumPoints(viewCam, viewCam.getFrustumNear(), viewCam.getFrustumFar(), - 1.0f, points); Vector3f frustaCenter = new Vector3f(); diff --git a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java index 1ac016f15..094c77c28 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java @@ -148,7 +148,7 @@ public class DirectionalLightShadowRenderer extends AbstractShadowRenderer { //We prevent computing the frustum points and splits with zeroed or negative near clip value float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f); - ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points); + ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, points); shadowCam.setFrustumFar(zFar); shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp()); @@ -183,7 +183,7 @@ public class DirectionalLightShadowRenderer extends AbstractShadowRenderer { protected GeometryList getOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders) { // update frustum points based on current camera and split - ShadowUtil.updateFrustumPoints(viewPort.getCamera(), splitsArray[shadowMapIndex], splitsArray[shadowMapIndex + 1], 1.0f, points); + ShadowUtil.updateFrustumPoints(viewPort.getCamera(), splitsArray[shadowMapIndex], splitsArray[shadowMapIndex + 1], points); //Updating shadow cam with curent split frustra if (lightReceivers.size()==0) { diff --git a/jme3-core/src/main/java/com/jme3/shadow/PssmShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/PssmShadowRenderer.java index 4b854ec37..022d4eb0c 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/PssmShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/PssmShadowRenderer.java @@ -398,7 +398,7 @@ public class PssmShadowRenderer implements SceneProcessor { //We prevent computing the frustum points and splits with zeroed or negative near clip value float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f); - ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points); + ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, points); //shadowCam.setDirection(direction); shadowCam.getRotation().lookAt(direction, shadowCam.getUp()); @@ -428,7 +428,7 @@ public class PssmShadowRenderer implements SceneProcessor { for (int i = 0; i < nbSplits; i++) { // update frustum points based on current camera and split - ShadowUtil.updateFrustumPoints(viewCam, splitsArray[i], splitsArray[i + 1], 1.0f, points); + ShadowUtil.updateFrustumPoints(viewCam, splitsArray[i], splitsArray[i + 1], points); //Updating shadow cam with curent split frustra ShadowUtil.updateShadowCamera(viewPort, lightReceivers, shadowCam, points, splitOccluders, shadowMapSize); diff --git a/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java b/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java index 51942cdac..7b08f04f5 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java +++ b/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java @@ -96,7 +96,6 @@ public class ShadowUtil { public static void updateFrustumPoints(Camera viewCam, float nearOverride, float farOverride, - float scale, Vector3f[] points) { Vector3f pos = viewCam.getLocation(); @@ -149,22 +148,6 @@ public class ShadowUtil { points[5].set(farCenter).addLocal(farUp).subtractLocal(farRight); points[6].set(farCenter).addLocal(farUp).addLocal(farRight); points[7].set(farCenter).subtractLocal(farUp).addLocal(farRight); - - if (scale != 1.0f) { - // find center of frustum - Vector3f center = new Vector3f(); - for (int i = 0; i < 8; i++) { - center.addLocal(points[i]); - } - center.divideLocal(8f); - - Vector3f cDir = new Vector3f(); - for (int i = 0; i < 8; i++) { - cDir.set(points[i]).subtractLocal(center); - cDir.multLocal(scale - 1.0f); - points[i].addLocal(cDir); - } - } } /** diff --git a/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowRenderer.java index e1d7db05e..d3c7fcb52 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowRenderer.java @@ -137,7 +137,7 @@ public class SpotLightShadowRenderer extends AbstractShadowRenderer { //We prevent computing the frustum points and splits with zeroed or negative near clip value float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f); - ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points); + ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, points); //shadowCam.setDirection(direction); shadowCam.setFrustumPerspective(light.getSpotOuterAngle() * FastMath.RAD_TO_DEG * 2.0f, 1, 1f, light.getSpotRange());