- Home /
Question by
minghau06 · May 27, 2016 at 07:26 AM ·
c#gameobjectrenderingmaterial
How to mask 3D game object or 2D sprite?
I want to make a game object can only visible under a limited area. Just like the Mask Component for the UI game object, but I want it can also works on other non-UI game object too. So how to make it?
masking.jpg
(79.6 kB)
Comment
Answer by tanoshimi · May 27, 2016 at 01:12 PM
Use a shader that writes to/tests the value in the stencil buffer. https://alastaira.wordpress.com/2014/12/27/using-the-stencil-buffer-in-unity-free/