Search Unity

BEST WAY OF MAKING GRASS! looks a lot like speed tree grass, runs as fast and looks just as good!

Discussion in 'General Graphics' started by JamesL98, Jul 10, 2015.

  1. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    bandicam 2015-07-10 12-21-38-015.jpg So recently after learning more about speed tree but having no money to afford it i didn't want shant looking grass, so i have discovered this unique way of making beautiful grass that renders better than billboard and mesh and can have an LOD attached! so without further ado...


    so on the right we have billboard grass... looks bad, They only look good when they are in conjunction with planes and crosses. In the middle is a grass mesh 4 planes facing outward to look like a group of grass leaning out, looks ok in one clump but not alone or up close. The grass on the left is simply planes shot up in a straight line to simulate a blade of grass. You notice none are casting shadows and if you have ever used grass much then you know the wind isn't very realistic.

    The answer is below... Unity's tree editor.
    So as most of you already know unity's tree creator isnt the easiest to work with to make trees and often doesn't have 100% quality, but what about making grass with unity's tree editor? No-one said you cant...
    So here's the step to making brilliant grass!

    * Make sure you have imported the "terrain assets" included with unity located under
    Assets>Import Package>Terrain assets and then create a tree game object by selecting GameObject>3D Object>Tree or Create>3D Object>Tree


    #1
    -Remove the first branch (stump) so that there is only the single tree gameobject.

    #2
    -Create a "leaf" game object by clicking the leaf symbol under the "Tree" Hierarchy.

    #3
    -After creating the leaf, select the leaf in the Hierarchy and change its "Geometry Mode" to cross (from billboard)
    bandicam 2015-07-10 12-25-19-353.jpg
    #4
    -Select a shader with a 2D image attached, unity will automatically modify it.
    bandicam 2015-07-10 12-25-39-169.jpg
    #5
    -Rotate the cross section until it is upright. The rotation tool is back to front while doing this for some reason.
    bandicam 2015-07-10 12-26-17-205.jpg
    #6
    -Select the tree in the Hierarchy and modify "Alpha Cutoff" until the shadow no longer has the shadow of the planes.

    bandicam 2015-07-10 12-27-25-546.jpg
    #7
    -You can now modify the shadow on/off and the quality as-well as wind settings to your choice

    #8
    - Once you are done select unity terrain and go to trees and add your grass as a tree mesh prefab. You will then be able to pain on the grass.

    This is what it loooks like and it can be clumped together more.
    bandicam 2015-07-10 12-21-38-015.jpg


    So, easy on your CPU/GPU, looks better, can cast or receive shadows, can be effected by windzones (for grass displacement when player steps on it), completely free and easy to make different kinds.... hope you guys like and find this useful.
     
    Last edited: Jul 10, 2015
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    How have you measured this?
     
    Riva3000 likes this.
  3. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    Yes i measured the heat difference rendering (on cpu) i haven't tested gpu but i assumed if it was easier on one than it would be for the other, i opened a scene with the grass and let it be for 15 mins (timed) then checked the temperature, with mesh grass it was at 57.8 degrees Celsius whereas 15 minutes with this grass ran at 49.4 degrees Celsius (there may have been some unwanted influence from the air-con but there was definitely less stress on the processor) and the computer was left to cool after the first test for about an hour to make sure that the processor was back at room temperature to go again and there were no programs running differently at either time.
     
  4. randomperson42

    randomperson42

    Joined:
    Jun 29, 2013
    Posts:
    974
    Have you measured a framerate difference with a decent amount of this grass?
     
  5. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    billboard grass (detail distance max), about 130fps
    plane grass (detail max), about 160fps
    billboard and plane mixed, about 120fps
    new grass(tree distance set to detail distance and billboard distance past it), about 180fps

    see for yourself, put some in a scene...
     
  6. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Thanks for sharing! There's just a few pictures that are noy showing up.
     
  7. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    eh? what do you mean?
     
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,144
    Second, third, fourth, and fifth images on the initial post are not appearing.
     
  9. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    oh, they were when I posted it, I will fix this, thank you for letting me know.
     
  10. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    "Yes i measured the heat difference rendering (on cpu)"

    Why would you measure heat difference instead of just checking the grass render time in the profiler? Seems like a difficult way of doing something simple with less accurate results.
     
  11. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    could've/ should've
     
    WALK2222, gameDevi and Dreamaster like this.
  12. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    Fair enough. At least it was inventive :D The grass looks pretty good by the way.
     
    mattis89 and JamesL98 like this.
  13. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Yeah, thanks for sharing. I know Unity game that had problems with lots of grass so they removed it. Will link them to this thread.
     
    JamesL98 likes this.
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I'll may appear awkward, but still: where's the tree creator in Unity 5 ?
    Can't find it...
     
    JamesL98 likes this.
  15. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    first make sure you have imported unity's included asset "terrain assets" located "assets" > "Import package"> "terrain assets" then Inside your Heirachy (usually located on the left) click "create" then hover over "3D object" and select "tree" or alternatively select"gameobject" tab up the top and hover over "3D object" and select "tree", the editor is attached to the tree game object when it is made.
     
    jimmikaelkael likes this.
  16. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    Awesome glad i could help.
     
  17. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Ah thank you very much!
    I was following the Unity docs but it seems it's kind of outdated as it's told it's a separate asset...
     
    JamesL98 likes this.
  18. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    It is actually a separate asset but is included in unity when you download (the same as mono develop), as long as you have imported the "Terrain assets" package then you are all set...
     
  19. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Well yes I have "Terrain Assets" already.
    Just have seen you reuploaded pictures, many thanks!
     
    JamesL98 likes this.
  20. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Very creative solution that is utilizing some of the built in optimizations from the tree system. Kudos!
     
  21. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    I have no idea what Kudos means... but ill take it as a compliment, thank you.
     
    JamesArndt likes this.
  22. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Ha ha that's okay...it's a compliment of the highest magnitude :)

    https://en.wikipedia.org/wiki/Kudos

    or I could have meant this "a brand of chocolate-covered cereal bar".
     
    JamesL98 likes this.
  23. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Yeah..kudos to ya. Good think around.
     
    JamesL98 likes this.
  24. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    wow that is thinking outside of the box - i lve inventive approaches like this. Im going to check it out, AND i learned i can use wind zones to simulate players moving though brush when you mentioned it. Thanks:)
     
    MegamaDev and JamesL98 like this.
  25. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Looks more like heather which reminds me I want to try heather again. I've got one area of the house that it looks like it will thrive in.
     
    JamesL98 likes this.
  26. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    It might be helpful to note that the grass works better using a mesh made up of two planes slanted away from one another with a bit of randomisation in your choice of 3D modelling software, to stop the grass looking like "X's" when the camera is at a close to 90 degree angle above the grass.
     
  27. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    The jagged effect you are talking about and the color is why I think it looks like heather.
     
  28. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    yes it does look a lot like Heather but if someone reads this thread looking for a more realistic grass they could get something like my grass here:
    bandicam 2015-11-29 08-52-40-084.jpg
     
  29. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    And this grass is similar but is made with a custom shader and mesh (not Unity's tree creator) but it evolved from there and is 4 planes each mesh three facing away from one another and one flat in the middle to cover the centre of where they meet if there is a bump in the terrain or something.
    bandicam 2015-12-13 14-08-16-111.jpg bandicam 2015-12-13 14-10-24-818.jpg
     
    DotusX and GoGoGadget like this.
  30. BCrisos

    BCrisos

    Joined:
    Jan 8, 2015
    Posts:
    52
    Is speed tree broken now? every time I try this method with a mesh, or even use a mesh for terrain its broken and I get this....

    5hcdS7I.png

    I'm using blender and I've cleared all my rotations and made everything 0,0,0. Exported a .blend and also an fbx file, And i still get this weird rotation when using speed tree. I also did the rotate -90 degree and apply rotation and still the same thing. I successfully used your method, but I want to use my grass mesh that I made not the texture and its just not working for me D:

    Does anyone know why?
     
  31. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    Yea blender to unity does some weird things when it comes to rotation and the placing of tree meshes, in blender on the top right (unless you've changed it yourself) there should be a hierarchy similar to Unity's own, is there more than one mesh here? The tree placement in the terrain system doesn't really like grouped meshes and that could be your problem? If that is the issue you could simply select all your objects in blender (in object mode) and the ctrl+j combines them into one mesh.

    Or if there is only one mesh in that hierarchy you could go into "edit mode" tab is the default key to change modes in blender, and rotate the whole mesh in edit mode -90x or 90x or whatever it needs to be.
     
  32. BCrisos

    BCrisos

    Joined:
    Jan 8, 2015
    Posts:
    52
    Well heres the thing its come to the point that i've even remade the whole thing rotated and applied its rotation and exported it as a FBX only 1 mesh, and it still does the same thing. I would go back and rotate and apply and when I try it out, it still does the same thing D:
     
    JamesL98 likes this.
  33. Polkatuba

    Polkatuba

    Joined:
    Oct 31, 2014
    Posts:
    79
    I don't mean to sound stupid, but I don't see anything called "Terrain assets" in the package import menu?
    I see that this thread was started last year. Is this tutorial still valid?

    EDIT: Nevermind. Figured it out.
     
    JamesL98 likes this.
  34. LightVading

    LightVading

    Joined:
    Oct 14, 2015
    Posts:
    1
    I have a problem my grass is bright green and i cant change it and i have spent hours trying to change it but it wont change colour >.<
     
    JamesL98 likes this.
  35. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    Chuck us a screenshot of the grass and your "Inspector" window when you select the tree and ill gave a look.
     
  36. LightVaing

    LightVaing

    Joined:
    May 16, 2016
    Posts:
    2
    its normal like you have just added a tree
     
  37. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    Your sentence doesn't make too much sense. It is just a tree but can be used with unity's wind system to do more things and is a bit more customisable than normal grass.
     
  38. Juicyfruit575

    Juicyfruit575

    Joined:
    Aug 31, 2015
    Posts:
    1
    When exporting .fbx in blender, check the '!EXPERIMENTAL! Apply Transform' box. The error is because y is up in unity and z is up in blender. Just don't use it if you have animations on the model. :)
     
  39. LightVaing

    LightVaing

    Joined:
    May 16, 2016
    Posts:
    2
    The config is defult
    Like you have just made a new gameobject from the built in tree editor
     
  40. davidhughes3d

    davidhughes3d

    Joined:
    Nov 30, 2012
    Posts:
    29
    this is great, was considering doing the same then researched and found this thread. awesome!
     
  41. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I made a grass with Shader Forge which uses a planar light reprojection rendertexture to illuminate the light shading, which can be blurred to fake the light scattering among the grass. It also have soft transparent edges with (almost) correct depth sorting as opposed to the sharp default cutout which is whats usually used for grass, and it uses a single pass to do everything inlcuding the soft edges.

    It's incredibly light on performance since it doesn't do any computing with the grass meshes themselves and uses the terrain lighting as proxy. And even if you have large shadows or multiple lights coming around you will see them on the grass even though the grass don't cast or recieve shadows.

     
  42. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    That looks awesome, are you planning on sharing/selling? :)
     
    jason-fisher likes this.
  43. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    That really is fantastic! +1 on sharing/selling....and would that shader work on Unity 4.7?
     
  44. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    This was just experimental really. I'm just playing around to see if I can get a foliage shader with soft edges.
    The same thing can be used for plants and bigger vegetation as well. These are also relatively easier on the GPU since they only calculate shadows and don't do anything with specular / normal dependant shading.

    These are screenshots from the editor and they don't use any anti-aliasing / camera effects.

     
  45. zThana

    zThana

    Joined:
    Dec 5, 2014
    Posts:
    18
    Recommended asset for this?
     
  46. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    Any idea yet if you want to either share the shader forge setup, or sell it as an asset in the store?
    It sounds and looks promising, got me curious especially when mentioning the soft transparent edges... that is one huge pain with other solutions currently.

    Would certainly spend something on this if it works well.
     
  47. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    It's nothing special really. You just use zwrite with both alpha transparency and alpha cutout, which cuts out the mesh just where the alpha fadeout ends. And it only uses the light attenuation mask for both sides of the mesh without any normal calculation so its super easy on the GPU. But as I said it's got problems with the edges and just experimental.

    Here's the shader : http://www.mediafire.com/download/o2ol875d4koicy3/Foliage+Flat.shader
     
    Archigesture, muzboz, konsic and 10 others like this.
  48. PatHasNoPot

    PatHasNoPot

    Joined:
    Oct 10, 2016
    Posts:
    7
    I could not find the terrain assets on Unity 5(using 5.3.5f1 Personal)
    I've tried other grass terrains that I have from assets I got online with this method, they do not seem to look nowhere decent/acceptable as a grass terrain.
    The only "Grass" thing with the standard assets would be a texture for the ground labeled "GrassFrond01AlbedoAlpha" and "GrassFrond02AlbedoAlpha"

    Did the standard terrain asset get removed with newer versions of unity? I don't seem to find it. Or if it's an asset you got online, do you mind linking it?
     
  49. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    The original Terrain Assets package is now deprecated. I thought that there were still some relevant assets in the Standard Assets package, though?
     
  50. PatHasNoPot

    PatHasNoPot

    Joined:
    Oct 10, 2016
    Posts:
    7
    There is not a single grass material. There's only 2 textures in the Standard Asset pack