Search Unity

[Shader] Moving Trees Grass in Wind Outside of Terrain

Discussion in 'Assets and Asset Store' started by AustinRichards, Feb 26, 2014.

  1. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    130
    Anyone able to convert this shader to work with the new SRP? tried to work around and edit the shader but still cant get it to work with the lightweight render pipleline .
     
    Ozer_Jigme and DonJorris like this.
  2. colijn

    colijn

    Joined:
    Aug 1, 2018
    Posts:
    4

    Do i just create a new c# and delete everthing inside it and then paste one of your scripts on it?

    Ive tried that but it didnt work

    How do i get it to work?
     
  3. Will-D-Ramsey

    Will-D-Ramsey

    Joined:
    Dec 9, 2012
    Posts:
    221
    Im trying to adjust the shader so it doesnt move the very bottom of the mesh. This is so the base of the grass or branch doesnt move, since it doesnt irl. Ill keep trying but im new to shaders and any ideas would be greatly appreciated.
     
  4. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello Sarah,

    thanks a lot for your Version of the shader. I tried different grass shaders, but this Version is for my usecase really great.

    I just have one Question, Maybe you can help me with because I am not a shader expert:

    I am using a textureatlas for different grass textures, I have 8x8 textures on one atlas.

    For each grass I have an own mesh with some simple planes, that Point to the desired part of the Atlas for different grasses.

    With your Version of the shader this Looks really perfect on some of them! But some move extremly strong now, others do not. Can you tell me how to get them all move the same, so having Kind of Modulo calculation for this depending on the width and height of a part or the number of colums and rows?

    Can anybody add this to this Version please? That would help me a lot!

    Thanks :)
     
  5. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    PS: I tried to Modulo the part with the Texturecoordinates but now it does not move/shake at all anymore. I have 8x8 grass textures in my textureatlas.
    float waveAmount = fmod(v.texcoord.y, 0.125) * (color.a + _ShakeBending);

    And I just realized the grass does not set a shadow?


    -> works better with v.vertex.y. I guess I can find a solution with that, thanks!
     
    Last edited: Mar 21, 2019
  6. briancullen13

    briancullen13

    Joined:
    Apr 3, 2015
    Posts:
    3
    We are trying to figure out how to stop the sliding of the base of the sprite in play mode - seems to be anchored in the editor - did you have any luck?
     
  7. RR7

    RR7

    Joined:
    Jan 9, 2017
    Posts:
    254
    has anyone been able to build this in shader graph? i tried but i must be misunderstanding something as soon as i set the position it just vanishes :(
     
  8. TheSwanCollective

    TheSwanCollective

    Joined:
    May 6, 2016
    Posts:
    26
    Did you ever come around to release your wonderful shader to the public? Thanks in advance Renan!
     
  9. scarletsnake

    scarletsnake

    Joined:
    Nov 27, 2009
    Posts:
    106
    I hope I'm not necro-posting but even if I am, this post and all the contributions are really valuable to anyone who uses the built-in renderer like me. Thank you, all of you, who have contributed to the creation of this wonderful shader. If everything goes as planned, this will be the primary vegetation shader in my game, Scarlet Rain. There's also a lot to learn by dissecting the code and learning what does what. You guys and gals are the best!