Hide parts of a mesh that are behind itself
Hey everyone! First of all, I'm very new to shaders, unity and game development in general. And I ran into a problem that i've been struggling to solve for two days now.
I'm using the shader graph tool to make a texture imitating the vaporwave visual style. So far, my project looks like this:
The problem I'm having is with the fact that the terrain mesh can be seen behind its own polygons, and I would like to hide that somehow, so the mesh doesn't look transparent, when in fact, it is. The parts I'm talking about can be seen on the right-upper corner of the image.
I achieved this fog-like effect by making the alpha value of the texture be based on the Z position of the vertex (using that position node). And it is there to hide the terrain being generated behind it. I am aware of the fog option in Window > Rendering > Lighting Setting, However, I plan on adding a skybox texture later, and from what I've tested, the fog option doesn't work really well with skyboxes, only with solid colors for the background.
Essentially What I'm asking is if there is a way to do the following with the shader graph tool:
Where the green lines are rendered normally, and the red line is not rendered, or is completely transparent, or hidden somehow, even though the green faces are transparent.
Thank you for reading!