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

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Nice video. I can put it on the Youtube channel to make it easier to watch?
     
    antoripa likes this.
  3. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394


    Here is the video from sarum
     
    ice2011, manpower13, olavrv and 3 others like this.
  4. RobsonFMaciel

    RobsonFMaciel

    Joined:
    Jan 12, 2013
    Posts:
    187
    Amazing video. Congrats bro.
     
  5. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    i uploaded it on youtube first .. but it killed all the colors and details .. the one i uploaded above is much more fun i think
     
  6. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi - regarding Map Magic Support: If I'm already using Map Magic for all the Grass/Object placement rules. Can VS be used "just" for the performance improvements?

    Thanks
     
    LennartJohansen likes this.
  7. LennartJohansen

    LennartJohansen

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

    Currently you would need to respawn the vegetation with Vegetation Studio rules. Vegetation is spawned run-time as you move around the map. However we are working on a "Persistent Vegetation Storage" component that will allow 3rd party systems to feed in vegetation locations. I guess it would not be that hard to make a MapMagic node that feeds its output to this new storage.

    Vegetation instances stored in this storage can be combined with VS run-time rule vegetation and will also adapt to VegetationMasks on houses, roads etc.

    The Vegetation map magic spawns for you is GameOIbjects or trees in the Unity Terrain?
     
    Alverik likes this.
  8. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
  9. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    pcg, antoripa and LennartJohansen like this.
  10. LennartJohansen

    LennartJohansen

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

    We are adding some new features to Vegetation Studio.
    New to the next beta release is the Persistent Vegetation Storage component.



    It allows you to add manually placed and pre spawned vegetation to the terrain and combine those with the procedural run-time spawned rules.

    The instances are stored in a scriptable object that is added to the component. This can easily be duplicated and changed run-time.





    This storage can be filled in multiple ways:
    • You can bake the result of any Vegetation Item rule to the storage. Example use is when you are happy with the procedural placement of trees and want to do adjustments.
    • Manually add and remove using the built-in editor
    • Add/remove using the Vegeation Studio API
    • Spawn from 3rd party tools that will integrate with the API
    I did a small video to show some of the editing features. The brush painter shown at the end is not 100% working yet but will be soon.

     
  11. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Wow, really impressive! :)
     
  12. LennartJohansen

    LennartJohansen

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

    Small update on the Persistent Vegetation Storage component.
    I have added support a SouceID for the vegetation in the storage.

    With the source data it will be possible to clear only parts of the storage. You will be able to clear all items baked from the Vegetation Studio run-time rules but still keep any manual vegetation you added. If you move, rotate or scale any vegetation it will be flagged as manually added.

    I also added support for this in the API. 3rd party tools that integrate using the API can get their own ID and will show up as a separate named source.



    In the example image here you can see of the total 1.37 million items on my test terrain there is 1085 Confier trees where 2 of them is manually added or moved trees spawned by the rules.
     
    antoripa, mons00n and Alverik like this.
  13. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    sounds good :)
     
  14. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Finished the first custom importer to the Persistent Storage today, the Terrain Tree Importer.

    You can now import trees from Unity Terrains. The tree items are set up from the tree prefabs and stored in the PersistentVegetationStorage component.

    Import is a single click operation. It is pre configured with the default Terrain of the VegetationSystem.



    I did a test with a Unity terrain with about 10 000 trees. The imported trees has 100% the same position, rotataion and scale as the original unity trees but is rendered with Vegetation Studios custom culling, instanced rendering pipeline and billboard system.




    This is the original test terrain.



    And this the imported vegetation rendered with Vegetation Studio. Except for the vegetation rendering the scene is the same. Have a look at the fps and CPU use + setpass calls.
     
  15. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    low CPU time is beautiful
     
    Alverik likes this.
  16. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Adding another importer module.

    The SceneVegetationImporter will allow you to configure a ruleset to import vegetation/rocks etc that is in your scene as normal GameObjects. It can match all or parts of the GameObject name and filter for tags and layers.

    The found objects can be mapped to an existing VegetationItem in the sytstem or to a selected prefab that will be configured as an VegetationItem automatic.

    The rule set is saved as a scriptable object and can be re used later on other scenes and terrains.

     
    ftejada, Mark_01, ZoneOfTanks and 4 others like this.
  17. manpower13

    manpower13

    Joined:
    Dec 22, 2013
    Posts:
    140
    Amazing performance!
     
    MortenGulden and LennartJohansen like this.
  18. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I was asked about performance when moving fast in the scene.

    I did a video showing the profiler while doing some flying in the demo scene.

    This is using the new Persistent Vegetation Storage component.

    Recording is on my laptop while real time encoding to h.264 and the profiler connected to a standalone build. (also streaming the Apple press conference in a different window)

    1080p resolution.

     
    Alverik, Mark_01, iddqd and 4 others like this.
  19. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Do you have an estimate on release? Need this BIG TIME :D
     
    buttmatrix and ZoneOfTanks like this.
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    3 weeks more of beta testing and bug fixing. Then unity review. Could be more if some new issues show up.
    Still missing a couple of features I want to include for release.
     
  21. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Thanx man! 1st week of sales you're be a millionaire! :D
     
  22. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Estimated price? o_O
    Waiting for this solution too...
     
    llJIMBOBll likes this.
  23. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. We are looking at a target price of 95 dollar, but will do a nice launch promotion when it releases.
     
    Mark_01, Seneral, buttmatrix and 3 others like this.
  24. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    I saw in the first Persistent Vegetation Storage Video, that you removed some trees just by clicking on them. Did I miss the manually placing / removing of trees as a feature, that you always wanted to add, or is the Persistent Vegetation Storage exactly the drawing feature?
    So its possible to spawn the terrain full of trees and for fine tuning (without masks) you can remove trees on specific locations by clicking them? Persistent Vegetation Storage for me is just an irritating name for the manual drawing feature thats why I am a little bit confused :)

    Keep up the good work. I really hope you will calculate some time in video tutorials by so many features.
     
    Last edited: Sep 13, 2017
  25. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. All the rules for procedural vegetation in Vegetation Studio are by default done run-time. As you move the camera around the terrain it will generate the needed vegetation from the current view. The vegetation is using all the enabled rules, height, steepness, terrain textures, texture masks and more..

    Except for controlling the masks with the VegetationMasks that is used to mask out roads, houses etc you can not manually control the exact location of a tree with the procedural rules.

    This is where the persistent storage comes in. Using this you can manually add vegetation. It has a built in editor that allows you to add instances, paint grass etc. These manually added items exist together with the rule based procedural vegetation.

    In addition to this there is an option to "Bake" all the rule based vegetation. It will then generate the procedural vegetation for the entire terrain. You can do this for just a few or all vegetation types. The generated result is then stored in the persistent storage.
    When added to the storage it enabled fine tuning. you can move, rotate and scale trees. remove grass and plants with a brush etc. It also enables API access to change a VegetationItems type. Tree to a tree stump. Remove it or add a new.

    All vegetation added to the storage has a VegetationSouceID set. This allows you to clear items from specific sources. You can clear all generated trees of a type in order to re-generate from an updated procedural rule but keep all manually added trees. If you edit a generated tree the source switches to Manual.

    The Persistent storage also has an API for 3rd party system to spawn vegetation to Vegetation Studio. They can add new VegetationItems (types) and instanced to the storage.
    This way vegetation generated with these tools will get all the benefits of VegetationStudio functionality and rendering. These tools also get a unique VegetationSourceID that allows the user to clear only part of the storage if re-generating is needed.

    The storage also includes 2 import modules, one that imports trees from existing Unity Terrains and one where you can make rules to import vegetation/rocks etc from GameObjects in the scene. These importers are made using an interface, you can easily make your own.

    There will be videos explaining features. Plan is to start making these in a couple of weeks when the GUI for 1.0 release is locked down.

    Does this clear up things a bit?
     
    Alverik, Mark_01, Olander and 3 others like this.
  26. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Mega cool! :)

    Right now we are working on big online war game with tanks and planes.
    So my questions:

    1. How good this system if I fly above the terrain with plane speed?
    2. Can I destroy a three with tank so that other players see it (some interaction and tree fall animation)?
    3. We use Unet for network, so is it easy to make Persistent storage synchonisation in multiplayer game?

    By the way this system is exactly what we need to make a big online war game ;)
     
  27. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    1. Going hundreds of km/h close to the ground will increase the amount of new cells loaded, you can get to the point where you have multiple new cells per frame. The video I posted yesterday on the forum is moving at 108 km/h. I had a look at the camera controler code to check.

    If you are flying at a height larger than your vegetation/grass distance you are reducing this stress as only trees are loaded. At even higher heights only billboards will show and the loading stress is minimal. There is also an option to pre load billboards for the entire terrain.

    2. While you can remove/destroy a tree with a tank there is no built in automatic tree falling animations. What you could do in order to achive this effect is this.

    Vegetation Studio has a ColliderSystem component. This can be configured to run-time create colliders close to the camera/player. This will spawn GameObjects with colliders on all trees withing range (several range settings based distance bands in the culling system). You can connect to the create and destroy events on the collider system and add your own scripts to the collider objects. This way you can use your own code to detect your tank and trees colliding.

    If you detect a collision that would break a tree you use the API on the persistent storage to remove the tree. This will flag the current cell as dirty and refresh the vegetation automatic. You then instantiate a GameObject with the same tree that you have rigged to break with an animation, added a rigidbody to be moved by the collision etc. All depending on how your game will do it.

    The excact tree position, scale and rotation you can get from an info object on the object with the collider.

    3. The storrage does not have any internal network sync system. What you would do is to make your own RPC or Message you sync with Unet. You then send the RemoveTree and Instantiate falling tree to the other players using Unet and the clients removes the tree from the local storage.

    The persistent storage is using unitys serialization to save changes. Changes done to the storage outside the editor will not be saved to disk. If you want changes to stay between game sessions you will have to log all your remove tree calls and apply them to the storage again when loading your game level.
     
    Alverik, Olander, antoripa and 2 others like this.
  28. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    this is how you do a performance test when you don't know how to use the profiler :)

    HQ version (prettier)

    1l.png

     
    pixelsteam, Alverik, Olander and 3 others like this.
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    This looks awesome. :) Great work
     
    Alverik and manpower13 like this.
  30. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Looks very promising. I've yet to find a package that lives up to their promises in this area! =[ Would love to give it a try and will definitely pick it up on release. Let me know if you need a tester with some special veggy needs ;p
     
  31. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Small development update.

    I just added support for induvidial LOD setting for trees.

    Vegetation Studio will read the configured LODGroup on the tree to calculate the LOD distances.
    The QualitySettings.LODBias is then used combined with a per item LOD Distance Factor to get the final distances.

    This additional LOD distance factor allows you to fine-tune your lod settings without having to edit the LODGroup on the prefab.

    Changes are updated in the terrain direct.

     
    ftejada, Alverik, antoripa and 5 others like this.
  32. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    How would the mask performance be for a city-building game where you are placing 100+ buildings dynamically (though not at the same time)? A game like Anno 1404.
     
  33. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Nice looking asset

    I'm also very keen to get on Beta team to test this and give more feedback.

    From what I've seen, for now I'd give a few similar comments to what I gave AdamG on his original Gaia Beta group...

    1) Objects should be able to spawn with random delta (offset) transforms - ie trees are not always perpendicular to terrain or grid, or same scale, and this needs to be randomized. Thats full transforms - position offset, rotation, and object scale, also as sometimes you just want part of a rock or tree showing

    2) Also, those "delta" transforms should have "from" and "to" (min/max) sliders for the deviation from the root, and random values between those sliders chosen. Sliders are needed on a per model basis, as some trees can look ok at -50% to +20, others only at -20% to +20% etc

    3) all random values should be generated using a public seed value that can be networked - to recreate the same random values on other clients.



    4) Also ... it'll be nice to add things like "Nature rules": ie. "rules" that can be enabled based on things we see in nature.
    These might include some "mods" that community can make and resell if the mechanisms are there

    eg. Certain objects should have ability to be marked as flora attractors and attractees, or similar. eg. a large rock or tree. Often we find in nature erosion, water pooling, and protection from elements will cause soft flora to flourish and be really dense around those objects (but sometimes a bit less downhill due to swamping), so it'll be nice to see denser concentrations around these objects than in normal open fields (eg long grass).

    Or on higher hilly areas, the same trees as in meadows below tend to be smaller and proportionally thinner (mod scale) because it's more exposed, windier and rockier etc.

    5) There needs to be the ability for level designers to manually place the vegetation objects (so overide the spawn rules) but still be part of the asset features (distance rendering etc)

    Enjoy
     
    Alverik likes this.
  34. LennartJohansen

    LennartJohansen

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

    1. There is a rotation and position offset for each vegetation item you add to the system.
    For scale there is a simple mode with a min/max range slider but also an advanced mode where you can scale each axis individually.





    For rotation there is several options.

    • Rotate around Y axis.
    • Random on all axis.
    • Follow terrain mode that will rotate the object around the terrain normal at that point.
    • Follow terrain scale will also rotate arount the terrain normal but also scale the object to make it cover the extra area a tilted surface gives (the original sample distance is in x,z space)
    Plan is also to add a mode for tilted rocks and a mode for tilting trees. x% of the trees will be tilted from y to z degrees. This needs some changes to the billboard system, I will have to see how it turnes out.

    2. All settings described in point 1. is per item

    3. There is a seed you can set, this works for all random values and can be networked.

    4. There is a few tools included for this kind of scenarios.

    have a look at the VegetationBeacon component. This will attract the vegetation types you want to a location with a configurable falloff curve

    There is also textrue mask support, rules based on terrain textures in the splat map. VegetationMasks etc.

    You can also use the Runtime Prefab Spawner to add effects when you move into an area.
    Have a look here https://www.awesometech.no/index.php/runtime-prefab-spawner/ to see an example where a particle effect that makes falling leaves are spawned as you get closer to a type of tree.

    5. There is support for manual tree editing. There is a Persistent Vegetation Storage that can be used to manually add and remove vegetation. This works together with run-time procedural spawning. The procedural rules can also be baked to this storage if you want to have fine tuned control.

    Have a look at this video.



    There is also an API for 3rd party tools to edit this storage.
     
    Alverik and antoripa like this.
  35. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Thanks, I just looked through that all, that looks excellent.
    I never realized you had covered so much.

    I think that's very important, as one rock can effectively be reused by rotating and scaling it and pushing deeper into terrain etc.

    Re the billboard system ... are you storing multiple images of the object from many angles? Or just a few.
    Also from overhead?

    We had an excellent working system a few years back (in C++) for imposters, which stored pics from multiple angles (typically 12) which then blended the best 2 of those based on the view angle, so the shape exactly fits the tree shape and no "popping". It also stored 3D depth info of the object (tree) to generate accurate shadows from all angles.
     
    Alverik likes this.
  36. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    He's storing images from multiple sides. There is a '3D' option which captures the object from multiple angles, including top and bottom views.
     
    Alverik likes this.
  37. altfuture

    altfuture

    Joined:
    Mar 4, 2015
    Posts:
    3
    Some screenshots of our VR train simulation, Derail Valley.

    Amazing asset, wouldn't have been able to make the world so large and lifelike (and so quickly!) without it. 16x16km and all this vegetation was made procedurally from a ruleset.

    Also, this runs in VR!






     
  38. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Great thanks, is that 4 sides then, and probably a straight swap-out for the closest one?

    We found to have really seamless imposters (no 'popping') more angles (eg 12) worked well, like this old pic (2010) ...



    then blend the closest 2 to camera, and fade in as a 2D imposter (billboard) - so that the imposters shape closely matches the model from the camera angle.

    And save some depth info from the model to calc the shadow based on the angle too.
     
    Alverik likes this.
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The current "3D" setup of the billboards samples up to 64 samples of the tree from sides and top.
    The atlas can be up to 4k in resolution. This example is a 1024 image.

    And here is the normals.


    The planned next step is to switch from an atlas image to a texture array. The separate images will prevent any mipmap bleeding between the images and we can have less empty space. This will allow us to increase the sample count/angle to what we want, just at the cost of more DXT5 compressed images in memory.

    The billboards support shadows today. In the shadow pass the correct image selected from the directional light position is selected to give a correct shadow.

    I will give blending between the 4 closest images a try, see how the result looks like.



    Here is an example of billboards casting shadow.

    Lennart
     
    Alverik, Mark_01, antoripa and 2 others like this.
  40. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Thats awesome!
     
  41. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    The asset is promising. I have a question tough :D. How can one get into beta ? hehe.

    I am working now on creating some landscapes with World Creator 2 and CTS, testing realistic, cartoonish and stylized graphics :).

    For instance

    upload_2017-9-15_13-48-2.png

    And the biggest pain in the butt is to work with grass :). The core Unity system is awful :D. So i have high hopes for Your system :)
     
    malkere and antoripa like this.
  42. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Looks great! Does this system support tree interaction?
    Can I put codes on tree prefabs and execute them in runtime?
    Or just able to find the right tree through raycast against colliders?

    And one more question, if the trees can not execute scripts, is it possible to access the tree's database and let me some trees grow fruits by adding game objects to an offset position to each tree?
     
    Last edited: Sep 15, 2017
  43. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    1. Yes it does support interaction. any vegetation baked to the persistent storage you can acces using the API.

    2. The trees themself does not exist as gameobjects when they are rendered, but if you enable the ColliderSystem it will spawn run-time colliders for the trees as you get close to them. This component has an event that is called when a new tree comes in range or leaves. You can use this event to add any script you want to the collider object that is in the trees location.

    3. In addition to the collider system there is a RuntimePrefabSpawner component you can add. This allows you to instantiate any prefab in the location of the tree as you get close. This is destroyed when out of range.

    In this example a particle effect with falling leaves is created at a tree type.

     
  44. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great! Can't wait to see the actual workflow of this asset and definitely would love to try!
    And about foliage shaders, does it support Advanced Foliage Shader? This asset replaced unity's built-in deferred shader with it's own and it's own grass & tree shaders.

    Edit: another question: does the collider able to be made as trigger? Hence no physics colliding but can let me detect the tree and play a sound clip or something(like a bush pile, make noise when you pass through)
     
    Last edited: Sep 16, 2017
  45. LennartJohansen

    LennartJohansen

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

    1. I added the option to create the run-time colliders as triggers. But even if the vegetation system did not direct expose this setting you could easily have added yourself. The ColliderSystem Components has events that will be called at create and before colliders are destroyed. You can connect to these with a small script and do any changes you want to the colliders. You can also add other scripts/components to the GameObject holding the collider.

    Here is more info about the ColliderSystem component





    Here you can see the collider spawned as a trigger. Each object also has a RuntimeObjectInfo component. This has a reference to the VegetationItemInfo class holding all the spawn rules and info. This is for reference to allow you to check for what tree the collider is spawned.

    2. Most tree and and plant vegetation shaders should work with Vegetation Studio. They need to be able to support instancing to render. There is a fallback setting to draw vegetation with the Graphics.DrawMesh API but that looses all the benefits of instanced rendering.

    I did a quick test with a couple of plants from the lastest version of Advanced Foliage Shader. Just a drag and drop of the prefab to the VegetationSystem component. I also added the AFS Setup prefab to the scene to get wind working.
    I did not test anything more but the plants seemed to render good.



    The fern and the closest plant is from the AFS package.
     
    Mark_01, Alverik, Harekelas and 3 others like this.
  46. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    Do you have pre-orders?:eek:
     
  47. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Sorry, no pre-orders but the wait will not be long. Looking at the last few weeks of beta testing and a couple features to complete before I can submit to Asset Store.
     
    Alverik, Mark_01 and antoripa like this.
  48. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
  49. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Looking good:)
     
    Alverik and mwituni like this.
  50. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    i was testing the Vegetation Storage Component ... the trees were spawned in Gaia and rendered with Vegetation Studio :)
     
    ZoneOfTanks and AdamGoodrich like this.
Thread Status:
Not open for further replies.