How do i hide objects behind invisible objects?

I’m making an application for the google tango with my team. We have successfully created a mesh builder that builds mesh as you scan a room. Our goal is to create an app where the mesh created by the mesh builder is not visible, but the objects in our scene should not be visible behind this (invisible) mesh. I have tried using this following depth buffer on the mesh but it didn’t work for me: http://wiki.unity3d.com/index.php?title=DepthMask .

alt text

In the example above the cube represents the mesh (which isn’t supposed to be visible) and the sphere represents an object in our scene. What you should see in this situation is NO cube, and only the left half of the sphere. How do i get it to work like that?

This looks like a problem that you’d need to use shaders to solve. Maybe in the background behind the object you want to make partially invisible, you put a plane that gets a grabpass, then use a shader on the invisiblifier object that uses that earlier pass? There might be a more efficient way of doing it, but that’s what comes to mind right now