2
0
Эх сурвалжийг харах

WebGLDeferredRenderer: updated DirectionalLights handling.

Full-screen light proxies need to turn off depth testing. Instead stencil buffer now takes care of not touching background pixels.

Also matched specular term compositing to point lights.
alteredq 12 жил өмнө
parent
commit
62510731d3

+ 1 - 10
examples/js/ShaderDeferred.js

@@ -543,16 +543,7 @@ THREE.ShaderDeferred = {
 				// combine
 
 				"vec3 light = lightIntensity * lightColor;",
-
-				"#ifdef ADDITIVE_SPECULAR",
-
-					"gl_FragColor = vec4( albedo * light * diffuse, 1.0 ) + vec4( light * specular, 1.0 );",
-
-				"#else",
-
-					"gl_FragColor = vec4( albedo * light * ( diffuse + specular ), 1.0 );",
-
-				"#endif",
+				"gl_FragColor = vec4( albedo * light * diffuse, 1.0 ) + vec4( light * specular, 1.0 );",
 
 			"}"
 

+ 2 - 1
examples/js/renderers/WebGLDeferredRenderer.js

@@ -348,6 +348,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 
 			blending:		THREE.AdditiveBlending,
 			depthWrite:		false,
+			depthTest:		false,
 			transparent:	true
 
 		} );
@@ -593,7 +594,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 		}
 
 		// still no touching shared depth buffer
-		// (write light proxy color pixel if in front of scene pixel)
+		// (write light proxy color pixel if behind scene pixel)
 
 		gl.depthFunc( gl.GEQUAL );