Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Assets Critias SpeedTree Grass System

Discussion in 'Works In Progress' started by Assembler-Maze, Sep 26, 2016.

  1. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry, had 0 time in preparing this stuff. Will keep you updated however.
     
  2. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I've updated a complete project on github. I don't have time to add a 'readme' at the moment but those who are really brave can venture in by themselves.

    Get it here.
     
    Alverik, lezan_, bgrz and 3 others like this.
  3. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
  4. unyunburst

    unyunburst

    Joined:
    Feb 7, 2017
    Posts:
    8
    All hail. Thank you Assembler-Maze.
     
    Alverik likes this.
  5. sBabb

    sBabb

    Joined:
    Feb 2, 2015
    Posts:
    51
    Looks really cool. I downloaded the Git project. But, not sure how to get it working. Anyone else been successful?
     
  6. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry for not updating any help or readme on git but I was kinda busy :).

    Here are the steps to get this up and running for painting grass:

    1. Select the 'GrassTerrain' and enable the 'Draw' for 'Trees & Detail Objects'
    2. This will enable the grass on the terrain and will display some white grids. Those white grids mean that the grass will be loaded only in those grids and not on the whole terrain to save performance
    3. Select the 'GrassTerrain' and paint your grass with the brush as you would normally paint trees
    4. Hit 'SaveGrass' on the attached 'GrassSaver' script
    5. Hit 'UpdateRuntimeGrass' in the 'GrassSystem' object
    6. Disable the trees enabled at step 1
    7. Hit play, you should see the updated grass now!

    NOTE: You can only paint grass in the white grids. If those don't update try hitting 'Update Grass Data' and 'Manual Update' in the 'GrassSystemEditor' script attached to the 'GrassSystem' object

    I hope this works for you guys!
     
    Alverik likes this.
  7. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    The only thing that stops me from adding this to the Asset Store is the lack of a decent tutorial, but I really really hope that I can rig up one video tutorial soon.
     
    Alverik likes this.
  8. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    176
    Great job. TNX !!!
     
  9. tryptic

    tryptic

    Joined:
    Nov 13, 2012
    Posts:
    54
    Hello Assembler Maze, quick question. Can I use this if my game already has a complex series of grass splats generated by Terrain Composer 2? Or does it require hand painted application of grass. Thanks and best regards, -H
     
  10. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Pfff... At the moment it requires hand painting, sorry.

    However due to good feedback on the tree system and quite a good start with this grass system I am thinking to merge the two into a system that should be usable like the one in 'Unreal', designed for artists, without a difficult setup and that should allow you to use pre-existing details etc...
     
  11. Sphira

    Sphira

    Joined:
    Aug 29, 2017
    Posts:
    5
    Hello,

    I'm testing the asset (only this one this time) and i got this Error


    Shader error in 'Nature/SpeedTree_Grass': 'UnityApplyDitherCrossFade': cannot convert from 'struct v2f' to 'float2' at line 120 (on d3d11)

    Compiling Vertex program with SHADOWS_DEPTH LOD_FADE_CROSSFADE INSTANCING_ON GEOM_TYPE_LEAF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME
     
  12. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I managed to solve the error by re-building the shaders. (Try re-importing them)
     
    5566s183 likes this.
  13. lawsochi

    lawsochi

    Joined:
    Oct 24, 2016
    Posts:
    107
    please do it!! not a single asset that allows the full use of Speedtree. thank you in advance.)) and please, based attention, pay attention to the acceleration of work, a lot of assets that automatically plant plants, but so little speeding up their work. there is no sense from beautifully placed plants, if they work at a speed of 10 fps ....
     
    gremberman likes this.
  14. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,431
    Might be a long shot, but can you add custom mesh support? i'm not really into speedtree :p
     
  15. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I remember now that I had the same problem but it was not shader related. I re-loaded and refreshed the shader until it eventually worket. At the moment I'll try and see if I can update the base shaders using the 2017 version, but I think it's unrelated.
     
  16. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yea, I know. That is why the purpose of this system is not the creation/adding of details/foliage but an data structure that allows for uber-fast rendering. That was the purpose the the initial 'Critias-Grass/Tree' systems.

    At the moment I've managed to implement (worked like a maniac):
    - Foliage painting
    - Rendering subsystem
    - Data structure for fast rendering
    - Clean intuitive UI

    The usability/UI part took more than the actual data struct coding, but I hope that once I've finished it I don't have to turn back to the UI again.
     
  17. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yes, custom meshes are a very important built-in functionality.
     
    Reanimate_L likes this.
  18. gremberman

    gremberman

    Joined:
    Aug 10, 2014
    Posts:
    128
    Can you please make a Unity 5.6 version? ;)
     
  19. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello! It should work for 5.6, just copy-paste the code. The only thing it uses is the 'DrawMeshInstanced' API, so it should work.
     
  20. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    For those interested in a complete grass/tree, easy to setup system based on this tree and the grass system check out 'Critias Foliage System'. It is a lot easier to setup than this system and with a lot in addition!
     
    No0B25 likes this.
  21. irory

    irory

    Joined:
    Nov 3, 2016
    Posts:
    5
    its not letting me download this asset despite having updated unity restarted and rebooted
     

    Attached Files:

  22. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry, it is highly unlikely that it's my system's problem, it is highly likely that there's an asset store bug or something.

    However you could try:

    1. Login and logout from the asset store and disable the 'remember me'
    2. Logout clear your PC's unity cache (Users/AppData on Windows) login and download
     
  23. irory

    irory

    Joined:
    Nov 3, 2016
    Posts:
    5
    Can someone explain or demonstrate step 2? : 'Add to the terrain the required SpeedTree grass prefabs'
    Sorry obvious noob question
    Bests
     
  24. No0B25

    No0B25

    Joined:
    May 2, 2016
    Posts:
    69
    You need to have SpeedTree grass (i.e. grass authored in the SpeedTree editor). When you add them to the terrain you want to paint them on, this system will extract the prefabs and the positions of all the instances of all grass objects that you painted.
     
  25. irory

    irory

    Joined:
    Nov 3, 2016
    Posts:
    5
    Thanks I redownloaded unity and it worked out but im still getting to grips with it!
     
    No0B25 likes this.
  26. irory

    irory

    Joined:
    Nov 3, 2016
    Posts:
    5
    Sorry, I don't understand (the jargon).

    What does this entail in unity?

    I have ignored that step and am now having trouble with Step 8:
    For the 'Edit Cell Size' and 'Runtime Cell Size' set it to a value that is as close to 100 meters as possible. Since the system requires a perfect division of terrain space use the 'Cell Info' button from the 'Grassifier' script to see what cell sizes the system recommends. It will output them in a format of {S:[vvv] C:[vvv]}. Use the value at 'C' and pick the one closest to 100. If you used a terrain of 500x500 you can use 100 for the edit/runtime cell sizes (since 500%100=0).

    I am not getting the {S:[vvv] C:[vvv]} only an error message saying 'NullRefenceException: Object reference not set to an instance of an object.

    I probably need to read some more tutorials or get some pics to see how its done

    Thanks
     
  27. irory

    irory

    Joined:
    Nov 3, 2016
    Posts:
    5
  28. 5566s183

    5566s183

    Joined:
    Apr 5, 2013
    Posts:
    5
    I updated my unity to 2017.2.0f3 version.

    Now, I can't build my game with the SpeedTree_Grass shader.

    I tried re-importing them,but it still the same.

    How to fix them?

    Thank you.

    Build completed with a result of 'Failed'
    Error building Player: 2 errors
    Shader error in 'Nature/SpeedTree_Grass': 'UnityApplyDitherCrossFade': cannot convert from 'struct v2f' to 'float2' at line 120 (on d3d9)

    Compiling Vertex program with SHADOWS_DEPTH LOD_FADE_CROSSFADE GEOM_TYPE_BRANCH
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA

    Shader error in 'Nature/SpeedTree_Grass': 'UnityApplyDitherCrossFade': cannot convert from 'struct v2f' to 'float2' at line 120 (on d3d11)

    Compiling Vertex program with SHADOWS_DEPTH LOD_FADE_CROSSFADE GEOM_TYPE_BRANCH
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME
     
  29. No0B25

    No0B25

    Joined:
    May 2, 2016
    Posts:
    69
    @irory, I can't tell how much experience with Unity you have, but you should get a basic understanding of how Unity's interface, component system and, in the best case, scripting work, before trying this system out. It's rather simple to use when you are very used to working with Unity, but not as much if you're just starting out. You can apply the Tree, Grass and ultimately @Assembler-Maze 's Foliage Systems (which incorporates both of those systems in an easier to use package and without the SpeedTree requirement) after you created your terrain, so there's probably no need for using it right now. If you really are new to Unity, it would be better to get acquainted with the aforementioned aspects of developing games with Unity. It's generally better to worry about your making your game fun first, and then about its performance.

    If you still want to use the system, closely follow the manual and you should be good to go. As I wrote, just make sure that you specifically have SpeedTree grass if you want to use this system, or spend the 15 bucks on the Foliage System.

    As you can probably tell by the names of the tree and grass systems, they are created for SpeedTree, which is a tree and grass-creation tool used in game and movie production. Unity also has the integrated TreeCreator, which can also do that stuff, but it's less advanced, and it's technically not to be used for grass. @Assembler-Maze 's (free) systems optimize the rendering process of the more complex SpeedTrees, yielding you better framerates than if you're just dropping SpeedTrees onto the terrain without using his system.
     
    Assembler-Maze likes this.
  30. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello,

    Please, if you have a problem try and pack it in a single post so that I don't get lost in the posts. And sorry, this system is not very friendly, I've said it's for advanced users only.

    1. The null pointer comes from the fact that you didn't set up a terrain correctly somewhere, a link was lost (probs the main terrain) or maybe you did not set the data source or some other data (I see a lot of missing data in the screen)
    2. The grass shader problem should go away, try re-importing only the shader or delete the line with the problem, it should work just fine
     
    5566s183 likes this.
  31. 5566s183

    5566s183

    Joined:
    Apr 5, 2013
    Posts:
    5
    Thanks.
    I delete the line.
    Now I can build my game.
     
    Assembler-Maze likes this.
  32. 5566s183

    5566s183

    Joined:
    Apr 5, 2013
    Posts:
    5
    There is another error about the script "Grass Saver" in Unity Version 2017.2.0.f3
    I can't use the grass system to arise grass or delete them as usual.

    Assertion failed: Assertion failed on expression: 'scriptParameterClass != NULL'

    Script error: OnTerrainChanged
    This message parameter has to be of type: int
    The message will be ignored.

    Is it a Unity editor bug?

    https://issuetracker.unity3d.com/is...ening-project-containing-onterrainchanged-api

    thank you.
     
  33. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I think so, since I've used that without any problems for a long time. Reset the project and reimport the scripts it should work then.
     
unityunity