Announcement

Collapse
No announcement yet.

Landscape-conformity for large grass patches

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Landscape-conformity for large grass patches

    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.

    https://imgsli.com/MTQzNw

    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:

    Last edited by Antidamage; 05-16-2018, 11:13 AM.

    #2
    Typically, you can use one of vertex color channels to define top-bottom gradient on on the grass.

    TransformVector and TransformPosition material expressions work fine with instanced static meshes in vertex shader, hence you need to pass them through vertex intepolator material expression.

    Comment


      #3
      I had no idea VertexInterpolator existed. Thank you!

      And less than a minute later I realise only the debug output was failing to transform correctly.
      Last edited by Antidamage; 05-16-2018, 11:25 AM.

      Comment

      Working...
      X