Search Unity

Customising the shader graph grass effect

Discussion in 'Shaders' started by unity_Se9qgx1u2EHrJA, Nov 3, 2020.

  1. unity_Se9qgx1u2EHrJA

    unity_Se9qgx1u2EHrJA

    Joined:
    Nov 1, 2020
    Posts:
    4
    So I'm obviously new and blundering around in the dark picking up bits and pieces as I go, so I hope this question at least makes sense to someone. I think I'm a lifetime away from coding a shader, but I've started playing with shader graph and have used a few shader graph grass tutorials (like this one and this one) to offset my 2d texture vertices with noise to make it look like it's swaying in the wind.

    Per the tutorial, I've used a split UV gradient on g (y?) feeding into the T of a lerp between the position and the tile/offset output - which apparently leaves the bottom of the texture in position and lets the top move around according to the noise being applied - although how this UV split into the interpolation point works across the entire gradient is still a little confusing - anyway, I just did what the tutorial said to do and everything works as it should.

    So now I'm trying to understand this by fiddling with parameters and seeing what the outcomes are, but clearly I'm not understanding this as I can't get the effect I want.

    The effect I'm aiming for is to have only the top half of my texture be affected by the noise/vertex shift, while everything from about halfway down is not.
    If I understand this correctly, the UV gradient when split out creates a fairly smooth vertical gradient which has 0 at the bottom (black) and gradually moves to 1 (white) near the top - and this leaves the bottom at 0 (black) and then affects the (2d mesh?) more as the gradient moves to 1 further up, with 1 (pure white) being the level at which the effect is applied to the max.

    In my head, it seems logical that, to get the effect I want, I need to adjust or replace the UV gradient somehow, so 0 (black) carries through from the bottom to about halfway, before grading into 1 from halfway upwards.



    ...or I need to clamp something somewhere or...I'm just clueless o_O 2 days later I've gotten some pretty interesting outcomes with fiddling, but nothing near what I'm trying to achieve.

    Kind regards,
    RT
     
    Last edited: Nov 3, 2020