#Detect outside Edges with ShaderGraph
1 messages · Page 1 of 1 (latest)
A material shader can only render in the bounds of the mesh/triangles, it can't render outside of them.
Post processing/full screen shaders can render wherever, but you need to be able to detect where to render with some kind of mask or something.
So you either need to render the object twice(once with a bigger scale or stretching the vertices in the vertex shader), or create a custom post processing effect.
Basically, outlines are quite a complicated topic. Research it online for more details.
Oh okay. Well I meant like detect the edges, but paint inside the object itself
like I do not want to extend the mesh, I only need to make it so when a pixel of the mesh is close to the edge, its alpha drops
Ah, yes. Again, look up at outline implementations, as edge detection is a core aspect of it.
the outline implementations I've found just move the vertex along the normal, or detect all edges of the object, including the ones that are inside the object, which I don't want
but I'll search more and see if there's some tutorials that make it with only the outside edges
thanks
A mask way might be what you need then. Render the object in 2 passes. One into a mask or stencil buffer, the second one normally, read the mask/stencil in the current pixel and pixels around it(up to the radius of the fade). If a sample ends up outside the mask, the you're in the fade zone, make the pixel transparent based on the distance to that edge and max fade radius.
https://roystan.net/articles/outline-shader/
These methods do not move vertices at all