Explorar el Código

Simplified a bit light pass shader in deferred examples.

alteredq hace 12 años
padre
commit
bd42fea8b8
Se han modificado 1 ficheros con 3 adiciones y 5 borrados
  1. 3 5
      examples/js/ShaderDeferred.js

+ 3 - 5
examples/js/ShaderDeferred.js

@@ -493,17 +493,15 @@ THREE.ShaderDeferred = {
 
 				// combine
 
-				"vec4 color = vec4( 0.0 );",
-				"color.xyz = albedo.xyz * lightColor * lightIntensity;",
-				"color.w = attenuation;",
+				"vec3 light = lightIntensity * lightColor;",
 
 				"#ifdef ADDITIVE_SPECULAR",
 
-					"gl_FragColor = color * vec4( diffuse, 1.0 ) + vec4( lightColor * lightIntensity * specular, attenuation );",
+					"gl_FragColor = vec4( albedo * light * diffuse, attenuation ) + vec4( light * specular, attenuation );",
 
 				"#else",
 
-					"gl_FragColor = color * vec4( diffuse + specular, 1.0 );",
+					"gl_FragColor = vec4( albedo * light * ( diffuse + specular ), attenuation );",
 
 				"#endif",