[HELP] 3D model completely disappears when the camera gets close ()

My 3D model completely disappears when the camera gets close.

  • When importing my model with GLFT I had a problem where my 3D model ends up disappearing from the scene.

Example: https://viniciusfxavier.github.io/threejs/learning-2/dist/index.html
Source Code: https://github.com/ViniciusFXavier/threejs/blob/14eb9a0ae33b405bea242973bac0b53a90f749b6/learning-2/src/index.ts

const loader = new GLTFLoader().setPath('https://viniciusfxavier.github.io/threejs/learning-2/src/models/');
  loader.load('character-dummy.gltf', (gltf) => {
    const model = gltf.scene;
    scene.add(model);

    const helper = new THREE.SkeletonHelper( model );
    helper.visible = true;
    scene.add(helper);

    render();
  })

Camera settings:

camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.set(5, 5, 0);

On scroll IN:

On scroll OUT:

GIF:
ezgif-7-133f95e3a96d

You may want to disable .frustumCulled on each object in the model (loop over them using .traverse). SkinnedMesh gets culled without accounting for the effect of the bones, sometimes that can have odd effects.

7 Likes

Hello @donmccurdy thank you very much for responding,
I’ll try to do.

@donmccurdy Thank you so much, you helped too much = D

The code below works:

gltf.scene.traverse((child) => {
      if ( child.type == 'SkinnedMesh' ) {
        child.frustumCulled = false;
      }
});
3 Likes

TY!!! i was freaking out!