Part of 3D model hides in 8thWall

When I test my 3d model in https://gltf-viewer.donmccurdy.com/ I find no issues but within 8thwall (aframe) the part of the 3d model seems to hide or disappear abruptly. Can anyone tell me the cause of it?

Link to recorded video
8thWall
GLTF Viewer

To fix this please add this code to your app.js

AFRAME.registerComponent('no-cull', {
  init() {
    this.el.addEventListener('model-loaded', () => {
      this.el.object3D.traverse(obj => obj.frustumCulled = false)
    })
  },
})

then add it to the entity that is clipping

1 Like

you can reference it in the sample project here:

The camera in your case is culling your 3D model.

Hiya Vaibhav,

The model is getting culled out of the view - it’s a common issue with models animated using skinning ( the bounding box that gets used for culling the model doesn’t always match up with the visual version )

Paste this code into no-cull.js

const noCullComponent = {
  init() {
    this.el.addEventListener('model-loaded', () => {
      this.el.object3D.traverse(
        (obj) => {
          if(obj.isSkinnedMesh)
          {
            obj.frustumCulled = false
          }
        }
      )
    })
  },
}

export {noCullComponent}

In app.js, add these lines to register the component…

import {noCullComponent} from './no-cull'
AFRAME.registerComponent('no-cull', noCullComponent)

Then, add no-cull to the <a-entity that references the skinned character, and it won’t be culled by the camera / disappear.

eg

<a-entity
      id="main-character"
      gltf-model="#main-character-src"
      no-cull
      >
    </a-entity>  
2 Likes

@Ian it looks like we were both answering that at the same time, you beat me by a minute :slight_smile:

2 Likes

Apologies for the late reply. Thanks, @Ian & @Mal_Duffin for the help your solutions worked perfectly.

1 Like