- Home /
Masking with Mesh Renderer (2d)
I would love to be able to have specific objects (with mesh renderes) to draw only inside a sprite mask. It's very much the same thing that the current Sprite Mask is already doing, although it would also work when applied to mesh renderers.
I'm not looking for a shader with a mask texture, but a sprite in the scene that can be used as the mask. It doesn't have to work exactly like Unity's Sprite Mask, as long as the above can be achieved.
I assume this is likely straightforward, but I'm inexperienced with shaders and lots of googling hasn't brought up anything useful.
Answer by Adam470 · Jun 24, 2021 at 01:47 PM
Create a render target the same size as the image that will be partially erased (should be transparent). I'll call this render target brush.
Render the polygon, offset relative to the image's origin and size, in white to brush, here shown with checkers and border to indicate transparent section.
Thanks for trying to help, Adam, although I'm more confused than anything. Not sure I fully understand what you want me to do. I also think you meant to link to something or attach an image, but nothing's showing up.