Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[kinda SOLVED] Stylized Grass Shading like in Zelda BotW

Discussion in 'Shaders' started by flogelz, Sep 23, 2019.

  1. flogelz

    flogelz

    Joined:
    Aug 10, 2018
    Posts:
    141
    So I'm currently getting into geometry shaders and want to recreate the grass from Zelda BotW!

    Grass_BotW_2.jpg

    Now a lot of solutions for grass/foliage shaders suggest to edit the normals to get kind of unified shading. I believe the grass in BotW copies the normals from the ground to the individual grass strands. Similar to this technique over here: https://polycount.com/discussion/209623/smooth-foliage-like-in-breath-of-the-wild-europa-by-helder-pinto-mini-tutorial

    Here's how my grass looks until now: Grass_3.png

    When my grass copies the normals this way and i look towards the sun, i get this kind of shading effect, which seem like a weird reflections of the sun- It increases then i turn up the smoothness of the grass and when i look towards the sun.

    Grass_4.png

    There must be something wrong on my end, since i can't imagine, that all these solutions suffer under the same problem-
     
  2. flogelz

    flogelz

    Joined:
    Aug 10, 2018
    Posts:
    141
    Here's another example of the weird shading just using a plane, with normals pointed upwards and the standard shader-

    Grass_GIF_2.gif
     
  3. flogelz

    flogelz

    Joined:
    Aug 10, 2018
    Posts:
    141
    OK! So after I spent way too much time looking at grass in the past few days, I finally got a clue, that BotW indeed uses the same approach and has to deal with the same difficulties! Take a look at this comparison!

    Grass_Clue_1.png

    If you look closely, it's the same weird light falloff in areas that seem to have higher smoothness! Now I atleast know, that they somehow worked with this problem, instead of using a different lighting model in the first place or some other approach.
     
  4. GarrettF

    GarrettF

    Joined:
    Jul 4, 2019
    Posts:
    49
    Hey is there a tutorial or any direction you could give as to how you made this grass? Also how performance heavy is it? I'm currently working on a project in HDRP and am trying to find a way to get nice lush grass like this without having 70k batches and 3 fps.

    Thanks, and sorry about reviving the old post. Hard to find lots of good info on this subject.
     
    flogelz likes this.
  5. flogelz

    flogelz

    Joined:
    Aug 10, 2018
    Posts:
    141
    Here you go! - > https://roystan.net/articles/grass-shader.html

    The grass is created using a geometry shader. Apparently these are very expensive, but I like their functionality, so atleast for now, I'm gonna stick with one. I can't specifically tell how expensive they are (depends on the use case i guess) but maybe some one in the forums knows more!

    I'm not sure if they are supported in HDRP tho-
     
    lasiaylo and Ng0ns like this.
  6. vasubhatt60

    vasubhatt60

    Joined:
    Jan 3, 2021
    Posts:
    1
    asset on the assetstore that may help https://assetstore.unity.com/packages/3d/environments/smm-stylized-grass-184975 hdrp compatible