Use a mesh to occlude part of another mesh

You can disable write color in mesh.onBeforeRenderObservable and reenable it in mesh.onAfterRenderObservable:

https://playground.babylonjs.com/#AAM6LK

It was suggested here Tweaking material in Sandbox in order to be occlusive yet invisible that a disableColorWrite property could be created for this, but I don’t think it has been done yet.

2 Likes