Download

Material that makes objects invisible?

Hi all,
I wish to create a material that basically hides a part an object that is inside the “hider” mesh (the mesh this material is applied to) by making it invisible.
By this I mean for example I have a tree and I wish to make a portion of its trunk invisible so the lower part is fine, there is a gap, just like in the noob image I quickly created.
http://i1268.photobucket.com/albums/jj563/agiro8747/invisible_zpsu2gxjid3.jpg

what you can do is rendering your occluded geometry in an other pass, turn on the custom stencil for it, and in you tree material, just add the stencil as an opacity or transparency map

Thanks for the update. It sounds like this takes up quite a lot of processing power, doesn’t it? If so, as this game is for mobile platforms, I rather avoid this transparent stuff and find another solution for it.

You can’t do it the way you described I’m afraid, materials just don’t work that way. The easiest method would be to write data to a texture that you pass into the Material of the tree, and use it as a mask for Opacity or Opacity Mask. I’d recommend using Opacity Mask if you want to do this on a lot of objects and to improve lighting / sorting.

Alternatively, you can create the ‘shape’ of the mask in World-Space in the material, and use that as a mask too. If you’re only using boxes or spheres that should be easy to achieve.