Having just started with three.js, I encountered an issue. I created a 3D scan of my face and ended up with only an .obj file. When I view this file in Meshlab, the model appears textured. However, when I load it into three.js, the texture is missing.
// Loader
const loader = new OBJLoader();
loader.load( './models/scene.obj',
function ( OBJ ) {
var boundingBox = new THREE.Box3().setFromObject( OBJ );
boundingBox.getCenter( OBJ.position ).negate();
scene.add( OBJ );
},
function ( xhr ) {
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
},
function ( error ) {
console.log( 'An error happened' );
}
);
Here is how my 3D model appears in three.js
It also seems to be one-sided from the wrong perspective.
I attempted a different solution, but unfortunately, I receive an "An error happened" message without further explanation.
objLoader.load('assets/faceimage9.obj', function(object) {
scene.add(object);
object.traverse(node => {
if (node.material) {
node.material.vertexColors = true;
}
});
});
Thank you for any insights or solutions provided!
Edit: Initially, my .obj file contains approximately ~50000 lines https://i.sstatic.net/1H7rD.png, and then transforms into this appearance https://i.sstatic.net/N0eCI.png