Procházet zdrojové kódy

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 před 13 roky
rodič
revize
62510731d3

+ 1 - 10
examples/js/ShaderDeferred.js

@@ -543,16 +543,7 @@ THREE.ShaderDeferred = {
 				// combine
 				// combine
 
 
 				"vec3 light = lightIntensity * lightColor;",
 				"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,
 			blending:		THREE.AdditiveBlending,
 			depthWrite:		false,
 			depthWrite:		false,
+			depthTest:		false,
 			transparent:	true
 			transparent:	true
 
 
 		} );
 		} );
@@ -593,7 +594,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 behind scene pixel)
 
 
 		gl.depthFunc( gl.GEQUAL );
 		gl.depthFunc( gl.GEQUAL );
 
 

粤ICP备19079148号