Search Unity

[RELEASED] Vegetation Studio

Discussion in 'Assets and Asset Store' started by LennartJohansen, Jun 23, 2017.

Thread Status:
Not open for further replies.
  1. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    You need to create one persistent vegetation storage file for each terrain. They can use the same vegetation package.
     
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Baking the vegetation to the persistent storage will help on loading speed. Pre loading the area around the camera should also be no problem. Just a few lines of script to trigger a load cells withing range.
    Send me a pm if you want some help setting up.

    Lennart
     
  3. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    There should be no double draw of vegetation. Each VegetationSystem component only spawns and render vegetation for its own terrain. If the terrains dont overlap each other the vegetation would not...

    Mesh terrains works a bit different. You can add multiple meshes to a virtual terrain and add to a Vegetation System component.

    Sending you a pm. Just to see how a setup could be.

    Lennart
     
  4. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Thanks!
     
  5. halecc

    halecc

    Joined:
    Dec 17, 2016
    Posts:
    33
    Hello,

    I was just wondering if you had any plans on improving the touch bending system, like the one in advanced foliage shader?
     
  6. Anubis9

    Anubis9

    Joined:
    Jun 10, 2015
    Posts:
    5
    Hello,
    A small question here. I've got 5 objects with LODs (rocks/branches/etc.) that I'll be adding to the Vegetation Studio for scattering. I don't know how exactly Vegetation Studio manages Draw/SetPass calls, so, would it be better for them all to share just 1 material/texture (combine all the textures into one larger atlas), or for each object to have a separate, smaller texture+material?
    Thanks in advance!
     
  7. LightBulbTechnology

    LightBulbTechnology

    Joined:
    Apr 3, 2014
    Posts:
    5
    Apologies if this has already been covered. I am getting an error on import in both 2017.3.1f1 and 2018.1.3f1.
    Code (CSharp):
    1. error CS2001: Source file `Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/PersistentVegetationStorage/Editor/PersistentVegetationStoragePackageEditor.cs' could not be found
    2. error CS2001: Source file `Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/PersistentVegetationStorage/Importer/Editor/SceneVegetationImporterSettingsEditor.cs' could not be found
    3.  
    4. Compilation failed: 2 error(s), 0 warnings
    5.  
    Any thoughts? Probably has a simple solution but I am stumped. The files exist but open and crash in Mono instead of in Visual Studio.
     
  8. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @Lennart So mesh terrain compatibility has been added and is now updated on the asset store?
     
  9. Deleted User

    Deleted User

    Guest

    Please, when you provide a solution..can you make it public?..cause I'd like to know about mesh terrains too.
     
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will. I am just trying to understand complex setups a bit better. to see if anything can be done easier. All changes and new functionality to this will be added.

    Hi. Not yet. I am working on some tech to do a demo in Unite in Berlin now the 19th. When back I will finalize the mesh component and publish. I think I will do a patch update in a few days. Have a list of bug fixes and changes ready.
     
  11. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I do not know the touch bend in advanced foliage good but as far as I know it is collider based on gameobjects. We can not do the same while rendering instanced. The next step for the touch bending system is a double buffer that will give delayed bounce back when moving colliders around.

    Lennart
     
    kepesh likes this.
  12. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    When rendering instanced using an multiple textures or an atlas will not change the amount of drawcalls. Just do it the way that is easiest for you.
     
  13. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Not seen this error before. It looks like somthing wrong with the files. Could you try to delete the cache unity has of the package and download from asset store again? If it does not help send me a pm and we try to debug.

    Lennart
     
  14. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
  15. LightBulbTechnology

    LightBulbTechnology

    Joined:
    Apr 3, 2014
    Posts:
    5
    Hey Lennart,

    Thanks for the response. Looks like it was a max path string length issue. I believe the path where the missing files were located had 263 characters. I believe max is 260. Renamed the root folder to "AwesomeTech" and it resolved the issue. So if anyone is googling a CS2001 error in Unity, it could be caused by the path/location for the files being a string that has too many characters. The more you know I guess.

    Thanks again!
     
  16. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi @LennartJohansen , I'm getting a crash error when I set VS to the settings for infinite terrain on map magic. I've followed the settings for adding it to first terrain etc.. Should they be runtime spawn enabled? I narrowed down the unity crash it happens whenever runtime spawn is enabled but i need it on to create persistent storage so not sure how to fix it.

    I've also noticed my settings for density on the global vegetation settings keep reverting to 1 even after I have changed the to my specific needs. Other things like water level and whether cells underwater are enabled etc. Is there a way to save all settings?
     
    Last edited: Jun 8, 2018
  17. Anubis9

    Anubis9

    Joined:
    Jun 10, 2015
    Posts:
    5
    Thanks for the reply, it's useful to know that!

    I also had a small request - would it be possible to expose the LOD distances for the created Vegetation Studio prefabs? Currently, for the objects, LODs change from LOD0 to LOD2 in just 10cm from the object, LOD0 being so close, that you can't even see it, as the object is culled by the Camera's near clipping plane of 0.3. Exposing LOD1Distance and LOD2Distance would help a lot with any of those issues.
    Thanks in advance!
     
  18. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. There is a LODFactor exposed on each VegetationItem. This will give you a linear scale of the distances. The original distances are based on the LODGroup on the prefabs. If you need any more adjustment you need to do this on the LODGroup.

    Lennart
     
  19. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi.

    Had a look at the editor code. There was some places where the scene was not set dirty and would not save. I have fixed this for the next update.

    Sending you a pm about the mapmapic error. I need more info.

    Lennart
     
    AndyNeoman likes this.
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. There is no updated guide. But I had a quick look at it and it does not seem to be any big changes. Send me a message or find me on the discord chat and I can help you set up.

    Lennart
     
    Firlefanz73 likes this.
  21. Anubis9

    Anubis9

    Joined:
    Jun 10, 2015
    Posts:
    5
    Yes, but the Objects don't have a LODs group with "LOD distance factor" option, only Plants and Trees do.

    Edit.
    Ohh, they do, but only if you drop a model into the Object slot in the editor. If you drop a modified Prefab from that model (changed material and LOD distances), the LODs group is no longer there.

    Edit 2.
    Ohh2, they do if the material is a AwesomeTechonolies/Grass/ one. If it's a different one, even modified to support Instanced Indirect, it doesn't show LOD options.
     
    Last edited: Jun 8, 2018
  22. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    If your objects has a LODGroup component set up for the LODs they should have all the lod settings. I can test an object for you if you want.

    Lennart
     
  23. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    For grass and plants individual LOD distances is only available when rendering instanced indirect. It would be to slow to do this on the CPU, just to many instances to distance test and split up render lists.

    Try to switch rendering to instanced indirect and see if you get the settings.

    Lennart
     
  24. Anubis9

    Anubis9

    Joined:
    Jun 10, 2015
    Posts:
    5
    Sorry for the edits.
    I've done few tests just now.
    1. If I create a Vegetation Item directly from a model (FBX asset) with a LODGroup component, then LODs group is available in the Vegetation item options.
    2. If I create a prefab from the said model without touching anything and create a Vegetation Item from that prefab, the LODs group is still there.
    3. But as soon as I change any distances in the LODGroup component on the prefab and then try to create the Vegetation Item from it, the LODs group disappears from the Vegetation Item options. It also disappears if I create the Vegetation Item from the untouched prefab (2.) and then modify the LODGroup's distances on the prefab and Refresh the prefab in the Vegetation Item options.

    P.S. The rendering is set to Instanced Indirect for all cases.
     
  25. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Answered your private message also, but could you export the modified prefab for me. select it in the project folder and choose export. I just want to see if something goes wrong with it after you modify.

    Edit: We found the problem. The combined scale of the mesh and LODGroup settings gave a lod distance below a treshold set in Vegetation Studio. This will be resolved in an update.

    Lennart
     
    Last edited: Jun 9, 2018
    ftejada likes this.
  26. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    I have this issue too.

    Deactivating the aquas reflection script, the error does not appear ... but -of course- there is no water reflection.
    The error appears when the START VEGETATION STUDIO green button has been pressed. In playmode without pressing the green button, it does not appear.
    I hope it helps to solve it.



     
  27. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. A fix for this issue with Aquas is done. I will submit an update on Monday with this and other improvements.

    Lennart
     
    Barritico and Firlefanz73 like this.
  28. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Development update

    Hi. I will submit an update on Monday with the follwing changes/fixes. I plan to finish the MeshTerrain support when I am back from Unite in Berlin. I will also share some news then of some exiting tech we will be showing at Unite.

    Improvements
    • Advanced mode setting for allowing more than 64 vegetation items. This will be set as default in a future update.
    • Added static SetWaterLevel function on the VegetationStudioManager.
    • LODs are now recognized with both upper and lowecase naming. LOD0, lod0 etc.
    • SceneVegetationImporter does now check if the prefab already is added to the vegetation package and uses that.
    • TerrainTreeImporter does now check if the prefab already is added to the vegetation package and uses that.
    • Autoselect terrain will now prioritize terrain components in parent Transforms.
    • Added tool window for setting up Vegetation Systems on multiple terrains.
    • Added a variant of the grass shader that takes bend info from the alpha vertex color
    Changes
    • Vegetation Studio will now randomize the random seed after it generates the values needed.
    Fixes
    • Added fix for source LOD settings on billboards only showing on speedtree
    • Fix for Mega splat texture rules not working correct when top and bottom layer is the same
    • Fix for compute shader error that could happen on 2018.1+ Compiler gave an error if a cell had an empty compute buffer.
    • Fix for issue with some blinking at billboard transition.
    • Fix for error when using Aquas and Vegetation Studio in 2018.1
    • Fix for frustum culling issue that could happen with multiple vegetation systems with different camera view.
    • Setting RenderVegetation to false now suspends vegetation loading also
    • Changed #pragma on the heatmap shader to work on osx
    • Added fix for global density changes not saving.
    Lennart
     
    HXCMAN, ftejada, Rowlan and 5 others like this.
  29. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    • Added a variant of the grass shader that takes bend info from the alpha vertex color
    @LennartJohansen

    Is the touch bending on grass improved and look better now?
     
  30. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Hi.

    It had a terrain already made with several road made with the EASYROAD V3.1
    When using Vegetation Studio, I inserted plants and trees in the middle of the road.

    Is there any solution for them to be eliminated directly?

    Now I apply a texture under the road so that, applying a mask, they disappear. But it is quite complicated and laborious.

    Thank you.
     
  31. Deleted User

    Deleted User

    Guest

    Lennart, just a quick not to say thanks...for all the hard work it took to create this entire system..
    - P
     
    Last edited by a moderator: Jun 10, 2018
  32. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The VegetationMaskLine was designed for cases like this. EasyRoads has integration with VegetationStudio and creates these automatic now but I do not know if you can do that on roads created before?

    In this case you can add the nodes manually.
    Have a look here.

    Lennart
     
    Barritico likes this.
  33. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    The change here is for the shader to support some 3rd party grass meshes that has bend info in the alpha color channel.

    Lennart
     
  34. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Thanks a lot!!!!
    Another question:

    It is possible that after passing a car and that I played the TOUCH REACT script (which works wonders) the plants or the grass make a path (twisted or bent)?


     
  35. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    What you can do is add a TrailRender component to each of the wheels. Add the TouchReact material (included in the project) to the trail renderers. Set this to the same layer as configured on the TouchReactSystem component.

    Then exclude this layer from your camera. This will prododuce a mesh following the wheels. Adjust the width and height to match your wanted effect.

    This mesh will then keep the grass bent.

    Lennart
     
    awesomedata, Akshara and Barritico like this.
  36. jmpedros

    jmpedros

    Joined:
    Jun 19, 2017
    Posts:
    11
    Hi,

    I have a terrain splitted in 16 chunks. Each one with its vegetation system. The problem is that in one terrain the texture splatmaps don't fit with the others. Here i have a comparison with the same texture splatmap (The one is not working is on the right). Any idea of what i'm doing wrong?


    low_res_splatmaps.gif

    Thanks in advance!
     
  37. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Sending you a pm. need some more info.
     
  38. Neiyra

    Neiyra

    Joined:
    Apr 19, 2016
    Posts:
    28
    Hello,

    I am thinking about buying your asset, it looks so great!
    Just a short question: is it possible to create/change the rules on runtime? I would like to give the players the possibility to create their own preferred vegetation set.

    Thanks in advance!
     
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. That is possible. You can access the VegetaionItemInfo class of each vegetationItem (tree,rock, plant etc) and change she spawning rules. Then clear the cache and it will respawn run-time with the new settings.

    VegetationMaskAreas and lines also work run-time. You can change them from code.

    Have a look here for the vegetation Masks.

    Lennart
     
  40. Neiyra

    Neiyra

    Joined:
    Apr 19, 2016
    Posts:
    28
    That is great news! Thanks!
     
  41. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @LennartJohansen,

    I'm wondering why although everything is set up correctly, not all stones/rocks are carved out of the navmesh. Looks like the system is stopping to progress some. Makes my AI's going crazy not knowing what they hit!
    Unity 2018.1.2f1 with latest version of Vegetation studio.
    carve navmesh issue.png
     
  42. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi.

    There are 2 ways to interact with the unity Navmesh.
    • You can bake the colliders to the scene with with Collider System and then bake your navmesh. That will test all colliders for the navmes.
    • The other option is using the navmesh obstacle. That will create navmesh obstacles for colliders close to the camera as you move around the terrain.
    How did you configure your setup?

    Lennart
     
  43. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    I went for the second option and set the prefabs to be a navmesh obstacles carving in the rocks. I guess the emphasis is here on close to the camera. If my AI's are somewhat out of range from my player (which has the main camera) the navmesh is carved. Is there a setting available that can be set that controls this behavior?
    How does your first option work? How can I bake in the colliders at design time into the navmesh?
     
  44. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    So I moved away from the actual carving of the navmesh at runtime and looked into the possibility to bake the navmesh (option 1 in your explaination). This seems to work fine except if you have a tiled terrain setup you have to generate all those navmesh colliders one by one for each tile.

    Edit: after further testing this doesn't work with multi terrain tiles, only the first tile is considered.
     
  45. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi

    Since the ColliderSystem bakes out all the colliders to the scene multi terrain should work the same. Select the billboard system on each terrain and bake the colliders. Then generate the navmesh as normal in the editor?

    Could you send me a pm with some more info if you still have a problem. Or a message at the discord chat and we can look at it.

    Lennart
     
  46. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    I was wondering how this compare to advanced terrain grass system that lars have?
    what's the pro and cons in comparsion?

    I assume this system backend render is not similar to advanced terran grass, where terrain grass focus on grass that's especially been rendered through GPU, while most of this is still using CPU, when used with GPU instancing(similar to unreal engine?)
     
  47. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I do not want to do post a comparison of Vegetation Studio to other assets here on the forum. I would like to keep this thread to info and questions about about Vegetation Studio. I can tell you a bit on how the grass and plants are rendered.

    Vegetation Studio has a an extensive system for spawning vegetation. It uses rules for procedural generation, height, steepness, noise, terrain textures, masks etc.

    It also has a run-time masking system using polygon mask area and lines. This allows you to mask out areas for roads, houses etc. These can be stored on prefabs and are applied automatic as you add items to the terrain. Have a look here for more info.

    The spawning can be done multi threaded at run-time or pre generated in editor time by baking the results to a persistent storage.

    When moving the camera around the map an internal cell structure is culled based on the camera viewpoint. Visible cells are loaded and the instance data stored on a compute buffer on the GPU.

    A compute shader is then used to merge instances of a kind to a single append buffer on the GPU. Next another compute shader is dispatched that does frustum culling for each grass patch. This to remove partial visible cells. It also does LOD selection and splits up the instances to separate GPU buffers for rendering.

    finally the grass is rendered using Graphics.DrawMeshInstancedIndirect.

    The entire render process, merging cells, frustum culling and LOD selection is done on the GPU.

    Have a look at the website for videos and more info. All documentation is online.

    We also have a skype and discord chat for users, it is a good place to ask questions. There is a link on the first post in this thread.

    Lennart
     
    ScourgeGames and mattis89 like this.
  48. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    Thank you for the detailed description,
    One question:
    Regarding to using a compute shader(I assume you are using drawmeshIndirect), is it possible to toggle between draw mesh indirect and drawmesh direct(up to 1024 instances for same vegetations).
     
  49. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. again.

    yes there is a setting. For each vegetation item(tree, grass, plant) you can select between Normal, Instanced and Instanced indirect.
    • Normal uses the DrawMesh call. This is expensive on the CPU side since there is one call per instance. Depending on the mesh/material/shader it might still instance or dynamic batch. Unity does this in some cases
    • Instanced batches together lists of up to 1023 items. Per item LOD selection is expensive when preparing lists on the CPU. The "distanceBand" of the cell culling is then used to select LOD. For trees and optional for objects and large object (setting) per item LODs are calculated on the CPU.
    • Instanced Indirect. As described in the last post.
    You can mix this between different vegetation items.

    Lennart
     
    FuzzyShan likes this.
  50. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Can you find me on the discord server? lets try to debug. From the error log it looks like a problem with a prefab you added.

    Lennart
     
Thread Status:
Not open for further replies.