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

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    haha, figures I started making my own. Oh well, good to see this, this will help many people who can't code or does not have the time. The new stuff looks great. Keep up the good work!
     
  2. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    309
    Wow, so amazing! The virtual world I'm developing content for is about to get VS whitelisted (at long last), this is a great glimpse into the future.
     
  3. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Yes. This is what the Job system does good. Math that can be vectorized repeated for a lot of instances. Jobs would allow you to do calculations like this in worker threads running on all cores while still keeping the main core available for game logic.

    I agree that some better explaining of the inner workings would be nice for the documentation, but there are so many different scenarios how people would like to modify, in cases like this I think it is better to just ask.

    I will try to replicate this and see what is happending with IL2CPP builds. It looks related to reflection used to get access to a non GC alloc version of getting frustum planes from a camera.

    The cleanup should happen at OnDisable on the VegetationSystem component. Could you check how the component is destroyed in the Map Magic node code?

    setting up map magic to load the terrains at a larger distance than your set billboard distance and then reducing billboard cell size will split the generation into more frames when you actually move the camera close enough to see the billboard cells.

    There is a limit of 64 types of vegetation. You can disable this in the advanced tab. But 20 000 trees is not a large amount to import. Send me a pm with some info on your setup and let us debug to see what is happening.

    Have a look at my post from yesterday.

    Lennart
     
  4. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Does this work with webgl??
     
  5. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I did not test, but do not think it will work good on WebGL.
    WebGL 2.0 should support instancing but not compute buffers and compute shaders used for the instanced Indirect rendering.

    Lennart
     
  6. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    79
    Hey, I'm getting pop-in when I use instanced indirect rendering with SpeedTrees. Doesn't occur in scene mode, only in play mode. Any idea why could be causing this?
     
  7. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Yes. Instanced indirect does not work properly for trees yet. I am working on this. It need shadow culling and some other changes working on the GPU.

    You can use indirect for speedtree grass and plants.

    Lennart
     
    Mark_01 and Paratope like this.
  8. Paratope

    Paratope

    Joined:
    Jun 27, 2017
    Posts:
    20
    Alright. Looking forward to the changes. Thanks for the speedy response, as always.
     
  9. dustinfreeman

    dustinfreeman

    Joined:
    Apr 9, 2015
    Posts:
    18
    Thanks for your help so far! This works "sort of", except many of our trees are rendering only as shadows. There is no problem in mono, see this short video clip here:
    https://www.dropbox.com/s/0srl5kmo6lg9181/July8b-mono.mp4?dl=0
    But in stereo, a large number of the trees and rendered only as shadows, see video clip here:
    https://www.dropbox.com/s/yiv1gc02t989vbj/July8c-stereo.mp4?dl=0
    I know this is probably hard to support, since it involves a very alpha Unity software, but any hypotheses you have are appreciated.

    A minor issue is that there's still a gap of trees being rendered. We're using 3x 120 degree arc cameras as suggested, so we're not sure why it's still there. We know we can affect its position by rotating all the cameras together. I wish debugging this wasn't so empirical, but it's been hard to figure out what the deal is.

    If you want me to send a minimal project that shows the above behaviour, let me know. Email me at dustin.freeman@gmail.com
     
  10. Createman

    Createman

    Joined:
    Apr 14, 2013
    Posts:
    16
    Hello. Will there be support for local wind zones in VS or VS pro?
     
  11. InGameGames

    InGameGames

    Joined:
    Mar 3, 2018
    Posts:
    33
    Is it possible to use this with the 3D Game Kit asset to instance vegetation assets like shrooms, trees, grass, etc? I'd like to use this asset with the 3D Game KIt asset to test some systems I'd like to work on with Final IK and VRTK and I was wondering if this asset could help bring down the performance requirements enough to work with these assets?
     
  12. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Sent you an email.

    Lennart
     
  13. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I have been looking at the possibility to add this for instanced indirect rendered vegetation, but it is still on the idea stage...

    In the frustum culling and LOD selection compute shader pass that is done for instanced indirect vegetation we could select a local wind zone based on the instance position and pass this info in a structured buffer to the setup function in the shader. One problem is that it will require custom changes for shaders used to support it.

    Lennart
     
    recon0303 likes this.
  14. NoobDoAAA

    NoobDoAAA

    Joined:
    May 7, 2018
    Posts:
    11
    Wow, just wow :)
     
  15. Tim-Wiese

    Tim-Wiese

    Joined:
    Jul 7, 2012
    Posts:
    77
    Just thought I'd throw this up here. Made a quick tool to scale vegetation by ID in a Persistent Storage Package. Something I needed for our game.


    Code (CSharp):
    1. _vegetationID = EditorGUILayout.TextField("Vegetation ID", _vegetationID);
    2.             _minVegetationScale = EditorGUILayout.Vector3Field("Min Scale", _minVegetationScale);
    3.             _maxVegetationScale = EditorGUILayout.Vector3Field("Max Scale", _maxVegetationScale);
    4.            
    5.             if (GUILayout.Button("Scale Vegetation On Selected Storages"))
    6.             {
    7.                 List<PersistentVegetationStoragePackage> pvspList = new List<PersistentVegetationStoragePackage>();
    8.  
    9.                 for (int i = 0; i < Selection.objects.Length; i++)
    10.                 {
    11.                     PersistentVegetationStoragePackage pvsp = Selection.objects[i] as PersistentVegetationStoragePackage;
    12.                     if (pvsp)
    13.                     {
    14.                         pvspList.Add(pvsp);
    15.                     }
    16.                 }
    17.  
    18.                 if(pvspList.Count == 0)
    19.                     Debug.Log("Please select 1 or more Vegetation Storage Package(s) in the Project view.");
    20.  
    21.                 int count = 0;
    22.                 for (int i = 0; i < pvspList.Count; i++)
    23.                 {
    24.                     for (int cellIndex = 0; cellIndex < pvspList[i].PersistentVegetationCellList.Count; cellIndex++)
    25.                     {
    26.                         for (int infoIndex = 0; infoIndex < pvspList[i].PersistentVegetationCellList[cellIndex].PersistentVegetationInfoList.Count; infoIndex++)
    27.                         {
    28.                             if (string.Equals(pvspList[i].PersistentVegetationCellList[cellIndex].PersistentVegetationInfoList[infoIndex].VegetationItemID, _vegetationID))
    29.                             {
    30.                                 for (int itemIndex = 0; itemIndex < pvspList[i].PersistentVegetationCellList[cellIndex].PersistentVegetationInfoList[infoIndex].VegetationItemList.Count; itemIndex++)
    31.                                 {
    32.                                     PersistentVegetationItem pvi = pvspList[i].PersistentVegetationCellList[cellIndex].PersistentVegetationInfoList[infoIndex].VegetationItemList[itemIndex];
    33.                                     Vector3 scale = pvi.Scale;
    34.                                     scale = new Vector3(Mathf.Clamp(scale.x, _minVegetationScale.x, _maxVegetationScale.x),
    35.                                         Mathf.Clamp(scale.y, _minVegetationScale.y, _maxVegetationScale.y),
    36.                                         Mathf.Clamp(scale.z, _minVegetationScale.z, _maxVegetationScale.z));
    37.                                     pvi.Scale = scale;
    38.                                     pvspList[i].PersistentVegetationCellList[cellIndex].PersistentVegetationInfoList[infoIndex].VegetationItemList[itemIndex] = pvi;
    39.                                     count++;
    40.                                 }
    41.                             }
    42.                         }
    43.                     }
    44.                     EditorUtility.SetDirty(pvspList[i]);
    45.                 }
    46.                 Debug.Log("DONE! Scale fixed on " + count + " Instances");
    47.             }
     
  16. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    @LennartJohansen -- hello, existing VS customer here, for standard version. I'm just wondering when mesh support will be dropping and if it will be in both versions, standard and pro?

    My current project is using terrain and mesh, so have been patiently waiting for the mesh update before starting the VS integration ... however it's getting too exciting now, seeing all your recent updates, so had to ask! :)
     
  17. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I had some issues with MeshTerrain scaling. Sampling got slower than expected as the size/complexity of the MeshTerrain grew. That is solved in the Job/Burst version of the component for Pro.

    Next step is to do a rewrite of the changes to work with normal multithreading also, then add the interface to get this working in the standard Vegetation Studio version.

    Mesh Terrain is working or the Pro Beta. I will post the signup form here during the weekend or Monday. A few days later I will start adding people to the Beta. I need to finish a demo scene and a getting started guide first.

    Lennart
     
    WildStyle69 likes this.
  18. marcmantraunity

    marcmantraunity

    Joined:
    May 31, 2014
    Posts:
    21
    Hello, I have some challenges using Vegetation Studio and I want to understand clearly to continue our production. We are using a multiple scene setup on Unity 2017.1, in a future we will upgrade to 2018.X but not now, We need to release a first version at the end of August.

    - I have some warnings telling me I have cross scene reference, it starts to appear and I don't know why. We have the vegetationStudio parent on a scene, and every scene has its own vegetationStudio to manage all the sets.

    - I'm working on a multiple terrain scenes, around 3x3km, and fighting with Pre-Compute GI Lighting technic. All elements instantiated by VegetationStudio don't appear on lighting calculations and only on reflection probes. I turn off light probe generation on the terrain, is vegetationstudio creating its own light probe system to apply GI?

    - I'm using shaders with Instance Indirect, but I read and see using vegetation studio is only available on unity 2018.1? Are there a way to apply it on 2017.1 unity version?

    Thanks in advance
     

    Attached Files:

  19. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The warnings probably shows up since the VegetationStudioManager gets a reference to each of the Vegetation System component. This happens at OnEnable on the vegetation system component. The refrence will be made again even if broken while saving.

    This happens beacuse the components are set to execute in editor mode. I will see if I can get the warning to stop.

    Sampling GI/lightprobes is possible for instanced rendered vegetation from 2018.1 This was added in the Unity API then. It is not possible to do this on any older Unity version.

    Vegetation Studio does not create any lightprobes on the terrain. You will have to set these up yourself.

    Lennart
     
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Vegetation Studio Pro Beta

    Hi. We are getting closer to the Vegetation Studio Pro beta. Vegetation Studio user can sign up for beta access here.

    Lennart
     
  21. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Hello Lennart,

    a week ago I sent you a PM regarding a bug in VS as well as project to reproduce it. If you could read it and give me some reply, that would be awesome.
     
  22. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. you have a PM from me. Problem with the tree stump was that it had multiple LOD0,1 etc. You need to merge this into a single mesh with submeshes to use it.

    Lennart
     
  23. XOA_Productions

    XOA_Productions

    Joined:
    Nov 27, 2016
    Posts:
    24
    Hey there!

    I'm sorry if this question was asked before, but I couldn't find anything through the search.
    I have an issue where there is a short period where both a billboard and a mesh of a tree will be displayed at the same time. For example, if my mesh trees start at 100 metres, the billboards will only disappear at 95 (or simmilar).
    This causes an annoying double popping effect when one is facing a distant group of trees.

    Is this effect intended, and if not, do you have any idea how to fix this?

    Regards,
    Ben

    Edit: Fixed it:
    Line 274 of BillboardSystem.cs changes to this:
    Code (CSharp):
    1. _vegetationItemBillboardMaterialList[i].SetInt("_CullDistance", cullDistance );
    Before it was cullDistance-1. I don't know if this breaks anything down the line though, but it worked for me.
     
    Last edited: Jul 18, 2018
    dsilverthorn likes this.
  24. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hey guys, my game just hit steam early access!

    Enpowered by vegetation studio, my landscape is gorgerous!!

    Though the performance is still a bit low on mid-ware computers, will there be any further optimizations to VS?
    Especially working with MapMagic, now every time a new terrain tile is loaded, the OnEnable method in vegetation system always cause a huge lag, scratching my head trying to figure out how to optimize it.
     
  25. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    The dispose issue I brought up before is causing a lot of my player's games to crash after played for about an hour or longer, really need it to be fixed. Is there any progress on it?
     
    Last edited: Jul 19, 2018
  26. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Found an exception on a build game downloaded through steam:
    Failed to load '... HeightmapUtil.dll' with error 'The specified module could not be found'.
    This does not happen on every PC, but some of them got this issue, they've tried to uninstall the game and re-download them sveral times but it persists, any ideas what may caused this?
     
  27. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The heightmapUtil.dll needs Visual Studio 2015 c++ runtime installed.
    The c++ dll does some of the spawning math for sampling the terrain heightmap.

    You can disable the dll and switch to a c# version of the code with a compiler define, but this is slower.

    Lennart
     
  28. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will look at it, see what is going on. It should not have been overlap.

    Lennart
     
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The problem only seems to show up when using the VegetationStudio output node in MapMagic. My guess is that it does some of the calls from a different thread. I can help to debug but the fix has to be done in the output node code in MapMagic.

    Lennart
     
  30. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    For the render loop there is not much to optimize. When instanced indirect tree support is finished you can offload the CPU a bit by moving render list creation and shadow visibility + LOD selection for trees to the GPU.

    when you enable a new VegetationSystem it generates the cell structure and reads the height + splatmap from the terrainData. reading this takes a bit of time and has to be done on the main thread.

    A pooling system and the hotswap terrain function could help reduce the init time, but would require a rewrite of the output node code.

    Lennart
     
  31. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    So I'll need my clients to install VS 2015 C++ Runtime right?
    I'll see if I can make a request for installing this on steam...

    This would help a lot, when will this update come out?

    I can make the fix, I've changed some codes in the output node to suit my needs, so just point the directions to me :)
    We can debug this in PM.

    I don't have any ideas about making a pooling system in the node, but I can try. Do you have any suggestion?
     
  32. marcmantraunity

    marcmantraunity

    Joined:
    May 31, 2014
    Posts:
    21
    Hi @LennartJohansen,

    As we said before, we are working using Unity 2017.1 to create our firt version at the end of this August. After this, we will change the version, and maybe to VS Pro :-D
    But for now, I need to optimize our scene and I see all the performance problems goes on LOD. We use LODGroup + Fantasy Adventure asset shaders + Instanced shaders, not indirect instanced.

    I attach the images to clarify what are we doing. And the question: how? How can we improve the settings to have a better performance using vegetation studio?
     

    Attached Files:

  33. UnityUserTDS

    UnityUserTDS

    Joined:
    Jul 17, 2018
    Posts:
    5
    Hi there,

    i'm getting issue to refresh prefabs instances, when for example I modify a prefab shader and then refresh it, it simply disapear...
    Someone have the same issue ?
    Any solution ?

    Thank you

    Thomas
     
  34. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    Hi, this is a problem with your shader. Check the render mode settings in VS. What shader are you using?
     
  35. UnityUserTDS

    UnityUserTDS

    Joined:
    Jul 17, 2018
    Posts:
    5
    I'm using two types of shaders, standard and Double sided shaders downloaded from Cicona studio on the asset Store. I've changed the instanced mode to normal mode and the models reappeared.

    What in the render settings of Vegetation Studio can be responsible for that?

    Second question, how can I optimize my scene and make it less heavy and less slow? Any advices ?

    Thank you for your response.

    Thomas.
     
  36. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    Hi Thomas,

    check if 'Enable GPU Instancing' is enabled in your material.

    What makes your scene slow, Vegetation Studio?
     
  37. marcmantraunity

    marcmantraunity

    Joined:
    May 31, 2014
    Posts:
    21
    Hi,

    I have many problems when I try to manage vegetation on Persistance. I bake everything and start to customize what I need. When I manage trees, I haven't got any issue, but if I try to Paint foliage or use Precision Painting, appears an error about textures format and vegetation doesn't paint anything... I configure every texture we are using to RGBA32 and appears the same error...
     

    Attached Files:

  38. UnityUserTDS

    UnityUserTDS

    Joined:
    Jul 17, 2018
    Posts:
    5


    Yes 'enable GPU Instancing' is on, but when I want to refresh prefab in vegetation studio it just removes it.

    Yes Vegetation studio makes the editor very slow, I guess that is a normal fact because I need to use a great lot of instances on my scene. Finally I was wondering if importing lo poly models for tree scattering could be lighter than use generic trees from Unity ?

    Thank you,

    Thomas
     
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Could you send me one of the models with the shader to test? on a private message.

    Lennart
     
  40. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I got your email as well. Answering that.

    Lennart
     
  41. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    About when will be released the pro version?
     
  42. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    The beta has started now. I still have to add a persistent storage + editor and a collider system. My guess is around the release of 2018.3.

    It is still possible to sign up for beta access. There is a form on the website

    Lennart
     
  43. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I'm interested in the biomes system, will this be possible for us to generate biome masks in runtime? For my terrain is procedurally generated, and can not apply anything within editor.
     
  44. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    The biome masks are polygon areas. These masks can be created run-time. You create a component add an array of vector3 for the outline and set biome type and blend settings.
     
    tapawafo likes this.
  45. UnityUserTDS

    UnityUserTDS

    Joined:
    Jul 17, 2018
    Posts:
    5
    HI Lennart,

    it works now, thank you.

    I have some other important question:

    I have to create differents environments and then gather them into a new scene, what could be the best process to do this ? Is it possible to keep instances of vegetation doing this ?

    I don't know if it is the right way but I have to create environments and then regroups them into another scene, I'm not really familiar with the real time process...

    Thanks for support,
    Thomas.
     
  46. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Is it possible to use a picture as a mask? Or is it possible for me to output some area data generated from MapMagic?
    For the polygon data may not be very useful in my case, each of my biome normally covers multiple terrains.
     
  47. mtGameDev

    mtGameDev

    Joined:
    Oct 19, 2012
    Posts:
    89
    After update to last version. i have this problem when i want to paint my grass.i have baked all.
     

    Attached Files:

  48. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    And if i use the normal version i will be able to update to the pro version without problems?
     
  49. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Have a look at this post.

    Lennart
     
  50. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Could you copy the error message and send to me in a private message? I need to see line numbers to try to debug.

    Lennart
     
Thread Status:
Not open for further replies.