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. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    What Can I do to help you to help me?

    Cheers

    Roy[/QUOTE]

    Yeah agree with @magique. See what the profiler is saying. It is more likely the draws, triangles more than any overhead from VS. Lowering the LODs, Billboard range should help some.

    Also, have not tested the difference with VS yet but switching to Deferred if you are not using it already might help.

    Any lighting differences between the two scenes? Enlighten? Real-time Reflection Probes?
     
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. sent you a PM with some questions about your setup.

    Lennart
     
  3. the_nomad

    the_nomad

    Joined:
    Jun 22, 2013
    Posts:
    15
    I wondered about screen-space shadows, but I've always found them a big of a nightmare to get working in VR. I'll give that post-processing stack a stab and see how it does - thanks for the tip!
     
  4. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,026
    Vegetation Studio + Advanced Foliage Pack + Upcomming trees sneak peak 2:) soon I will make movie. FPS are just great!

    Everything made by 1 VS profile which handle:
    - swamp
    - meadow
    - forest
    - forest swamp

    3.jpg 4.jpg
     
    malkere, boysenberry, x4000 and 10 others like this.
  5. StormchaserZA

    StormchaserZA

    Joined:
    Nov 13, 2016
    Posts:
    30
    Advanced foliage and Turbo's grass :)
     
  6. LennartJohansen

    LennartJohansen

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

    I am working on finishing an update for Vegetation Studio. In addition to bug fixes and some adjustments to GUI and features I have been working on integration with other assets and shaders.

    This includes, tree creator, CTI tree shaders and other.

    I will post the changelog here when I push the new update.

    In addition to this I have made a public GitHub repository with a modified version of the Unity Speedtree shaders.
    It is under MIT licence. You can find it here.

    It will allow you to use speedtree grass with Vegetation Studios instanced indirect implementation.

    To set up download the files from github to your Unity project. Make a prefab of the Speedtree grass and change the shader on all LODs like in the image.



    Then add the prefab as normal to Vegetation Studio and set the render mode to Instanced Indirect.



    Go to the Render tab of the Vegetation System component and make sure compute shaders and GPU culling is enabled.



    The Speedtree grass should now work with instanced indirect.

    Lennart
     
  7. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Finally I bought it and I have to say this asset is worth it! I just use it for grasses and plants and just for that, it is already worth.
     
    LennartJohansen and MortenGulden like this.
  8. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Not Bad, but sometimes you should go in the forest ;)
     
  9. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @LennartJohansen

    I think it would be a good idea to put this link together with this mini tutorial on how SpeedTree is done in the first post. It would save a lot of time in the future when we want to look for the link and how it was done.

    a greeting
     
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Good idea. I will add the link.
    It will also be a guide under Guides on the website where all the documentation is located

    I am working on a new framework to register 3rd party shaders.
    It will allow shaders to register as alternative shaders for others. If you have this installed or maybe the Alloy speedtree shaders Vegetation Studio will show these as alternatives to speedtree when you drag and drop one.
    Just select the shader from a drop down list.

    It will also allow shaders to expose settings to the UI and those are serialized and saved to the Vegetation Package.

    The shader class is found using reflection. Any asset can include a description class like this.

    Lennart
     
    jlocke and blitzvb like this.
  11. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @LennartJohansen

    It would be great to be able to use the Asset InfiniGrass Shader, but there is the problem that the InfiniGrass shaders do not seem to use instanced indirect implementation.


    Would there be any way to solve this or it is definitely impossible? Even you could talk to the creator "nasos_333" ... he is very attentive

    regards
     
  12. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Hi @LennartJohansen Does this update mean you are closer to having a solution to get tree fading working?
     
    ftejada likes this.
  13. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I have not tested the shader, but if it works with Vegetation Studio in the normal Instanced rendering it is probably 3 lines of code in the shader to add indirect support. Send me a private message if you want me to help you try the upgrade.
     
    ftejada likes this.
  14. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Not yet, this is an earlier step that I want to finish first. It basically gives the option to make a shader description class telling Vegetation Studio about capabilities of the shader. If it has instanced indirect support it will default to that when you add a prefab.

    Also expose settings to the user that saves with VS settings. You do not need to adjust it on the material of the original prefab. You can add the same plant prefab 2 times and adjust color tint or other settings on each without changing the original.
     
    Mark_01, Lars-Steenhoff and Baraff like this.
  15. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365
    Sorry I didn't read your post properly

    I've checked everything like that even replacing the terrain with just one texture version etc.
    I've sent profiler and information to Lennart who is helping.
    I think I'm waiting for upgraded shaders for the Tropical Forest pack that will support the instanced Indirect rendering of Vegetation studio for the plants. Although I have no idea what impact that will have.
    I'm hoping that is my missing piece that will drastically increase my FPS
     
    x4000 likes this.
  16. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Not perfect, but working on it.

    beach.jpg
     
  17. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365
    hi magique
    I’ve been communicating with Lennart via PM passing information about my setup and receiving advice sugestions back. My gut feeling is it’s going to be great – awesome infact it’s just very new and will take a little time for 3rd party assets to catch up, I think.
    I’ll do a post when I make some significant progress to try help others.

    It’s a very novel approach and I may be wrong but this is how I think it works:
    Rather than place lots of vegetation then reduce / cull it based on parameters Vegetation Studio draws the vegetation based on rules But only when you look at it.

    At first it doesn’t seem much of a difference but it really is, because the vegetation doesn’t exist untill you look at it, What the vegetation looks isn’t predetermined, How big it is, How much of it there is, whether its actually still there, whether its been flattened by a car wheel, Whether its got Autumn leaves or bare branches with snow on. It all can be decided when you look at it, and that’s a game changer IMHO.

    Roy
     
  18. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @nomax5 , Yeah it's pretty awesome. I really love it.
     
  19. froslie

    froslie

    Joined:
    Apr 20, 2015
    Posts:
    18
    Wonderful Asset!

    I have an issue with builds... maybe someone can explain if it has something to do with instances. When I build everything in the build works/ looks great on the machine I'm building on. When I run the build on a different machine, the build runs fine, but everything vegetation studio adds does not not show up! Any thoughts would be greatly appreciated.
     
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Do you get any error message in the log?
     
  21. froslie

    froslie

    Joined:
    Apr 20, 2015
    Posts:
    18
    [I'll check the log on the machine with the standalone. Unfortunately, I can't do this until Monday because it is in museum where I'm installing the project.]

    No (not in editor console at least). I need to check the machine I'm running the build on... is that where you mean for me to check the log?

    Thank you for the quick response.

    Also, want to say again that I love this asset!
     
    Last edited: Dec 15, 2017
  22. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I have a guess on this. Vegetation Studio includes a c++ dll to speed up spawning. This is faster than the c# version of the code that is used in the editor. This is compiled with visual studio 2015.

    This needs a c++ redistributable that most computes have. You can download and install this from here.
    or if you want to skip the dll you can add this define to player settings.

    VS_NO_HEIGHTMAP_DLL

    It will then use c# code to sample the terrain heightmap for height and normal that is a bit slower.

    I will add this to a install guide on the website.

    Lennart
     
  23. froslie

    froslie

    Joined:
    Apr 20, 2015
    Posts:
    18
    Okay... this sounds like a promising solution. Thank you!

    I'll test it out and let you know.
     
  24. StormchaserZA

    StormchaserZA

    Joined:
    Nov 13, 2016
    Posts:
    30
    Lennart... VS just simply rocks! I still cannot the plants to bend :(

     
  25. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Add the TouchReactCollider script to your character. But with bending you won't be happy yet...

    @LennartJohansen

    Bending is too primitive yet. We need some bending animations (e.g. for StormchaserZA, grass shaking) and additionally an over time bending for tracks. Slowly bend back the grass over time. (please not the trail renderer solution, I will have a lot of vehicles). There are some assets which can do this much more better. What we have yet is, the grass is instantly down und up. I belived it doesn't worked all the time...
     
  26. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Hi there,
    First, I love this product, thanks for your effort!
    I am using Vegetation Studio with MapMagic and am having a problem with getting the Vegetation System to replicate properly. Right now it only clones once, and right under the initial Vegetation System that is a child of the root terrain.
    I am thinking to move forward just manually copying the Vegetation Systems to each terrain. I am having a similar issue with using MicroSplat as well, with no firm date on when it will be integrated. So pinning terrains would seem to be what I am stuck with for the moment (I might be using Sector Complete to deal with that part).
    My questions are, am I going to be okay manually adding the Vegetation Systems to each terrain and should I still add the MapMagic plugin (I assume it's not needed if I am placing it manually, right?
    Thanks in advance,
    Boysenberry Payne
     
  27. jlocke

    jlocke

    Joined:
    Dec 16, 2017
    Posts:
    62
    Hey .. just joined Unity galaxy .. I come from Cry and Unreal world . nice to see your tool @LennartJohansen
    i was a bit disappointed by the existing diplacement system in terrain . .so nice to see your
    Question ? We work mostly with meshes .. Does you support that ? ..If now . what is your ETA for that ?
    Cheers.
    John
     
  28. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. For the next weeks I plan to focus on fixes, smaller feature changes and 3rd party integration. I think in the middle of next month I have time to start protoyping mesh support. Supporting a mesh terrain created from a terrain with a regular grid would be easy to implement, then I could use a heightmap and the same code as for terrains to sample heights and normal for spawning rules.

    But I think this limits the use and makes the workflow a bit hard. I will start with a general mesh sampler using a k-d tree that can be used multi threaded. I think this should be fast enough for general sampling of meshes.

    I did a post a couple of weeks ago about mesh support. You can find it here

    Plan is to do the general mesh support at the same time I do Terrafirma support. They will be implementing the same interface.

    Lennart
     
    ftejada and BackwoodsGaming like this.
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    There is a plan to extend this. Next step would be to add a double buffer and run a compute shader pass on it to pass data from the last pass. Adding in a timestamp to the buffer changes will allow the shaders reading this to calculate slow move back at different speeds depending on the material.
     
  30. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    It should be working with the setup in this guide. You need to make sure the main terrain is pinned for this to work, or you would loose the reference to the VegetationSystem object you are instantiating from. An alternative would be to make a prefab in the scene and use that as a source.

    if you still do not get it to work, send me a private message and we look at your setup. If we find any additional steps needed I can update the guide and post here after.

    Lennart
     
    boysenberry likes this.
  31. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Your plan make sense and sound great even though it means, I have to wait to add VS to my game.
     
  32. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Sounds good.

    Is there a possibility to instantiate prefabs in the scene with your placing feature? I read something about it in your documentation, but when I switch in edit mode in runtime, I don't see the vegetation, so I cannot check it yet in this way. It is not a feature request, just a question. I also read about that it gets LOD if prefabs are instantiated. Are these then normal GameObjects in the Scene?
     
  33. LennartJohansen

    LennartJohansen

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

    Let me try to explain how it works.
    When you add a tree or a plant/grass prefab to Vegetation Studio it will be analyzed. Meshes and materials are loaded internally. Then as you move the camera around the terrain vegetation instances from the persistent storage and the run-time spawning are loaded.

    These instances only exist in memory as Matrix4x4 structures and an type ID. These instances are then combined on the CPU or GPU depending on render mode and finally rendered in big batches using the Instanced and Instanced indirect API.
    Except for the original prefab they do not exist as GameObjects. This way is much faster than having Unity handle the huge amount of GameObjects it would be. LODs is handled the same way, based on camera distance the correct mesh and material is decided in CPU and GPU.

    Next we have colliders. These do exist as GameObjects, but only for the trees close to the Camera. The ColliderSystem component is handling all this. There is an event you can connect to if you want additional scripts on these GameObjects. Harvesting etc.

    There is also a component called RuntimePrefabSpawner. This is designed to allow you to add effects or any other prefab to any tree, rocks etc. This could be falling leaves or anything else. These objects are created the same way Colliders are when close to the camera.

    Have a look here for more info.

    Lennart
     
    boysenberry and Mark_01 like this.
  34. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Just a quick question and excuse me if this has already been answered, but is this suitable to just replace the current tree system (without setting rules etc.) in order to get better performance than with Unitys built-in system?
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    If your mesh terrain is generated from a Unity terrain then you can still use VS, but it just means you keep the Unity terrain in the scene and just turn off the rendering so only the mesh shows.
     
  36. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    Please advise what the benefit is of generating a mesh from a terrain? Thanks!
     
  37. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Some have reported that a mesh terrain renders faster than Unity's built-in terrain system.
     
    turboscalpeur likes this.
  38. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    I must have read and followed that 15 times and it didn't work. This time it did. I followed the step religiously this time, so maybe I did something in the wrong order each time before. Either way it's working now, thank you!

    I would still like to know if there is a way to do it with pinned terrains. I am using between 9 and 16 terrains for each scene. Right now I am using MicroSplat and it's not liking the MapMagic system yet (or more accurately the other way around). I am seeing if I can get the MapMagic developer to help out with a solution, but its looking like a solution is a ways out. I am going to talk more with the MicroSplat developer as well to see if I can figure something else out, but right now I am looking at having to use pinned terrains and another asset Sector Complete to manage enabling and disabling the terrains. A big headache. I can't wait until multiple terrains are in common use.

    With that being said am I going to run into difficulties with Vegetation Studio and 9 to 16 pinned Terrains? Do you have any suggestions of how to keep my vegetation from overwhelming the CPU/GPU? I am just trying to avoid going down a path only to find out it doesn't work after many hours of development.
     
  39. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    I some more questions.

    How do we handle integration of POI pinned terrains with the MapMagic plugin? Can I just manually copy a cloned VegetationSystem to any pinned terrains?

    Also, can we use a terrain other than the terrain at 0,0 as our 'root' terrain?
    (I already tested this and yes we can).
     
    Last edited: Dec 16, 2017
  40. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I will explain tomorrow when I am back to the office.

    Lennart
     
    boysenberry likes this.
  41. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Thanks for your answer! However, I can use it for grasses, bushes. Placing my own trees is not that much work, at the time I have 1-2 prefab placer tools. Maybe I will find for my problem a procedural prefab placing tool. What I get with this asset is absolutely enough. And it is fast, hardly needs GPU and CPU!

    Used assets: MicroSplat (terrain shader), UWS (water), UniStorm (day/night/weather system), Vegetation Studio (procedural vegetation placement), HQGrassVol1 (grass, bush, plants), HQGrassVol2 (grass, bush, plants), Extreme Flora (just for under water). Cannot refer asset for terrain textures. These assets are just for the 3D environment that you can see.

    River.jpg
     
    Last edited: Dec 17, 2017
    turboscalpeur, Rowlan and boysenberry like this.
  42. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    According to the latest quantum mechanics theory, "nothing" exists until you look at it.

    Just saying ;)
     
    FargleBargle, Mark_01, Rowlan and 2 others like this.
  43. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365
    LoL I had the same thought when I wrote that line.
     
    wood333 likes this.
  44. LennartJohansen

    LennartJohansen

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

    You can import existing trees from the Unity terrain. You add a new Vegetation Package and a Persistent Storage.
    Then on the import tab of the persistent storage you select the TerrainTree importer. That will set up the tree prefabs in Vegetation Studio and import the tree instances from the Unity terrain.

    More info here.

     
    boysenberry likes this.
  45. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Good it is working now. For pinned terrains you do not need the helper script. Just duplicate the VegetationSystem component, one for each terrain and assign a terrain to each. They do not have to be children of the terrains when done like this.

    VegetationSystems controlling terrains outside of the visible range of vegetation take close to 0 CPU/GPU but it still keeps a copy of the heightmap and splatmap in memory. Unity does not allow multi-threaded access to the data using the TerrainData API.

    Depending on your setup and terrain size an option could be to keep a pool of VegetationSystem objects and re-use these. There is a HotswapTerrain function that allows you to do this on the VegetaionSystem component. It requires a terrain of the same size but is faster than initializing a terrain from scratch.

    Lennart
     
    boysenberry likes this.
  46. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Yes. Look at my answer to the other post.
     
    boysenberry likes this.
  47. LennartJohansen

    LennartJohansen

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

    Looked at the imaged in your post and the plants in the water.

    If this was an ocean you could fix this with setting the sea level on the setting tab. All vegetation min/max heights are relative to this.

    This seems to be a river, the easiest way is to create a VegetationMaskArea component and add the outline of the river to this. That should remove any plants in the river. Have a look here for more info.

    Lennart
     
  48. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Thanks, but they are water plants, placed them attentionally under the river level... Maybe I should look for some better models. The river vegetation is made by a real life african river vegetation document. I did my best I could ;) From my side, no error on the picture, everything looks fine, looks good.
     
    Last edited: Dec 17, 2017
  49. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Does this mean I can do things like place my trees initially with something like MapMagic then after they're up spin up the VegetationSystem to "gobble them up" into VegetationStudio to do it's magic with the rule's it has setup?
     
  50. MortenGulden

    MortenGulden

    Joined:
    Mar 15, 2015
    Posts:
    19
    No, they get imported into the persistent vegetation storage. So you get the speedup from VS and can move them around individually afterwards, but you need to place them with VS from scratch if you want to modify their placement rules interactively with VS.
     
    boysenberry likes this.
Thread Status:
Not open for further replies.