Преглед изворни кода

WebGLDeferredRenderer: flipped light proxies faces orientation and depth test.

It makes lights work when the camera is inside the light volume and somehow it's also 10% faster.

You just need to make sure camera far plane is far enough to encompass the whole light proxy, otherwise there are not lit slices of proxy sphere.

(I don't really understand why flipping the depth test works, originally depth test was supposed to be just disabled)

See #2624
alteredq пре 12 година
родитељ
комит
3b5d1719b2
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5 5
      examples/js/renderers/WebGLDeferredRenderer.js

+ 5 - 5
examples/js/renderers/WebGLDeferredRenderer.js

@@ -253,7 +253,9 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 
 
 			blending:		THREE.AdditiveBlending,
 			blending:		THREE.AdditiveBlending,
 			depthWrite:		false,
 			depthWrite:		false,
-			transparent:	true
+			transparent:	true,
+
+			side: THREE.BackSide
 
 
 		} );
 		} );
 
 
@@ -294,9 +296,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 
 
 			blending:		THREE.AdditiveBlending,
 			blending:		THREE.AdditiveBlending,
 			depthWrite:		false,
 			depthWrite:		false,
-			transparent:	true,
-
-			//side: THREE.BackSide
+			transparent:	true
 
 
 		} );
 		} );
 
 
@@ -535,7 +535,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 		// still no touching shared depth buffer
 		// still no touching shared depth buffer
 		// (write light proxy color pixel if in front of scene pixel)
 		// (write light proxy color pixel if in front of scene pixel)
 
 
-		gl.depthFunc( gl.LEQUAL );
+		gl.depthFunc( gl.GEQUAL );
 
 
 		compLight.render();
 		compLight.render();