Have one object Matte another object

Hello. I’ve got a really basic scene from blender I am trying to test. I have a shape and then a cube that animates. The cube is ontop of the shape and then the cube animates above the shape. I would like to ‘reveal’ the shape by using the cube as a matte. I want the cube to be totally hidden. Is this possible in babylon? I’ve been searching the tools and the options in the sandbox but haven’t been able to figure this one out on my own yet.

Hey and welcome!
I’m not sure I get what you ned with the matte. Do you want it to block the sphere BUT not be displayed?

You can do that with material.disableColorWrite = true

Yes! I want the cube to be not camera visible but to still block out part/all of the ‘sphere’ whenever it is on top of it. Thank you. Where would I put this information?

on your cube.material.disableColorWrite property

Is this correct? I can still see the cube but I’m not sure if what I am looking at is the final output?

Maybe you could repro in the Playground so we can see what is going on?

I’m looking into how to create a scene in the Playground but so far all I can do is make a cube into a cylinder. Here is the scene I was working off of and putting into the Sandbox, though: Treehiddentest_v005.glb - Google Drive

well the cube and cylinder will work. We can check from there
Also doc that can help:

I’m able to get this working with meshes created in babylon, but cannot get an imported mesh to do the same. I’ve put a playground up here:

uncomment lines 52&53
or 56&57
to view behavior

That is cool you have the first part working. If I am reading this correctly you are creating this effect with the material on lines 18-20?

yes - other method is to use onBefore&After render on 56&57 (older way before disableColorWrite) - still unable to get the loaded mesh to work however:(

Moved importing mesh issue to a new topic: