[Solved] InstancedMesh dissapeared because of frustum

Hello,

Is there something mystery with InstancedMesh? It’s working perfect until it went to disappeared when camera position at -100 and 300 neither x, or z. Feel like weird there.

I’m using React Three Fiber (r3f), tried both hooks from drei and r3f but still the same. I was think maybe wrong with camera or gl settings, but when I try with normal, non-instanced mesh and it’s not disappeared no matter how far camera goes.

I wonder there is a bug or because I missing something? Please point me out!

For declare that everything is ok, instanced work but only follow camera until that position.

  1. Make an instances
  2. Position equals to camera positions in x, z.
  3. Everything ok until camera go to -100 and 300 in worldspace and all instanced disappeared
  • Mesh will not disappeared if it’s NOT an instanced mesh
  • Using MapControls
  • Instanced Mesh will appear again at current positions when hook have a hot reload but will disappear again when go over that range again

It’s being frustum culled probably? Try setting frustumCulled prop on instanced mesh element to false

3 Likes

Yes, thank you very much @bhushan6. That’s frustumCulled problems, silly me. But instead setting frustumCulled to true can be performance impact. We just need to update bounding of instanced. If not for your help I think it’s hard for me to find out about frustumCulled problem. Thanks

1 Like

Thanks! I also encountered this problem