How to make a transparent texture that filters out certain objects?
I'm making an AR app that can put an overlay over certain objects (e.g. my desk). This overlay should be transparent so it doesn't completely block out the view of the actual furniture.
But the overlay also contains parts that you shouldn't be able to see from certain perspectives. For example: If you look at a table, you can see 2 or 3 tablelegs (given that you're taller than the table of course). But since the overlay would have 4 legs, you could see this fourth leg through the table.
This problem could be fixed if the texture of the overlay would be transparent, but would filter out certain objects with a specific name or tag or whatever. So, essentially, it is transparent, but after the camera has spotted the first object with this texture, it doesn't look for any object with this texture behind it, or doesn't render it.
I cannot simply not show entire objects, but I want just the part that is behind another mesh to be invisible. If a certain mesh is partially behind another, I still want to see the part that isn't behind the other texture.
I'm not very experienced with shaders or texturing, so any help would be appreciated!