PSSM : fixed wrong shadows when frustum near clip is 0 or negative (parallel projection issue)
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8246 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
0775b93088
commit
6ed981db10
@ -330,23 +330,18 @@ public class PssmShadowRenderer implements SceneProcessor {
|
||||
float zFar = zFarOverride;
|
||||
if (zFar == 0) {
|
||||
zFar = viewCam.getFrustumFar();
|
||||
// zFar = PssmShadowUtil.computeZFar(occluders, receivers, viewCam);
|
||||
}
|
||||
// System.out.println("Zfar : "+zFar);
|
||||
ShadowUtil.updateFrustumPoints(viewCam, viewCam.getFrustumNear(), zFar, 1.0f, points);
|
||||
|
||||
// Vector3f frustaCenter = new Vector3f();
|
||||
// for (Vector3f point : points) {
|
||||
// frustaCenter.addLocal(point);
|
||||
// }
|
||||
// frustaCenter.multLocal(1f / 8f);
|
||||
//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);
|
||||
|
||||
//shadowCam.setDirection(direction);
|
||||
shadowCam.getRotation().lookAt(direction, shadowCam.getUp());
|
||||
shadowCam.update();
|
||||
shadowCam.updateViewProjection();
|
||||
|
||||
PssmShadowUtil.updateFrustumSplits(splitsArray, viewCam.getFrustumNear(), zFar, lambda);
|
||||
PssmShadowUtil.updateFrustumSplits(splitsArray, frustumNear, zFar, lambda);
|
||||
|
||||
|
||||
switch (splitsArray.length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user