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

    looks like 2 issues here.

    1. find the DistanceLODCulling function in VegetationSystem.cs
    add this line in the top.

    Code (csharp):
    1.  
    2. GeometryUtilityAllocFree.CalculateFrustrumPlanes(GetCurrentCamera());
    3.  
    there was a sync issue that could let a vegetation system cull the trees with the frustum of the last vegetation system.

    2. I do not think the billboards react to the "render direct to camera setting". I will fix this for the next update.

    Lennart
     
  2. LennartJohansen

    LennartJohansen

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

    Uncheck this checkbox on the terrain system. It should be turned off by default on vegetation packages with no textures.

    Lennart

     
    Harekelas likes this.
  3. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100

    So this can be used if i need cut down trees and then save cut down trees?
     
  4. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. To save cut down trees I would use another approach.

    To make trees/rocks that you can harvest there is 2 solutions.

    1. You create a GameObject with a VegetationItemMask or use the internal API to create just the c# object needed. This will remove the tree/rock

    2. If you have your vegetation baked in the persistent storage you can use the API to remove the tree instance.

    for both solutions you need to save your changes. I would make a small harvesting manager that saves the instances you remove. Save this to a file or database with your other savegame data and at load creates the needed VegetationItem masks or removes the trees with the persistent storage api

    The persistent storage itself is a scriptable object and those do not keep changes in standalone builds. There is a Save/Load from stream function implemented but it would probably be much less data saving only the cut trees...

    Lennart
     
  5. jmpedros

    jmpedros

    Joined:
    Jun 19, 2017
    Posts:
    11
    Hi, I have a big terrain split in different scenes and Im trying to use vegetation mask area for delete some trees around my props. I followed the instructions in the documentation but it didn't worked. I don't know what I am doing wrong. Could anyone help me with this?
     
  6. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Okay. If I can help before then with a Skype screen-sharing session, let me know. Would love to know if VS is viable for me sooner than later. I wonder if could be an AMD vs Nvidia issue?
     
  7. mzylak

    mzylak

    Joined:
    Jan 14, 2016
    Posts:
    8
    I have a big terrain (composed of 4 tiles) and I want to import exisisting trees. Each tile has the same tree prefabs. Is there any possible way to have 1 Vegetation Package for all tiles? I am asking, because every time, when I import trees in Persisent Vegetation Storage, tree prefabs automatically adds to Vegetation Package, even that they already exist in it.
     
  8. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Just imported the special Speedtree shader from github into my 2018.1.0f2 unity project and facing this error:
    Code (CSharp):
    1. 'UnityApplyDitherCrossFade': cannot convert from 'struct v2f' to 'float2'
    2. Compiling Vertex program with UNITY_PASS_SHADOWCASTER SHADOWS_DEPTH LOD_FADE_CROSSFADE INSTANCING_ON GEOM_TYPE_LEAF
    3. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    Can this be fixed please as it seems to break the instance indirect spawning for speedtree.
     
  9. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Did you download from the 2017.3 branch? I just tested in a clean project and got no error.

    Lennart
     
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I did an update to the importer now. The SceneVegetationImporter and the TerrainTreeImporter will now test if the prefab already exists in the VegetationPackage and use that.

    Send me a pm if you want a copy of the updated class to test.

    Lennart
     
  11. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Could you send me a pm with an screenshot of your VegetationMask setup? I can try to see what is configured wrong.

    Lennart
     
  12. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    This is on 2018.2 beta so just more of a heads up. Trying to remove a persistent storage package from the persistent vegetation storage component crashes unity. Reliably reproducible for me.
     
  13. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Thanks. I will give it a try. My guess is early beta issues, but I will look.
     
  14. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    I downloaded from the projects github frontpage as a zip file, shouldn't that be the latest version?
     
  15. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    You can select what branch to download. The default one is for Unity 5.6. There is another for Unity 2017.3 where they did some internal changes in Unity. Use this for newer Unity versions also.

    Lennart
     
  16. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Ah ok, thought the default (master) was 2018 version, my bad wasn't clear. Things got fixed with the version of the 2017 branch. Thanks!
     
  17. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I added some text to the main branch on github explaing this.
     
    cygnusprojects likes this.
  18. A2GStudios

    A2GStudios

    Joined:
    Nov 21, 2016
    Posts:
    52
    What will I need to do to get World Streamer to work with VS. Thanks
     
  19. jmpedros

    jmpedros

    Joined:
    Jun 19, 2017
    Posts:
    11
    Hi!
    On the left there's the object with the mask area component and on the right the vegetation item setup. I also tried to activate all remove options but didn't work.
    bug_vegetation_mask.jpg
     
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Multi terrain

    Hi. I added a couple of improvements to help with setting up multi terrain.

    • VegetationSystem components with auto select will first try to select any terrains in parent objects.
    • I added a Vegetation System tool window that will allow you to add vegetation systems to all terrains in the scene. There is 2 options. From a pre configured prefab with the vegetation system configured or a clean setup with the vegetation package you select. You will find the tool window in the drop down menu. "/Windows/Awesome Technologies/"


    Lennart
     
    gecko likes this.
  21. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The use vegetation mask setting you have on the item is used for vegetation masks that should include vegetation.
    The localized vegetation option. This is not used for normal exclude functionality of the vegetation mask.

    Try to uncheck this.

    Sending you a pm to help you configure the rest.

    Lennart
     
  22. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    For a basic setup you will need to set up a vegetation system object for each terrain in the scene. They can use the same vegetation package.

    If you add these as a child of the terrains they will load with the scene.

    Make sure the VegetationStudio object and the Touch react object is in the main scene.

    Lennart
     
  23. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    Will this will work with Map Magic without losing anything?one day i was bake things like underwater plants,rocks and some ground plants but thing is when i was doing it i had activated like 100 chunks of terrain i done like 20 chunks and bless god i was going to test how my scene look :) and then boom Map Magic activate (or generate ) terrain chunks thats are closest to me and they where not have my baked things...so all new generated terrains have plants only if i set them to runtime spawn...
     
  24. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    This is to speedup manual setup with multi tile use. If you are using the output node in MapMagic that is managing the VegetationSystem components as it generates terrains. This tool is not relevant for that?

    I guess if you have pinned terrains it could work, but I do not know map magic that well...

    Could you send me a pm explaining your setup a bit?

    Lennart
     
  25. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    the problem with map magic is that yes i use input for grass cuz its in magic way apply to grass just on grass texture :) other things like rock spawning and trees plants i want in specefic locations and its hard to figure out how to adjust nodes in mapmagic for my needs...i still cant even figure out how to tell mapmagic spawn rocks on height like 200-1000 its spawning all time 0-1000 ..same with textures ...even when i watch tutorial and do the same i cant get same output....some times its just take to much time....soi wanted to use veg.stud instead :) but again failed :/

    probably will try do something with Gaia..
     
  26. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    I'm really looking forward to this feature, but I might not want to add VS to all of them. Maybe allow users to target a terrain parent object and then add VS to all the child terrains.
     
    Last edited: May 29, 2018
  27. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I have some experiences using MM.
    For height selection, first output your final terrain height data into a portal node, name it the "Final Height"
    Then link this final height into a curve node, adjust the curve can give you a height mask in its output.
    Say you need rocks from 200 to 1000 and the max terrain height is 1000, then you start the first key as (0.19,0),then (0.2,1). Then preview it on terrain, you can see below 200 is all red, above 200 is all green. Use this mask direction as a input into your scatter node or use Blend node to calculate multiple masks together then link to scatter will make any rules you'd like.
    upload_2018-5-29_11-19-46.png
    This is my huge rock graph as a reference.
     
  28. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Added this. You can now select a root also.



    Lennart
     
    wwg likes this.
  29. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I purchased a pea plant on turbosquid, and added some to my scene via VS. They don't move in the wind. They were obj format, and easily placed by VS, but no movement.

    Can you help?
     
    Last edited: May 29, 2018
  30. dustinfreeman

    dustinfreeman

    Joined:
    Apr 9, 2015
    Posts:
    18
    I'm loving the beauty of Vegetation Studio, and trying to get it to work for a 360 Render. I have a very beefy machine, and the render isn't realtime, so I'm hoping I can turn off all tree culling. Currently, Vegetation Studio culls based on the frustrum of the main camera, like so, with the top view on the left showing where trees are rendered.



    We're translating this camera around as we render a scene flying over the landscape. This is rendered out to 360 Stereo Video using this package:
    https://github.com/Unity-Technologies/GenericFrameRecorder
    The results are that the culling still happens, although it is turned around, like so:



    We've poked around in Vegetation Studio settings, and haven't found a way to just turn culling off. There should be a simple answer to this, right? Our render is currently really slow, so we aren't expecting a performant solution.

    Thaaaaaaanks!
     
  31. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    i tried before with height node ... In preview i cant even see red and green ..i see something orange...and i set curve but i can still find rocks under water even when 100m underwater...
     

    Attached Files:

  32. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Sounds like it has something to do with the shader that's being used.


    I just bought VS myself so I'm unaware of exactly what shaders it uses to display "wind" vegetation (and am curious about this actually.) I've got a few "toon" shaders I'd like to use on the vegetation at some point.

    Also is there any plans for 2D vegetation support? I know this is for 3D, but it seems like (even limited) support for 2D is a must. D:
     
  33. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Two other questions (@LennartJohansen):

    1. How well would VS work with something like WorldStreamer (it does a lot of showing/hiding areas of the world too)?
    2. What about doing vegetation on non-terrain meshes? -- Is that supported yet? -- If not, any ETA on that?
     
    Ascensi likes this.
  34. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    My terrain using 25 tiles should I add 25 VegetationSystem to my game? It doesn't hit performance?

    I can't find what is the difference between VegetationStudio and VegetationSystem.
     
    Last edited: May 30, 2018
  35. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Your curve settings might be wrong, orange means a probability between 0 to 1.
    Make sure you understand the curve node means, use an input value and transfer into an output value according to it.
    Your height node gives the curve an input from 0 to 1 represents the relative height on each pixel of your terrain map.
    You use the input to decide the probability of appearance of rocks through the curve node. So if your sea level is 100 meters and your max terrain height is 1000 meters. And you only want rocks to grow about 100, the curve should look like this:
    upload_2018-5-31_10-51-33.png
    This means when your terrain height is 0.1*1000 meters or below, output 0.
    Then after 0.101 * 1000 meters output 1.
    This means your rocks generate probability will grow from 0 at altitude 100 meters, to 1 at altitude 101 meters.
    If you want the probability to grow smoother, enlarge the altitude range between 0 to 1, you'll get a better gradient transition.
     
    Aress28 likes this.
  36. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Vegetation has to be prepared to get wind and have a shader that supports it. Most vegetation shaders use the vertex color on the mesh to decide how the plant will bend. In most cases this have to be painted manually.

    Lennart
     
    wood333 likes this.
  37. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The culling system needs a frustum from a camera to select vegetation for rendering and the unity cameras does not allow for 360 degrees frustum setting.

    What you can do to fake this is to duplicate the VegetatonSystem Object 2 times. Then create 3 cameras with 120 degree FOV each rotated to see a different part of the 360. assign one camera to each vegetation system.
    These 3 cameras have to follow the position of the 360 camera.

    Make sure the render direct to camera setting on the Render tab is not selected.

    Your 360 solution should now be able to see all vegetation.

    Lennart
     
    Akshara likes this.
  38. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. When a VegetationSystem (terrain) is outside of visible distance for vegetation it uses close to 0 CPU.

    You need to set up a VegetationSystem component for each of the Terrains. These can share the same VegetationPackage for spawning rules.

    The next update has a tool for helping setting up, but it is easy to do manually. Duplicate the VegetationSystem object and assign one terrain to each copy.

    The root object VegetationStudio has a VegetationStudioManager component. You need one of this per scene. It handles sync between the VegetationSystem component, has an API for managing all of them and also Manages Masks.

    Lennart
     
    Crossway likes this.
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    1. You can add the VegetationSystem component as a child of the terrain and have it load with the async scene. Or manage this yourself and create a VegetationSystem instance when scenes load.

    2. I have it running in a prototype. I did a forum post a couple of weeks ago. I hope to have it in an update around Unite in Berlin.

    Lennart
     
  40. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    If you do not mind, could you open another thread for the MapMagic configuration? Just to keep this to Vegetation Studio questions?

    Thanks

    Lennart
     
  41. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    you can add Texture2D grass, plants now. There is also a GrassPatchGenerator tool included that allows you to customize meshes to use with Texture grass.

    Lennart
     
  42. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Got it, sorry for that :)
     
  43. LinKiri

    LinKiri

    Joined:
    Mar 28, 2016
    Posts:
    1
    Hi . I have a multi terrain scene. I use PERSISTENT VEGETATION STORAGE but can't paint on second terrain. It always on my first terrain. How to use it?
     
  44. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I've got a question: how can I mask out vegetation in persistent database?
    I want my building bases to mask out the grass in persistent database, should I use a touch bend component or a mask?
     
  45. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Regarding #2 -- that's awesome! -- I figured VS would support it at some point, but having a solid ETA really helps.


    Unfortunately #1 is going to need a different approach -- the way WorldStreamer works is that it loads (sometimes multiple) scenes/terrain simultaneously (depending on the area around the camera and how close you are.) They use the "ring streaming" approach for this.

    The problem is, I'm not sure how VS spawns its grass/etc., and if it simply spawns in a circle around the camera (or anywhere the camera can see). Either way there will be problems. For example, you will have bald-spots where the next terrain loads, OR you will have double the grass showing if your camera looks in the direction of another VegetationSystem. Another "curve-ball" to my problem is that I will be using chopped-up meshes for my terrain.

    I'm unfamiliar with the VegetationSystem's inner-workings atm, but perhaps a "queue" concept would be useful to prevent multiple VegetationSystems from overriding each other when the camera views them. A queue might spawn an empty gameobject that would transform into a full VegetationSystem (spawning it) just as soon as the nearest one has been told to disappear. Seems like something like this would probably need to be built into VS for proper behavior (considering that grass might be spawned twice in the same frame and performance could take a hit from this). Is there an elegant way to prevent this potential "double-draw" issue?
     
  46. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    99
    Hi,
    I get huge spikes in the profiler when I load a level that has 4 vegetation systems, when I rotate the player and each region comes into view. It's in VegetationSystem.Update(). Is there a way to "pre load" this maybe?

    Thanks!
     
  47. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    As I suspected -- this is apparently an issue with streaming different terrains, which I outlined in my post just above yours.


    It seems like VegetationSystems should take into account whether other VegetationSystems already exist (and are visible) and then perhaps combine the output (or divide the workload) of the more distant VegetationSystem into a single (dominant) VegetationSystem temporarily. Maybe VegetationStudio could just pick the VegetationSystem that's closest to the main camera view as the "dominant" system?

    This could help both with my streaming issue and prevent other users from having to manage VegetationSystems for themselves. Seems like this functionality should be built-in, especially considering that streaming terrain is such a big thing these days (and the fact that it does affect other users besides me). It will pretty much be mandatory too when "mesh" terrain is officially supported.
     
    gecko likes this.
  48. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I am out of the office today. I will answer all messages when I am back tomorrow.
     
  49. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    Oh thanks now i get it ..
     
  50. LennartJohansen

    LennartJohansen

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

    There is a "use vegetation mask" setting on each vegetation item in the persistent storage. Enable this if you want the Vegetation Masks to affect the persistent vegetation

    Lennart

     
Thread Status:
Not open for further replies.