Parcourir la source

improved lights culling

ncannasse il y a 7 ans
Parent
commit
94936183bc
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      h3d/scene/pbr/Renderer.hx

+ 7 - 1
h3d/scene/pbr/Renderer.hx

@@ -58,7 +58,13 @@ class Renderer extends h3d.scene.Renderer {
 			pbrLightPass.addShader(pbrDirect);
 			pbrLightPass.addShader(pbrProps);
 			pbrLightPass.blend(One, One);
-			pbrLightPass.depthWrite = false;
+			/*
+				This allows to discard light pixels when there is nothing
+				between light volume and camera. Also prevents light shape
+				to be discarded when the camera is inside its volume.
+			*/
+			pbrLightPass.culling = Front;
+			pbrLightPass.depth(false, Greater);
 			pbrLightPass.enableLights = true;
 		}
 		ctx.pbrLightPass = pbrLightPass;