Please check the PG
How to reproduce:
- Create some mesh
- Apply a clip plane to it (via
onBeforeRenderObservable
/onAfterRenderObservable
) - Create a clone of this mesh (by default it would share the material with the source mesh)
- Apply another clip plane to it
For some reason, the source mesh clip plane also affects the cloned mesh, while the clip plane of the cloned mesh doesn’t seem to take effect at all.
Clip planes begin to work correctly when some other mesh is created before cloning the source mesh. In the PG this can be viewed by zooming camera in and out: when third sphere comes into view, both clip planes work as expected.
I guess this bug only appears when two meshes which share the same material are being rendered subsequently (thus the clip plane gets “cached” somewhere), but that’s just a guess.
P.S. Can also be reproduced with BJS 4.2.1.