I have a 2D texture in front of my camera and I want to be able to make it transparent around where I’ve clicked it (as if we would “wipe” the screen).
I have managed to get it working by getting a square in which I check each pixel color and apply alpha depending on th distance to the center (the pixel I touched). However this is way too slow and I encountered huge frame drops (my game is targetting iOS devices).
I also tried by using Graphics.DrawTexture but couldn’t manage to draw a circle, only a square.
I think some shader can solve my problem but I am not confident on how to write one.
I tried the shader given in that post
My problem is very similar excepted that I want the “see-through” to be persistent.
Okay:
I remember, I read and heard about something, called stencil shaders
or stencil buffer shaders. I could be wrong here, but maybe that might work.
So feel free to check it out.