Hi Uniters,
Right now I’m playing a lot with new UI System that is great, I wonder if it’s possible to achieve this kind of culling mask :
The black circle to act like a mask inside white image, showing stuff behind it…any ideas ?! Thanks in advance!
Hey There,
The good news is that this can be done, the bad news is that you will have to dive into Unity’s shaders to get the result you are looking for. The basic concept is that behind the scenes (or somewhat behind the scenes) Unity is using the Stencil buffer to clip your images. The value it puts in the stencil buffer is based on how many masks deep the current image is (there is also an open bug for this when you hit 3 masks things get weird).
If you don’t know what a stencil buffer is (or shaders in general) I suggest you start reading some tutorials. I find looking at the shaders that Unity has written can provide some great insight.
If you want to stay away from shaders you could also do some tricks with a second camera and a render texture but this would not be ideal.
Regards,