从谷歌块中加载一些OBJ我注意到一些面孔丢失了。我有光滑的阴影,但不能让失踪的面孔出现。想法?这是我目前的模板:
mtlLoader.load(mtlUrl, (materialLoader) => {
materialLoader.preload();
for (let material in materialLoader.materials) {
materialLoader.materials[material].side = THREE.DoubleSide;
}
let objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materialLoader);
let onSuccess = function (object) {
var mesh = object.children[0];
mesh.geometry = new THREE.Geometry().fromBufferGeometry(mesh.geometry);
mesh.geometry.computeFaceNormals();
mesh.geometry.mergeVertices();
mesh.geometry.computeVertexNormals();
mesh.geometry.center();
this.group.add(object);
};
let onProgress = function (event) {
if (event.lengthComputable) {
let percentComplete = event.loaded / event.total * 100;
let output = 'Download of Object: ' + Math.round(percentComplete) + '%';
}
};
let onError = function (event) {
let output = 'Error of type "' + event.type + '" occurred when trying to load: ' + event.src;
};
objLoader.load(objUrl, onSuccess, onProgress, onError);
});
工件:
正确:
答案 0 :(得分:1)