瀏覽代碼

improved lights culling

ncannasse 7 年之前
父節點
當前提交
94936183bc
共有 1 個文件被更改,包括 7 次插入1 次删除
  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;