我正在尝试在挤压形状的正面和背面应用不同的材料,但不知道在哪里放置side: THREE.FrontSide
和side: THREE.BackSide
。它们应该放在哪里?
我的相关代码部分是:
var materialFront = new THREE.MeshPhongMaterial({环境:0xffffff,地图:frontTexture}); var materialSide = new THREE.MeshPhongMaterial({color: 0xE68A00,ambient: 0xffffff}); 变种挤压设置 = { 数量:10, bevelEnabled:假, 斜面厚度:0.2, 斜角尺寸:0.2, bevelSegments: 8, 材料:0, 挤出材料:1 }; var geometry = new THREE.ExtrudeGeometry(形状,extrusionSettings); var 材料 = [materialFront, materialSide]; var material = new THREE.MeshFaceMaterial(materials); 网格=新的三。网格(几何,材料);
更新:根据 WestLangley 的评论,我成功地将不同的纹理添加到背面:
// ... var 材料 = [materialFront, materialSide,materialBack]; // ... for ( var face in mesh.geometry.faces ) { if (mesh.geometry.faces[ face ].normal.z == 1) mesh.geometry.faces[ face ].materialIndex = 2; }