Question About Occlusion rendering performance

Hello, I currently have a project. There is a substation (glb file) in the scene. There are many and complex electrical equipment models inside, which greatly affects the rendering performance and results in a low frame rate. Therefore, I want to implement a function, which is to prohibit rendering of occluded device models and set them to hidden. On the contrary, when the device is seen, it will be rendered and displayed. Is there any good way? I tried to traverse the model in the scene, let model.occlusionType = BABYLON.AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC, when model.isOccluded, I let model.isVisible = false; the performance is indeed greatly improved, and the number of frames is also greatly improved, but once After setting it to hidden, it can no longer be detected whether these models are blocked, so they can no longer be displayed. Is there any good way to solve this problem?Any insights or suggestions would be greatly appreciated. Thanks!
PG URL:

Occlusion Query Sample | Babylon.js Playground (babylonjs.com)
I’ve made changes to the demo so that occlusion is only recalculated when the camera view matrix changes.
However, this should result in a reduced frame rate when the camera moves, and can be avoided by adding stabilization to recalculate when the camera movement stops, which will also result in the mesh that should be seen during the movement not being seen.
Or is there a more perfect way to do it I don’t know?

Scene rendering performance optimization plugin based on instance object - Demos and projects - Babylon.js (babylonjs.com)
Finally, here’s a one: an instancedMesh rendering optimization plugin for complex models with a lot of duplicate objects. Hope it helps.

You should not modify the isVisible flag. The system won’t render objects that are hidden after an occlusion query has been performed. You just have to enable occlusion queries on “heavy” mesh and it should just work.