How to optimize the invisible Mesh

I have a similar problem with ranwei-001
I have made a github page here to express the problem:
There is a Mesh named ‘mesh_mask’ in the scene,behind it are thousands of Meshes(imagine that they are all different).When the camera stand before the mask and the mask cover the meshes the FPS is single figures,it is the same as the mask don’t cover the Meshes.I wonder is there a method to reduce the cost when the meshes are covered?
Secondly,I set the meshes renderingGroupId to 0 to make it invisible,but the FPS
don’t change.Is the renderingGroupId have no Influence on the cost?
Thirdly,I set the isVisible of the meshes to false,the FPS rise to around 40,but still lower than only one mask in the scene. Since the meshes are invisble,what makes the performance cost?

You could try occulsion queries.

Thank you for your reply.
I tried the example of occlusionQuery.But on my computer the scene.clearColor is always blue except the first frame.
May be the occlusionQuery is only supported by the ES3 and WebGL2?Since my computer is an outdated notebook,it can only work on WebGL1.

Yes this is a webgl2 only feature :frowning: