I load a gltf scene to three.js, but when i move the camera near to the object,some meshes are disappear. Left is the object when the camera takes a distance, right is when i move the camera closer

my source code for gltf loader
function LoadModel( scene ) {
var loader = new THREE.GLTFLoader();
loader.load(
"./gltf/girl.gltf",
function (gltf) {
scene.add(gltf.scene);
var hemispheric = new THREE.HemisphereLight(0xffffff, 0x222222, 1.2);
scene.add(hemispheric);
});
}
my repo https://github.com/giangm9/hacc/tree/master/src/3d
1 Like
Mess around with the clipping distance or try using an orthographic camera.
camera = new THREE.PerspectiveCamera(75, ratio, 0.1, 10000);
play around with that 0.1 and try adjusting the FOV(75)
You also might want to check if scene.frustumCulled = false
does solve the issue. Or even:
scene.traverse( function( object ) {
object.frustumCulled = false;
} );
6 Likes
Any chance some of your materials are (very slightly) transparent? This can have side effects like you describe; try this to rule that out:
scene.traverse((node) => {
if (node.isMesh) node.material.transparent = false;
});
Created an account just to say thank you.
2 Likes
Is there a way to fix this by editing the gltf file? I’m trying to use the files for AR in the Android Scene Viewer where I don’t have any control of the code.