I’m quite proud of this so I had to share it. I found some amazing grass but it didn’t suit my rugged terrain very well as the patches were quite large, leaving the edges often floating in the air. I’ve managed to use distance fields to warp the grass so that it conforms to the terrain.
The biggest issue is that I wanted to transform a world coordinate into object space to work out if I was manipulating the bottom of the grass rather than the top. This didn’t work out so well as apparently the transform node in materials doesn’t handle rotation so I couldn’t get an instance-aligned gradient. In the end I used the UV coords which unfortunately means each member of an atlas needs extra work and its own material instance.
Here’s the material:
This video has the results of the lerp mask as an emissive channel, so you can get an idea of where that mask should sit: