2D: Erase a part of top layer to see the background
Hi guys/gals,
Need your help… plz plz plz... I’m working on my pet project (2D game) and stuck with an issue:
I cannot remove effectively a part of sprite to show another sprite which is under. In other words, I got a background and some other pictures on top of this background. Once some object runs through these pictures (top layer sprites) it should leave trails erasing the parts of the pictures. I’d like to achieve an effect similar to layer erasing in some graphical editor (GIMP, Photoshop), so, when you apply an eraser to the top layer you can see the bottom one, something like this: I tried to change pixels, made them transparent, but it consumes enormous amount of resources and because I might have a number of such trails and they could be drawn for a while (slow object), the game becomes unplayable with this method. People on forums tell about Shaders and Masks. But I’m not sure if I could use it for such logic. I read Mask topic in unity manual: https://docs.unity3d.com/Manual/script-Mask.html , and it seems that masks aren’t applicable here… Am I wrong? if so could you please instruct me with the steps or provide a link with info how I could achieve the result. Please don’t post just a shader as people in the other topic did. I don’t understand how to apply these shaders to achieve the result I desire.
If there’re other options I’d love to hear about them.
Thank you in advance.