I have tried numerous meshes locally, including a simple cube, but imported meshes do not seem to respect the disableColorWrite material or onBeforeRenderObservable/After for masking another mesh.
it still has the same issue - if you uncomment lines 52&53 the barrel still does not mask the sphere. trying to get the imported mesh to mask the sphere in the same manner that the wall mesh created in babylon is doing.
It is possible change the order of mesh dynamically ?
In my project, the mask mesh may created after other meshes.
And I need to mask those meshes that created after the mask mesh.