1
從Google塊中加載一些OBJ我注意到有幾個面遺失。我有平滑的陰影,但不能讓失蹤的臉出現。想法?這是我當前模板:三塊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);
});
工件:
正確:
https://stackoverflow.com/questions/42729926/missing-object-faces-on-both-obj-and-json-formats-three-js – codeisforeva
出現與三角的問題。不知道如何傳遞參數來三角化OBJ。 – codeisforeva