浏览代码

replicate previous phong metal look -- it still isn't correct but at least it roughly matches previous look.

Ben Houston 10 年之前
父节点
当前提交
f15ae3a87b
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 4 4
      examples/webgl_materials2.html
  2. 1 1
      src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl

+ 4 - 4
examples/webgl_materials2.html

@@ -69,10 +69,10 @@
 
 				shininess = 15;
 
-				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x666666, ambient: 0x000000, specular: 0xffaa00, shininess: shininess, metal: true, shading: shading } ) );
-				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x666666, ambient: 0x000000, specular: 0xaaff00, shininess: shininess, metal: true, shading: shading } ) );
-				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x666666, ambient: 0x000000, specular: 0x00ffaa, shininess: shininess, metal: true, shading: shading } ) );
-				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x666666, ambient: 0x000000, specular: 0x00aaff, shininess: shininess, metal: true, shading: shading } ) );
+				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x000000, ambient: 0x000000, specular: 0xffaa00, shininess: shininess, metal: true, shading: shading } ) );
+				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x000000, ambient: 0x000000, specular: 0xaaff00, shininess: shininess, metal: true, shading: shading } ) );
+				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x000000, ambient: 0x000000, specular: 0x00ffaa, shininess: shininess, metal: true, shading: shading } ) );
+				materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, bumpMap: imgTexture2, bumpScale: bumpScale, color: 0x000000, ambient: 0x000000, specular: 0x00aaff, shininess: shininess, metal: true, shading: shading } ) );
 
 				// Spheres geometry
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl

@@ -229,7 +229,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
 
 #ifdef METAL
 
-	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor * ambient + totalSpecularLight ) + emissive;
+	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor * ambient ) * specular + totalSpecularLight + emissive;
 
 #else