Only render mesh over other mesh
Heyho there friends.
So heres my situation.
Im making a 2D games, which out of various reasons uses 2D meshes instead of sprites. I use them to make polygons.
Now lets say I have these 2 polygons:
Basically what I want to achieve is that only the the part of the red pentagon that is OVER the yellow rectangle gets rendered. So like this:
Until now I did this by calculating the union of both meshes and then changing them accordingly. But this is not only prone to errors but also sometimes performance heavy.
There must be a more elegant way. You know of any? I assume there is a shader or something that will do this with ease, right?
Thanks in advance guys. :D
Answer by ComradeVanti · Sep 05, 2017 at 03:23 PM
Found it myself. The solution is called "Stencil Buffers". If you have the same problem, do some research on them and you will have a working shader in no time :)
Your answer
Follow this Question
Related Questions
Vertex Lit Transparent Shader problem with Z 0 Answers
Small bug? on ShaderGraph 0 Answers
Blending tiles with larger textures 0 Answers
ShaderGraph Multiple RenderTargets 0 Answers
Equivalent of blender holdout shader? 0 Answers