当我尝试使用线框查看meshFongmaterial到arrayBufferGeometry(其中vetexColors设置为THREE.vertexColors;照明仅适用于1张随机面部。当我切换到MeshBasicmaterial时,我得到了期望的行为。随着线框设置为false海防材料看起来不错,被亮了起来:Three.js MeshPhongMaterial线框照明
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3));
geometry.computeFaceNormals();
geometry.computeVertexNormals();
console.log(geometry);
var material = new THREE.MeshBasicMaterial({
side: THREE.DoubleSide,
wireframe: true,
transparent: false,
vertexColors: THREE.VertexColors, // CHANGED
shininess: 100,
// color: 0xff0000,
shading: THREE.SmoothShading
});
console.log(material);
var terrainMesh = new THREE.Mesh(geometry, material);
terrainMesh.name = 'GRD';
terrainMesh.receiveShadow = true;
terrainMesh.castShadow = true;
console.log(terrainMesh);
return terrainMesh;
我需要的材料后重新计算顶点法线?是否有一个原因,为什么照明适用于坚实的面孔而不是线框?
您使用的是什么样的灯?我只是用'THREE.PointLight'和'THREE.MeshPhongMaterial'来试用它,它的参数和你使用的参数相同,并且它的工作方式和我一样。 – TheJim01