Remove Mesh from WaterMaterial and MirrorTexture?

How can I remove a mesh from the WaterMaterial and MirrorTexture after it has been added?
I’m trying to optimize and remove some reflective meshes if targetFPS is not reached.
But I can’t make it work. Any help?


For the water case, you can do it by accessing the renderList property of the reflection / refraction textures:

However, having a method to do it would be better, so here’s a PR that adds a removeFromRenderList method:

Regarding the mirror texture case, it’s a closure problem: because mirrorMaterial is declared as a var, the 4 setTimeout calls will only operate on the last value of mirrorMaterial. Use a let instead:

1 Like

You’re a legend. Many thanks!