Browse Source

fixed shadow bounds calculus should be done before culling

Nicolas Cannasse 4 years ago
parent
commit
b955a000da
1 changed files with 6 additions and 5 deletions
  1. 6 5
      h3d/pass/DirShadowMap.hx

+ 6 - 5
h3d/pass/DirShadowMap.hx

@@ -188,11 +188,6 @@ class DirShadowMap extends Shadows {
 
 	override function setGlobals() {
 		super.setGlobals();
-		if( mode != Mixed || ctx.computingStatic ) {
-			lightCamera.orthoBounds.empty();
-			calcShadowBounds(lightCamera);
-			lightCamera.update();
-		}
 		cameraViewProj = getShadowProj();
 	}
 
@@ -277,6 +272,12 @@ class DirShadowMap extends Shadows {
 		if( !filterPasses(passes) )
 			return;
 
+		if( mode != Mixed || ctx.computingStatic ) {
+			lightCamera.orthoBounds.empty();
+			calcShadowBounds(lightCamera);
+			lightCamera.update();
+		}
+
 		cullPasses(passes,function(col) return col.inFrustum(lightCamera.frustum));
 
 		var texture = ctx.textures.allocTarget("dirShadowMap", size, size, false, format);