當我嘗試使用線框查看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