浏览代码

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 年之前
父节点
当前提交
62510731d3
共有 2 个文件被更改,包括 3 次插入11 次删除
  1. 1 10
      examples/js/ShaderDeferred.js
  2. 2 1
      examples/js/renderers/WebGLDeferredRenderer.js

+ 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 );