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
    We are adding more functionality to Vegetation Studio with a new component.

    RUNTIME PREFAB SPAWNER
    The Runtime Prefab Spawner component is designed to instantiate prefabs related to the trees or objects in Vegetation Studio. It allows you to assign a prefab to a Vegetation Item. When the item is within range of the camera an instance of the prefab is created at the excact location of the item. This item will be removed automatic when item is out of range again.

    The use case of this could be to add effects like falling leaves, insects at flowers, sounds from the old tree, harvesting logic etc. The prefabs can have any scripts attached.

    This approach allows you to add special functionality to large amounts of vegetation items with no extra overhead of culling and processing the effect gameobjects in the hierarchy.

    You add it to the GameObject with the VegetationSystem component and configure. Multiple components is possible.

    see https://www.awesometech.no/index.php/runtime-prefab-spawner/ for more info.





    In this example video we added a particle system with falling leaves and attached it to one of the trees.
    The effect is falling leaves on all the trees of that kind. Run-time created when within range of the camera.
    You can set the spawn frequency or add your own logic in code.
     
  2. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Wow, that's really an incredible feature. Amazing work!
     
    LennartJohansen likes this.
  3. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Thanks. It will be fun to see what people use it for. I am thinking use cases like harvesting systems, landing spots in trees for bird flocks. Firefly swarms around certain plant types. Maybe only at night. The prefab could read time from an environmental system. Plan is to also add an event where you can do your own custom logic if the prefab should be spawned or not. Also a built-in pool system to reuse the prefab instances.
     
    ftejada, one_one and tapawafo like this.
  4. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Pooling would be killer! It'd solve a little obsession of mine which is using pooled spatialized audio sources around trees that play the sound of wind-through-the-leaves - a feature I've been toying around with for a while now. Sounds like a small addition, but it'd really add a lot to immersion, IMO, especially for VR. Can't wait to get my hands on this! :)
     
    MortenGulden likes this.
  5. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Random encounter, spawn a trigger that trigger an ambush events base on the current state of the world randomly :cool:.
     
  6. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Great feature! Will it be possible to assign this to every x'th instance instead of every one?
     
  7. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    There is a frequency setting 0-1 that is the chance if the Item getting a the prefab instanced. You will also be able to extend this with some custom logic yourself. The frequency is based on a seed and will be the same between sessions.
     
    one_one likes this.
  8. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    As a test I added a sheep from HerdSim as the prefab to spawn. Lowered the frequency and set the offset to the side of the tree. In addition to this I added run-time colliders to the Tree Vegetation Items to keep the sheep from walking into the trees.

    Also added a TouchBendCollider component to the prefab to keep grass from growing into the sheep while sleeping on the ground.

    Easy setup and some random animals in the forest.





     
    ice2011, ftejada, antoripa and 14 others like this.
  9. Killersan

    Killersan

    Joined:
    May 27, 2014
    Posts:
    76
    The only question is when and why so long we have to wait for it :)
    I'm really interesting of the performance. Did You make any tests ?
     
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I still think we are 2-3 months away from a release. We need more testing with different use cases first. Development is going good. Roadmap and changelog is updated several times a week on the website.

    Really happy with performance. We are making a public demo now. Same as Unity used at Unite in Amsterdam last week when they demoed Vegetation Studio. I will add FPS, memory use etc. and a some run-time settings for you all to play with.

    Plan is to have that out at the end of the week.
     
  11. LennartJohansen

    LennartJohansen

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

    We have finished the support for curves for height and steepness when spawning vegetation. There is now a simple mode where you can set a min/max height and the advanced mode where you define a distribution curve.
    Same options for terrain steepness. These can be combined if you want.



    There is a heatmap preview mode for the terrain. You can turn this on and real-time see the spawn areas and density while you adjust the curves or min/max values

     
    ice2011, antoripa, tapawafo and 8 others like this.
  12. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Vegetation Masks

    We have extended the Vegetation Mask components a bit. In addition to the normal use of masking vegetation for houses, roads etc. the additional range parameters are now changed from a distance value to a range. The area in this range is used with a perlin noise to create a more natural falloff from the mask. All distances and noise scale can be configured per Vegetation Item type.

    with the min/max values of the range set to the same value the mask will give a hard edge like before.




     
    antoripa, Olander, tapawafo and 4 others like this.
  13. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Looks great! How do you handle vegetation mask overlap?
     
  14. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    The masks are basically set to include or exclude vegetation.
    If the vegetation type is excluded in any of the overlapping mask is will be removed from the terrain.

    on top of this any mask can be set to include one or more vegetation types. If you want a line trees by a road. Hedge, farm area etc.

    This included vegetation will follow any rules set up on the vegetation item. height, steepness, distribution, noise etc. within the area but will not be culled by other masks.

    In the example image here I have 2 masks overlapping. Both are set to remove all spawned vegetation, grass, plants, trees etc. In addition to this one of the masks include a custom VegetationItem.

     
  15. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Nice! Glad to see the features seem to be well thought-out.
     
    LennartJohansen likes this.
  16. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I have a few screenshots to share. Made by one of the beta testers. Looking good :)





     
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    As a beta tester I just wanted to say that this is already far and away the best vegetation system available for Unity. Nothing else even comes close. I'm thankful for Lennart making such an amazing asset and being so responsive to ideas and fixing bugs. This is one of those must have components for any Unity game that needs vegetation.
     
    antoripa, TeagansDad, Olander and 7 others like this.
  18. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    How can I get access to the Beta?
     
  19. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will send you a private message.
     
    antoripa likes this.
  20. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    We're already using other tools to place grass and bushes, but definitely need a better vegetation rendering system than stock Unity grass/detail objects (e.g. faster, prettier). Will this be suitable for our situation?
     
  21. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Currently Vegetation Studio needs to spawn the grass and plants based on rules set up in the system. The vegetation is spawned run-time on demand as the camera moves around the terrain. For large terrains this could be millions of grass patches. This vegetation is also controled run-time from the vegetation masks, to make room for roads, houses etc. Terrain size does not really matter when spawning on demand.

    There is also a general denisty setting that needs the run-time spawning. You can lower vegetation density on low end hardware or increase it on high end machines.
     
    Tethys, antoripa, Olander and 3 others like this.
  22. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    That is really cool and definitely more apropriate for best performance. But still, would it actually be possible to convert existing grass more or less accurately? I understand if not, seems a bit half-hearted to me...
    But it sometimes is better to use masks generated with a terrain generation software. For example, given we have a terrain with multiple biomes, tell the vegetation system to spawn different grass settings in different biomes through a mask and fade in between these settings to get a rather smooth transition? Or use other kinds of large-scale global masks to remove vegetation?
    Seneral
     
    antoripa likes this.
  23. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    I'm not super concerned with manually placed grass, but more manually placed trees - will it be possible to do such a thing if everything is rule based?
     
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    You can always place trees manually as usual. Either as just objects or on Unity terrain. Unless I'm missing something that Lennart can clarify.
     
    antoripa likes this.
  25. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Since trees are a much lower quantity than grass and plants it is easier to manage. We have been talking about a "baked tree mode" where you freeze the tree rules and bake this to a persistent cache. These trees could then be moved, deleted or even change its type. An inspector with sceneview handles could allow you to move and rotate trees close to the sceneview camera. I could even see a location based tree API working with this. Query for a tree. delete it. change to a tree stump etc.

    with a persistent cache like this there would be no problem to fill that manually. Make a component that reads the terrain. Other tools could feed in positions etc.

    But this is still on the drawing board, exactly how it should look is not decided.

    Until then adding a few trees here and there as gameobjects, around the city etc. will not affect your performance much. It is the big quantities of trees that kills performance.

    In addition to this you can use the Vegetation Masks to add custom tree areas. If you need a line of trees by your road side. An apple tree garden etc. These masks have no run-time performance hit. there is not a problem to add many.
     
    Last edited: Jul 6, 2017
  26. Dark-Muppeteer

    Dark-Muppeteer

    Joined:
    Feb 24, 2013
    Posts:
    26
    This is looking pretty awesome already, if you need any more beta testers I'd love to give it a go.
    I'm currently working on a few different environments for a VR wildlife exploration game.
     
  27. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Really interested in seeing what Vegetation Studio has to offer and in what it differs to spawners like GENA for example. Would be prould to be able to beta test if possible ofc.

    Will trees like Speedtrees using your rules be spawned as Unity Trees or Prefab / Meshes? Just asking because thats important to know when working with Weather / Season scripts and you want to change tree models on runtime for different seasons like Winter Speedtree model, Summer Speed Tree model etc. This is normally only possible for weather scripts if trees are spawned as Prefabs and not as Unity Trees.

    Cheers
    Ronny
     
    Last edited: Jul 7, 2017
    antoripa likes this.
  28. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I'm having a hard time finding any downside to this asset, looks like a game changer. Will Vegetation Studio support something like mask blending? For example, I see that splatmap control is a main feature, but if I wanted to use a second texture to effect runtime spawning around the main camera (e.g. radial gradient; such that object density decreases as eccentricity increases), would this be possible?
     
    Seneral likes this.
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Actually none of those. The speedtrees only exist in a memory structure that is fed to the GPU using the instancing API. I manage the internal culling and render the trees needed. This removes the overhead of culling individual trees and the GameObjects in the hierarchy. If you want to do season based tree preab switching this is a built in function in Vegetation Studio. You prepare multiple VegetationPackages, summer, fall, winter and assign the seasonal trees. Other vegetation can change also. You can switch between these packages run-time.

    This video shows the principle. as you see when season change the trees are replaces with fall or winter trees in the excact same position. As long as the positional spawn rules are the same this will happen. There is a blink when seasons change, but does not happen anymore. Old video.

     
  30. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    you will be able to use other texture masks to controll the spawning also. This could be noise maks, textures with color areas to get grouping of rocks or trees, distribution of plants or flowers in areas etc. There will also be a possibility for you to add a custom class with your own texture mask logic. Even expose UI elements into the system. We are implementing our own mask types this way. This masking system will be up and running in a couple of weeks. still missing some work.

    You want to have a mask that is positioned relative to the camera? While this could work in theory it would require a respawn of all affected areas every time the camera moves. It is not optimal for performance. Today the respawn of a "cell" only happens when camera first sees it or if it is excluded from the cache based on size and distance.

    If you help me define a real usecase we can give it a try...
     
    antoripa and buttmatrix like this.
  31. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    That sounds really great, I'll take the opportunity to look into the asset more thoroughly before I start making feature requests; I'm sure it's well up to the task.
     
    antoripa likes this.
  32. jakejolli

    jakejolli

    Joined:
    Mar 22, 2014
    Posts:
    54
    Any chance I can get in on this?
     
  33. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Send me a pm.
     
    antoripa likes this.
  34. RobsonFMaciel

    RobsonFMaciel

    Joined:
    Jan 12, 2013
    Posts:
    187
    antoripa likes this.
  35. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Well, this looks, er, awesome enough that maybe we should switch over to it for generating vegetation. So I may contact you about getting on the beta -- but one question first: Does it work on mobile, and any constraints there?
     
    antoripa and magique like this.
  36. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I had an early version running on a iPad Pro. framerate was not bad. I guess that would still work.

    Currently the requirement is Shader Model 4.5 and support for instancing. I guess some new phones could handle this.
    Depending on some tests the future requirement might be Shader Model 5.0. I am doing some tests on GPU based culling for Instanced Indirect rendering using Compute Shaders.

     
    ice2011, Malbers, buttmatrix and 4 others like this.
  37. AntonBertelsen

    AntonBertelsen

    Joined:
    Oct 13, 2014
    Posts:
    37
    This looks really awesome. I'm very excited :) - Sorry asking noob questions, but does the TouchBendBuffer support colour or is it greyscale only? - If my understanding of how the system works is correct, I think having colours would allow some really awesome things in regard to directional bending. (See e.g. this talk from GDC about tech in Uncharted 4:
    (11:43-11:53))

    Cool nonetheless :)
     
  38. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Right now the buffer stores the height of all meshes and colliders as seen from below. This allows us to sample the buffer and modify grass vertexes. The normal of the point is also in the buffer and could be used in a vertex shader to do additional functionality. This is probably something we will look more at later... Focus now is getting the current functionality ready for release.
     
    Killersan and one_one like this.
  39. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    309
    This looks really fantastic, a perfect tool to use on a virtual world project I'm making content for! I registered on the site, but didn't see any info about a beta - is it closed or is there somewhere I could sign up?
     
  40. looki666

    looki666

    Joined:
    Sep 5, 2013
    Posts:
    79
    Does it work fast with really big terrains ( 20x20 tiles (2048res)) ?
    Can i also test Beta .?
     
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Last edited: Jul 8, 2017
  42. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    How do you load the terrains? There is no problem with multiple terrains. You will need a VegetationStudio component for each of those, but these can be added run-time also. All using the same VegetationPackage (ruleset). When a terrain is out of visible range it has very little cpu cost.

    send me a pm about beta access.
     
  43. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    It works really well on large terrains :D
     
  44. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    I use MRLE to allow my players to create their own levels. Will vegetation Studio be compatible?
     
  45. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I have not tested MRLE but i had a look at the video now. I think you could get this to work with some small integration. If you prepare VegetationMasks on the prefabs your players can spawn the vegetation will adapt when you add them with the MRLE tool.

    You can set ut the VegetationPackage rules to not have grass or trees on the path texture etc. this will clear roads you draw in the terrain. On order to get this update done real-time as you draw you need to tell Vegetation System what area of the splat or heightmap that has changed.

    VegetationStudioManager has 2 static functions you can call. You will need to get the bounds of the changed area from the MRLE and call these function. One for heighmap changes the other for terrain texture changes.

    public static void RefreshTerrainHeightMap(Bounds bounds)
    public static void RefreshTerrainSplatMap(Bounds bounds)

    You can also change the vegetation rules run-time or add and remove plants but you willl have to serialize the changes yourselv to save and reapply when your user loads the game again.

    These update functions could be used with any 3rd party terrain edit tools to get Vegetation Studio to update live.



    There is also a scripting define symbol set: VEGETATION_STUDIO when VS is installed. For external terrain painting tools you can use this to integrate without the need of code present. This will automatically handle multiple VegetationSystems in the scene.

    #if VEGETATION_STUDIO
    VegetationStudioManager.RefreshTerrainSplatMap(changedBounds);
    #endif
     
  46. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    Wow, that's perfect:) Makes me want to integrate it into TC2 and my node painter extension, which works similarily already (also updates based on bounds). Great job!
    Seneral
     
    antoripa likes this.
  47. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    New tree placement with the help of Beta 2.8 Thank you Lennart.



     
    Last edited: Jul 10, 2017
  48. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    I may as well jump in here. Been working closely with Lennart on making certain that the lighting, color, and performance calibrations are in line. Lennart is a genius. Here is a nice calibration and performance test.

    Folks....I have my own system build by my own two hands....and it is very fast and efficient....and private. hehe. This vegetation system is smoking my performance and efficiency. It is also putting a direct answer to what I had none prior....with object based spawning (meaning no Unity Terrain stuff except Unity Terrain and Shader only) how to tackle the distance objects without killing performance. I have a solution but it is difficult to manage. This system just works....and does it amazingly well.

    System Specs: Win10x64, AMD Ryzen 5 1600 on an ASUS Prime x370, 16gb RAM, GTX1060 6gb

    Performance of AVS after current hard core optimization tests (Separated because of positional text type):
    *Unity Post FX Stack applied during testing :cool::) **Quickly tuned to my custom settings....not default.
    In regards to the testing of v2.7 Beta (private version) which is now the v2.8 Beta (which I have not downloaded yet). At no time during the following pictures did the FPS ever go below 89fps. In my own FPS code it averaged out at 10 frame rolling averages to 97.6fps. Prior to these optimizations and tuning I could get AVS to drop to almost 45fps. This is a very dense forest littered with grass....all of it reacting to the wind and light. :eek:o_O:rolleyes::);):cool:

    Ok...so...1st off to describe what is being shown in the pictures during performance testing and trying to => break <= and configure the system. Trees are SpeedTrees and @turboscalpeur grasses.

    1st Picture is deep in the forest...what we are looking for here is depth and propagation of the shadows. The shadows were adjusted to 0.75 so they do a nice job of appearing like they have a little light bleed. Also look here at the Bloom effect and how it performs very nicely in the transitioning from shadow/dark to light. Also look carefully at the perfect light blend from the top of the grass to the bottom of the grass. Remember....all moving at real time!

    2nd Picture is showing how the shadows are not tuned correctly.
    3rd Picture shows them tuned in to about as perfect as you can get. You will notice that the SpeedTree shadows are too much....but nothing AVS can do about that. Most folks will not complain.
    4th picture shows the shadow tuning with a material fix on the Unity Viking Building materials. The normal maps also need fixing but did not do this for the test. **I had to shrink the pic a bit to upload here.

    Enjoy...and thanks to Lennart. AVS test v2.7D.png AVS test v2.7F.png AVS test v2.7H.png AVS test v2.7E.png
     
  49. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    antoripa and Olander like this.
  50. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    Thanks Shawn. I have to say....this new Unity and 'some' of these new tools and tech can really make it actually 'feel' real. I think with decent handling Lennart's system here is just one of these 'things' that you just have to open your mouth and there is just nothing to say. hehe.

    I usually have plenty to say....LOL!! Not this time.
    Cheers
    O
     
    antoripa, Mark_01, pixelsteam and 3 others like this.
Thread Status:
Not open for further replies.