浏览代码

deal with @WestLangley's issues #1, #2, #3, #4 from here: https://github.com/mrdoob/three.js/pull/5809#issuecomment-68329651

Ben Houston 10 年之前
父节点
当前提交
2dc5d1e71e
共有 3 个文件被更改,包括 6 次插入6 次删除
  1. 2 2
      examples/js/ShaderSkin.js
  2. 2 2
      examples/js/ShaderTerrain.js
  3. 2 2
      examples/js/shaders/NormalDisplacementShader.js

+ 2 - 2
examples/js/ShaderSkin.js

@@ -293,7 +293,7 @@ THREE.ShaderSkin = {
 					"totalLight += hemiTotal;",
 					"totalLight += hemiTotal;",
 				"#endif",
 				"#endif",
 
 
-				"gl_FragColor.xyz = gl_FragColor.xyz * ( totalLight + ambientLightColor ) + specularTotal;",
+				"gl_FragColor.xyz = gl_FragColor.xyz * ( totalLight + ambientLightColor * diffuse ) + specularTotal;",
 
 
 				THREE.ShaderChunk[ "shadowmap_fragment" ],
 				THREE.ShaderChunk[ "shadowmap_fragment" ],
 				THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
 				THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
@@ -591,7 +591,7 @@ THREE.ShaderSkin = {
 
 
 					"gl_FragColor.xyz *= pow( colDiffuse.xyz, vec3( 0.5 ) );",
 					"gl_FragColor.xyz *= pow( colDiffuse.xyz, vec3( 0.5 ) );",
 
 
-					"gl_FragColor.xyz += ambientLightColor * colDiffuse.xyz + specularTotal;",
+					"gl_FragColor.xyz += ambientLightColor * diffuse * colDiffuse.xyz + specularTotal;",
 
 
 					"#ifndef VERSION1",
 					"#ifndef VERSION1",
 
 

+ 2 - 2
examples/js/ShaderTerrain.js

@@ -286,8 +286,8 @@ THREE.ShaderTerrain = {
 
 
 				"#endif",
 				"#endif",
 
 
-				//"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor) + totalSpecular;",
-				"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor + totalSpecular );",
+				//"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * diffuse ) + totalSpecular;",
+				"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * diffuse + totalSpecular );",
 
 
 				THREE.ShaderChunk[ "shadowmap_fragment" ],
 				THREE.ShaderChunk[ "shadowmap_fragment" ],
 				THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
 				THREE.ShaderChunk[ "linear_to_gamma_fragment" ],

+ 2 - 2
examples/js/shaders/NormalDisplacementShader.js

@@ -428,11 +428,11 @@ THREE.NormalDisplacementShader = {
 
 
 		"	#ifdef METAL",
 		"	#ifdef METAL",
 
 
-		"		gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor + totalSpecular );",
+		"		gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * diffuse + totalSpecular );",
 
 
 		"	#else",
 		"	#else",
 
 
-		"		gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor ) + totalSpecular;",
+		"		gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * diffuse ) + totalSpecular;",
 
 
 		"	#endif",
 		"	#endif",