Search Unity

Question Move grass shader

Discussion in 'Shader Graph' started by Rachan, Mar 21, 2023.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    781
    Hi there!

    I working on Shader Graph for 2D sprite
    and I found the problem, about how to moving a grass similar to hit the wind
    Now it almost success,

    But it always move the whole plane, even in my Shader Graph preview is move only upper position.

    like this

    now it as a red arrow, move up and bottom also.
    But I actually want it move like green arrow only move at upper position

    here is my Shader graph


    anyone has any suggestion?

    Thanks!!!
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    You need to fix movement with some mask, for example it can be texture mask, UV or vertex color. The idea is you need gradient (0-1) to determine how much vertex can move and in your case the easy fix is probably just multiply your displacement with
    UV.y
    (it's black on the bottom and white on the top).