Hello, hope you are having a great day!
I loaded an object file (glb), but it looks strange.
Could you anyone help me please?
Thank you in advance.
Hello, hope you are having a great day!
I loaded an object file (glb), but it looks strange.
Could you anyone help me please?
Thank you in advance.
My guess is the normals are backwards for the face
@anidivr thank you for your answer.
So is it the problem with the model file? How can I fix it in Three.js?
Its usually a problem with the model file. To confirm, try the following to recompute the normals. If this doesn’t help, it must be something else.
geometry.deleteAttribute("normal");
geometry=BufferGeometryUtils.mergeVertices(geometry);
geometry.computeVertexNormals();
I tried but the same issue.
I fixed this issue by creating a new material using its current texture.
gltf.scene.traverse((child) => {
if (child.isMesh) {
child.material = new THREE.MeshPhongMaterial({
map: child.material.map,
});
}
});
But still don’t understand what was wrong with its original material.