Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to 'pattern' grass??

Discussion in 'General Graphics' started by JosephB2000, May 24, 2015.

  1. JosephB2000

    JosephB2000

    Joined:
    May 18, 2015
    Posts:
    8
    Note: I am not sure where this thread should go, so I put it in the Graphics category...

    In my current project, I want to add a nice grass pattern, seeing how the grass currently looks repetitive when in large groups...

    I want to do something similar to Viva Piñata's short grass:

    1280 × 720 - hawtymcbloggy.com

    As you can see, there is a beautiful leaf pattern that runs through the grass. How do you guys suppose I can do something similar to this?

    My guess is the terrain beneath the grass has been textured with that pattern, and the grass is slightly transparent, but in that case, how would I make the grass slightly transparent?
     
    Last edited: May 24, 2015
  2. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    You could have multiple different grasses that you paint or use another tool to randomly apply them to the terrain (like TerrainComposer).
     
  3. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
  4. AlexBM

    AlexBM

    Joined:
    Mar 26, 2015
    Posts:
    16
    You can try to do it with shader.
    First, place all grass (quads with sprites, as long as performance of target platform allows) as you would do if no shading were required. Then calculate grass world coordinate in vertex shader, pass it to fragment and use as UV to lookup in some mask texture that will have required shading pattern. Color those pixels that are covering by that mask a little bit darker, and you should get effect similar to one on the screenshot.
    However, to do so you probably need to be somewhat familiar with shaders, so check Unity docs on that matters, if you need that.