- Home /
Make object invisible gradually
Hi guys, I´m trying to do something like Portal, but not the two way. just one portal, and what pass through it disapear, like going to another dimention. if i´m not clear, a good exemple is the videoclip Gnarls Barkley - Going On (Official) http://www.youtube.com/watch?v=ENE1eWtW7e8 (2:28). Thanks for the help.
Answer by aldonaletto · Sep 15, 2013 at 04:09 AM
Is your game 2D? In the linked video, the portal is seen from its side, and people entering it from the left don't appear on the right side:
A simple way to achieve this effect is by using a depth mask on the right side: the depth mask is an object rendered with a special shader that doesn't render a single pixel, just sets the depth buffer as if it was actually rendered - this obscures anything that passes behind the mask. You must set the rendering order so that the mask is rendered after the background and before the "obscureable" objects. Take a look at this question, where the shader and the code that sets the rendering order are posted.