Gradient on mesh (plane) from edge in a given direction

Im looking to mask a mesh plane based on an input vector direction. I want the gradient to begin at the edge of the mesh and fade across/inward. See examples.


Is this possible with some UV trick? e.g. like a linear gradient but originating from the edge of the mesh

I’ve also been attempting this with ‘DistanceToNearestSurface’ and then doing some math, but the issue with that is it accounts for the Z direction - whereas I only want to know distance to nearest surface in the XY. Is there as such a thing as ‘2D distance to nearest surface’?

You could do worse than checking this out

Thanks Clockwork, I’ve seen a lot of that material and looked into it. The difference is that I’m looking to do more of and edge mask or nearest surface mask (in the XY only).
An object bounds gradient like that video originates from the bounds box edge as opposed to the actual mesh edge.
On my examples, in the lower part, the mask starts over again based on the nearest surface in that given direction.

1 Like