Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

[RELEASED] Vegetation Studio

Discussion in 'Assets and Asset Store' started by LennartJohansen, Jun 23, 2017.

  1. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    131
    Hi Lennart,

    it was indeed a prefab that was missing a mesh. I found this 2 minutes after I've written the post and deleted the post immediately, but you are to fast:)
    Your support is awesome! Thanks for your help.

    But I have another question, I tried to use your grass shader on a mesh (some reeds), which works actually quiet well and moves the mesh really nice with the wind, but unfortunately it receives light only from one direction. Is there a way to get that working?

    Frank
     
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    The grass shader does normal adjustments to get grass planes better lit. Duplicate the shader and the a_grass.cginc file. Give it a new shader name and use the new include file.

    then in the new include file find this line.

    Code (csharp):
    1.  
    2.     v.normal = float3(0,1,0);
    3.  
    should be line 113

    comment out that and it should keep your mesh normals.

    Lennart
     
  3. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    131
    Hi Lennart,

    Hi Lennart,

    works like a charm thanks a lot, you are awesome (your asset as well;))
     
  4. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Unite Berlin

    Hi. I am going to Unite in Berlin now. I might be slow in answering on the forum until I get back to the office on Friday.
    We have some new fancy tech to show there together with NatureManufacture :)

    I will post info about this after Unite.

    If anyone is at Unite and want to have a look, send me a message.

    Lennart
     
    NoobDoAAA and Vagabond_ like this.
  5. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    868
    Would you be willing to automate that process? -- I can imagine a number of scenarios where I'd want to keep my own mesh normals. D:

    Maybe provide a togglebox or button that will swap out the files we need for a particular asset?
     
  6. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Hey, I was wondering if I could get some help. Currently, I'm using Vegetation Studio for grass. For trees, they get streamed from the server to clients, and then get made as individual objects in the scene. As you can imagine, my performance gets pretty bad with thousands of trees. I'm thinking if I display them using VS instead my performance will be much better.

    How would I go about setting them up at runtime though? Adding them at particular positions and rotations, and specifying which model to use. Ideally, I'd set the models up for it at runtime as well.

    Also, I see a way to add components to colliders at runtime when they get created near the player. The only callback info seems to be the collider though, is there any additional information you can get? Essentially wanting to look up what type of tree it is, and also the id of it that I got from the server for it.

    Thanks for any help you can provide!
     
  7. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    174
    are shaders in vegetation system are made specially for indirect instancing of your system, if that's the case how would GPU instancer work in conjunction with your system.

    Are those shaders compatible with HD render pipeline?
     
  8. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    868
    Is it possible to specify the shader for each individual LOD in the vegetation system?
     
  9. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. There is no UI for this, but Vegetation Studio will use the shader assigned to the materials on the LODs. Just set up that as normal.

    Sure. I can add a checkbox for that. That shader was made for the grass patches. I did not know people was using it for other stuff, but I will add it.

    Lennart
     
    awesomedata likes this.
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. If you add a persistent storage to the VegetationSystem you can use the API to add instances.

    On the VegetationStudioManager there is a static API where you can specify the ID of the vegetationItem you want to add. It takes position, scale, rotation etc.

    You can add the models/prefabs run-time also with the same API but it will generate the billboard atlases for trees. We can make an overloaded version where you provide this also.

    I am at Unite in Berlin now but we can look at this when I get back.
     
  11. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. The Vegetation Studio shaders that support instanced indirect is using a custom setup function for setting up the ObjectToWorld and World2Object matrixes for rendering. These require the data provided in compute buffers from Vegetation Studio. Here is info on the setup

    I think using GPU Instancer and Vegetation Studio in the same project would work good but you need to select what each system should render. They both do instancing on the GPU.

    Except for a small prototype I did not start looking at the HD render pipeline yet. It is experimental and changes from release to release. When it gets closer to a release I will see what is possible and what changes is needed.

    Lennart
     
  12. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    If we could specify all the LODs that would be great. Do you have a link to the API functions I would use for this? I tried searching your website for it, but not much luck finding it.
    Okay so I tried commenting out the billboard generation, and setting the textures using these properties from the SpeedTrees BillboardRenderer
    vegItemInfo.BillboardTexture = (Texture2D)mat.GetTexture("_MainTex");
    vegItemInfo.BillboardNormalTexture = (Texture2D)mat.GetTexture("_BumpMap");
    vegItemInfo.BillboardColorSpace = UnityEditor.PlayerSettings.colorSpace;
    However, no billboards show up, and the billboard debug shows 0 billboards. What am I doing wrong?

    Also, perhaps I didn't explain my questions well enough.
    I see delegate methods for creating colliders:
    public delegate void MultiCreateColliderDelegate(Collider collider);
    public delegate void MultiBeforeDestroyColliderDelegate(Collider collider);
    It doesn't seem to provide me with any information as to what piece of flora this is? If I'm going to setup interaction scripts on these components for players I'll need a way to link it back to the info I receive from the server to create this.

    As to ID, it looks like that ID is internal instance ID to your system for which piece of flora it is. I was talking about a database ID to link it back to the server data. Or would I just have to use position for it?

    Hmm, I thought I read somewhere on your website that you could set the colliders to be the same ones on the prefab. The only options I see for it though is to specify only one collider that you manually set the positions and such for, or to use the mesh. Did I read it wrong? Is that not a feature you have?
    I found the link to where it says that, "From Object":
    https://www.awesometech.no/index.ph...getation-system/vegetation-system-vegetation/
    Do you plan on pooling the colliders eventually as well, instead of instantiating them each time?

    I've started working on some of it, trying to figure out what I can by looking through the code. So far the changes I do though modify the scene and data files when I add new vegetation types and spawn them in game. Is there a way to avoid doing that? All these things are dynamically placed at runtime, so they should not be persisted in any settings in the editor.

    Can you change AddVegetationItemInstance/RemoveVegetationItemInstance to have error handling, or return a bool false, or something on the cases it fails to add/remove it?

    For the add/remove methods, if I don't set "clearCellCache" to true, does that mean it won't be updated on the screen to add/remove it?

    We currently have a bit of a performance issue with grass. I read that your system performs much better with the instanced indirect shader? Do you know what version of Unity is the min for that? We are currently on 5.6.2. Read an earlier post that says you are working on getting it compatible with trees, any progress with that?

    I can't seem to figure out how to get them to show up at runtime though, here's the code I've got so far for testing, what am I doing wrong? After a bit more testing, it seems to work if the asset exists in the project. However, when I try and add a prefab which comes from an asset bundle, it does not. Is that not supported?
    Code (CSharp):
    1.         VegetationSystem vegSystem = VegetationStudioManager.Instance.VegetationSystemList[0];
    2.         VegetationPackage vegPackage = vegSystem.CurrentVegetationPackage;
    3.  
    4.         PersistentVegetationStorage persistentVegetationStorage = vegSystem.GetComponent<PersistentVegetationStorage>();
    5.  
    6.         /*PersistentVegetationStoragePackage persistentVegetationStoragePackage = ScriptableObject.CreateInstance<PersistentVegetationStoragePackage>();
    7.         persistentVegetationStorage.PersistentVegetationStoragePackage = persistentVegetationStoragePackage;
    8.         persistentVegetationStorage.AutoInitPersistentVegetationStoragePackage = true;*/
    9.  
    10.         Vector3 position = new Vector3(158, 5f, 69f);
    11.         foreach (FloraTemplate template in ResourceManager.LoadAll<FloraTemplate>("Flora"))
    12.         {
    13.             VegetationType type = VegetationType.Plant;// template.FloraType == FloraType.Tree ? VegetationType.Tree : VegetationType.Plant;
    14.             foreach (FloraStage stage in template.Stages)
    15.             {
    16.                 GameObject prefab = BundlesManager.GetAsset<GameObject>(FloraTemplate.BundleName, stage.PrefabName);
    17.                 string vegetationItemId = vegPackage.AddVegetationItem(prefab, type, false);
    18.  
    19.                 persistentVegetationStorage.AddVegetationItemInstance(vegetationItemId, position, Vector3.one, Quaternion.identity, true, 50);
    20.                 position += Vector3.right;
    21.  
    22.                 //return;
    23.             }
    24.         }
    Sorry for so many questions! I'm trying to figure out what I can. I'm sorry if all this is answered somewhere else already, I've dug through your website documentation, but wasn't able to find much about how editing this stuff at runtime functions/the methods to use.
     
    Last edited: Jun 23, 2018
  13. ivabibliocad

    ivabibliocad

    Joined:
    Jan 11, 2014
    Posts:
    71
    Is it possible to masked out things a like a mesh road? That is a complex figure so is not like a simple mask. I have a terrain then a road and this is the mask result: (I want just the road surface masked out)
    Terrain with road without vegetation mask area script:

    Terrain with road with vegetation mask area script enabled:
     
  14. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Back to the office tomorrow, then I will answer questions
     
  15. ivabibliocad

    ivabibliocad

    Joined:
    Jan 11, 2014
    Posts:
    71
  16. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    174
    Question 1. Is there a way to decrease the density of the grass with controlled distance from camera, because as grass gets further from the camera, the amount of grass with same amount of density would pack more within the pixel space, which maybe we should able to fine tune this parameter of fading distance vs grass density.

    Question 2. Is there a way to seperate distance control for each type of grass, So I can put my mesh close to where I am, then have about same type of grass billboard been in further distance and have distance fading like described in question 1.

    Question 3. I added instanced indirect to advanced foliage pack shader provided by NatureManufacture, however, I did not see any Option under selected grass to modify the LOD for the grass prefab(cginc for scaling and everything I moved to NM_indirect.cginc):
    Code (CSharp):
    1. Shader "NatureManufacture Shaders/Advanced Grass Specular"
    2. {
    3.     Properties
    4.     {
    5.    
    6.     }
    7.  
    8.     SubShader
    9.     {
    10.         Tags{ "RenderType" = "Transparent"  "Queue" = "Geometry+0" }
    11.         Cull Off
    12.         CGPROGRAM
    13.  
    14.         //--> I guess just look at the following #pragma
    15.         #include "UnityStandardUtils.cginc"
    16.         #include "UnityShaderVariables.cginc"
    17.         #include "NM_indirect.cginc"
    18.         #include "NMWind.cginc"
    19.  
    20.         #pragma target 3.0
    21.         #pragma multi_compile_instancing
    22.         //#pragma instancing_options procedural:setupScale
    23.         #pragma instancing_options assumeuniformscaling lodfade maxcount:50 procedural:setup
    24.         #pragma multi_compile GPU_FRUSTUM_ON __
    25.         #pragma vertex vert
    26.         #pragma surface surf StandardSpecular keepalpha addshadow fullforwardshadows
    27.  
    28.         void surf( Input i , inout SurfaceOutputStandardSpecular o )
    29.         {
    30.         }
    31.  
    32.         ENDCG
    33.     }
    34.     Fallback "Diffuse"
    35. }
     
    Last edited: Jun 22, 2018
    NoobDoAAA, zmaxz and awesomedata like this.
  17. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    197
    Hi.

    I have two questions.

    1-

    My scene has 16 terrains. The latest update in which "multi terrain" is incorporated works very well. But....

    Is it possible to press the START VEGETATION SYSTEM button of all the "VEGETATION SYSTEM" at the same time and in the EDITOR? It is necessary to go debugging the locations and go one by one is tedious.

    2- [SOLVED]

    I can not get the Touch React System to work properly for me. Should we put one instance per scene or one per plot? What other reason can it be?

    Thank you very much and congratulations for the last update.
     
    Last edited: Jun 22, 2018
  18. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,102
    Hello,

    I started my new game with a top down camera which is around 12 meters over the Ground.

    I made myself a script that makes walls or other stuff with Colliders transparent if they are between camera and Player. Working perfect.

    But when I stand beneath a tree, I only see leaves...
    I added capsule Colliders to the tree prefabs in the Vegetationsystem.
    But of Course that does no help for the leaves! Does anybody have an idea how to fade the leaves or how to disable the leaves which are between the Player and the camera, or Maybe all leaves, but without losing their shadows on the Ground which look extremly cool?

    Thanks a lot :)
     
  19. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    868
    There are multiple approaches you can take with this.

    This is something you'll either need a special shader for, a gameobject approach using raycasts and fading, or a combination using vegetation studio masking and gameobjects (for nearby trees) if shaders are not your thing.

    The shader approach is probably going to be the fastest, but depending if your camera stays overhead the entire time, the performance difference with gameobjects shouldn't matter if it only takes into account nearby gameobjects to the player. In either case, you're probably better off splitting either the mesh or the material of the tree in two for the parts you want to fade.

    You can probably set the shader of the vegetation studio tree to none to prevent it drawing two trees, but I'm not certain. This is only for the separate gameobject approach though. You obviously wouldn't need that part for a shader approach.
     
    Firlefanz73 likes this.
  20. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    197
    My scene has 16 terrains. The latest update in which "multi terrain" is incorporated works very well. But....

    Is it possible to press the START VEGETATION SYSTEM button of all the "VEGETATION SYSTEM" at the same time and in the EDITOR? It is necessary to go debugging the locations and go one by one is tedious.

    thanks
     
  21. LennartJohansen

    LennartJohansen

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

    The VegetationStudio Manager component has a start button that will start all the Vegetation Systems in the scene.
    This is added automatic when setting up VegetationStudio with the menu selection. You should only have one of these per scene.

    Lennart
     
  22. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. For the roads I think using a VegetationMaskLine component is better. Add nodes to follow the road paths and then set the width as the same as the roads.

    Have a look here.

    Lennart
     
  23. LennartJohansen

    LennartJohansen

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

    1. There is currently not a way to do this but I have been experimenting a bit with a rule that can do this. There is a few things to think about when doing this to make sure the same instances are selected for culling the same time at the same distance. This to remove flickering and grass patches blinking in and out when you move or change the camera view.

    Idea is to based on a rule give each instance a % visible distance of the total vegetation distance. You could say you want all grass for 30% of the distance and then a linear or maybe based on a curve fade out instances in the distance.

    I added a vector4 controll data to the instanced indirect struct a while back for cases like this.

    This kind of distance culling could only be possible for instanced indirect vegetation where the selection of what visible instances could be done in the same compute shader pass that does frustum culling today. The far cull distance would just have to be multiplied with the percent distance factor of each instance.

    It will be to slow to process all the instances every frame when rendering this instanced.

    2. If we get 1. working this would just be an additional distance factor per item of the normal vegetation distance.
    Issue again is that this will only work on instanced indirect vegetation.

    I have some other things to finish now that I am back from Unite but I will try to get this in.

    3. Did you check the naming of the LODs? They have to be named _LOD0, _LOD1 etc to be detected.

    Lennart
     
  24. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. There is no easy solution for this but you could probably get something working with changing the renderloop of vegetation studio.

    The trees/rocks/grass do not exist as GameObjects and have no MeshRenderer or individual material to adjust. They are basically a Matrix4x4 in memory that holds the position, rotation and scale of the object we want to render.
    This is all stored in a internal data structure that allws for view dependent selection and culling.

    for trees there is a function called DistanceLODCulling in the vegetationSystem.cs file

    This does a frustum test for each trees, selects what LOD to use and tests for visible shadows from invisible trees.

    Here you could probably insert your own test for trees between the camera and player. There is no colliders to raycast but maybe a custom frustum to test against the bounds of the tree? then exclude the tree from rendering and you do your own Graphics.DrawMesh for this instance with your modified material that can fade...

    I hope this helps you to get started.

    Lennart
     
    Firlefanz73 likes this.
  25. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,102
    Thanks a lot. Since I am not experienced with shaders, I will try with DistanceLODCulling, or at least I will try to make trees larger so their leaves are above the camera and under the sun :)
     
  26. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. The LODs are selected based on the names in the prefab. Unity standard naming _LOD0, LOD1 etc. LOD distances are based on the distance setup in the LODGroup on the prefab. Or are you looking for something else?

    The billboard system in vegetation studio does not use the speedtree billboards. It generates its own diffuse and normal atlas. If you want to skip the generation when adding items run-time you will have to pre-generate the textures for the trees you want to use and assign those when adding a item. If you look at the billboard generation code.

    Code (csharp):
    1.  
    2.     billboardTexture = BillboardAtlasRenderer.GenerateBillboardTexture(VegetationInfoList[vegetationItemIndex].VegetationPrefab, VegetationInfoList[vegetationItemIndex].BillboardQuality, VegetationInfoList[vegetationItemIndex].BillboardLodIndex, VegetationInfoList[vegetationItemIndex].ShaderType,rotationOffset, VegetationInfoList[vegetationItemIndex].BillboardAtlasBackgroundColor);
    3.  
    The VegetationItemInstanceID is generated based on the world position.
    Code (csharp):
    1.  
    2.            vegetationItemInstanceInfo.VegetationItemInstanceID = Mathf.RoundToInt(vegetationItemInstanceInfo.Position.x * 100f).ToString() + "_" +
    3.                                                                  Mathf.RoundToInt(vegetationItemInstanceInfo.Position.y * 100f).ToString() + "_" +
    4.                                                                  Mathf.RoundToInt(vegetationItemInstanceInfo.Position.z * 100f).ToString();
    5.  
    The gameobject of the coillider you get from the events will have 2 more components.
    VegetationItemInstanceInfo and a VegetationItemInfo component. These hold all info om what instance it is.

    Hi. I did not finish that part. I will get around to it. I will do pooling at the same time. I have the pooling classes ready, just a small setup to match ID to the pool and get the object.

    The vegetation package and persistent storage are scriptable objects saved in the project. They will serialize automatic and save with the scene. In a build this will not happen. If you plan to set up everything run-time you can create the scriptable objects in code and assign them to the VegetationSystem and persistent storage component. Then they will not save.

    Sure.

    Yes. without this set to true it will not show for current visible areas before they are reloaded again.

    I think it was a fix in 5.6.2p3 that made instanced indirect working with material property blocks. The speed increase with a lot of grass is good.

    The only thing missing is moving the shadow visibility test to the GPU and it should work. I am in the process of merging that and a lot of other changes from some prototypes to the main branch.

    I think loading from asset bundles should work as normal, but you have to load the prefab then assign it. I did not test myself.

    Looking a your code

    Code (csharp):
    1.  
    2.  string vegetationItemId = vegPackage.AddVegetationItem(prefab, type, false);
    3.  
    this will add a vegetation item to the vegetation package. You do this one time per tree type etc.

    Code (csharp):
    1.  
    2.  persistentVegetationStorage.AddVegetationItemInstance(vegetationItemId, position, Vector3.one, Quaternion.identity, true, 50);
    3.  
    This you can then call multiple times to add instances to the persistent storage.

    You should also call a VegetationSystem.RefreshVegetationPackage when you have added the new items.

    Lennart
     
  27. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    if you just want the tree to become invisible your test could change the visibility to shadow only.
     
  28. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Ah, I didn't realize LODs in VS worked already based on the LODGroup on the prefab, that's fantastic!

    Are you saying my billboards show as 0 because I used the SpeedTree materials? I would assume they would still show up, that VS would try to render them, but it might look weird since the textures aren't appropriate.

    How do I get the VegetationItemInstanceID from AddVegetationItemInstance, and is there a way to then remove it using RemoveVegetationItemInstance?

    As to collider callbacks, that's good to know. Would it be possible to get it modified to return those components as well though? GetComponent calls are expensive.

    Do you have any ETA on the From Object colliders option? We're nearing our launch date, so worst case I can just stick with all the colliders being in the scene still and just no renderers.

    Is it more efficient to do clearCellCache after each add hundreds of times on login while downloading the data, or is there another API I should use to refresh for login finished?

    Yeah, we went ahead and updated to 5.6.6 and got grass and trees instanced indirect. Tree shadows have horrible performance though, is that what would be fixed by the visibility test? Any ETA on that?

    My problem with them not showing up seemed to be related to not refreshing the VegetationPackage, I fixed it/modifying scriptable objects using this
    Code (CSharp):
    1.         // Create a copy of the vegetation package
    2.         VegetationSystem vegSystem = VegetationStudioManager.Instance.VegetationSystemList[0];
    3.         VegetationPackage vegPackage = vegSystem.CurrentVegetationPackage;
    4.         vegPackage = Instantiate(vegPackage);
    5.  
    6.         // Create a copy of the persistent storage
    7.         _persistentVegetationStorage = vegSystem.GetComponent<PersistentVegetationStorage>();
    8.         if (_persistentVegetationStorage == null ||
    9.             _persistentVegetationStorage.PersistentVegetationStoragePackage == null)
    10.         {
    11.             throw new System.Exception("PersistentVegetationStorage is not setup!");
    12.         }
    13.  
    14.         _persistentVegetationStorage.SetPersistentVegetationStoragePackage(Instantiate(_persistentVegetationStorage.PersistentVegetationStoragePackage));
    15.  
    16.         // Load all flora into Vegetation Studio
    17.         LoadFloraTemplates(vegPackage);
    18.  
    19.         // Let Vegetation Studio know to refresh its data
    20.         vegSystem.VegetationPackageList[vegSystem.VegetationPackageIndex] = vegPackage;
    21.         vegSystem.SetVegetationPackage(vegSystem.VegetationPackageIndex, true);
    Do you see any issues with any of that?
     
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    No. That is not related. It should try to make billboard instances of all VegetationItems with enabled billboards that are trees.

    The ids are position based. Just use the same position when removing instances. Or you can calculate the ID with the code I posted before.

    I do not want to change the API on those functions, other assets and people are using it and that would break all of those.

    I do not want to promise a date for the update. There is a lot in the pipeline now. Use your other solution if you are close to release.

    Yes it is faster to dont clear the cache per item and then do a VegetationSystem.ClearCellCache call when all is updated. But if this is over multiple frames you will not see any update before the call is done.

    The visibility test will not change the render time of tree shadows, just move som of the visibility testing and LOD selection to the GPU freeing up some CPU time. Again I do not promise ETAs on features as things change. But it is in the works.

    I think the code looks ok.

    Lennart
     
  30. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Any ideas why billboards wouldn't be getting created then?

    Understood, I can modify it myself for better performance then if needed.

    For shadows, alright hopefully that will be enough. It's like a 40 fps difference with tree shadows enabled vs not. Grass shadows have no noticeable impact at all. If it's not going to be within the next couple weeks though we might have to stick to using individual objects instead, thus far our performance was better with that over VS with instanced indirect.
     
  31. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Try getting a reference to the BillboardSystem and clear that cache also when you have added everything Maybe something out of sync.

    Lennart
     
  32. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Sorry, forgot to mention I already tried that. I call this after adding all templates to the package.
    vegSystem.RefreshBillboards();
    I also tried calling it 5 seconds after login, to see if it needed to wait for trees to start being added (which wouldn't work for our use case anyways, trees can get cut down/regrow in different spots), but still no luck.
     
  33. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Do you mind joining the discord server and send me a private message there? Link on the asset store page and first of the forum. Easier with a text chat and these spesific issues is probably not interesting for everyone.

    Lennart
     
  34. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    251
    @LennartJohansen Just curious.. What was this referring to?
    "I will also share some news then of some exiting tech we will be showing at Unite."
     
  35. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Just need the time to write a proper post explaining it. First day back in the office tomorrow.
     
    Rowlan and Mark_01 like this.
  36. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Hi Lennart,
    It seems I got the same multi-thread issue. After compiling or start the play mode, I sometimes got several (normally 10) error logs like this:
    Culling group was not disposed. You have to call Dispose explicitly from the main thread. This will likely result in a crash.
    UnityEngine.CullingGroup:Finalize()

    Maybe it's related to MapMagic's multi-thread solutions, I use the new MapMagic output node for VS.
     
  37. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    174
    1. yes I think linear with tweaking value would be fine for me, but exposing curve might something to do in future. But I thinking linear fading would work for most cases.


    3. I still have no luck with that. The grass mesh doesn't look like it's GPU culling either, its only culling by square block patch.

    Now I am thinking about modifying your shader to work with other Vegetation shaders. I am currently looking at a_grass.cginc, I see a lot of vert computation is been lefted using FAR_CULL_ON_SIMPLE, which is great, I am thinking about extending that into Surf(lighting)/fragment shader, which I see your AGrass.shader is only using a Lambert lighting with surf applying color diffuse only.
    Then suddenly I thought why not apply it to different LOD prefab, we should be better off providing two different grass shader...., instead of Using FAR_Cull_ON_SIMPLE?
     
    Last edited: Jun 25, 2018
  38. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Hi. Could you join the Discord server and send me a pm there? Easier with a text chat. Lets look at solutions for 3. Link to the server on the asset store page and the first post in the forum.

    Lennart
     
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    I will try to set up a map magic project and replicate. But it sounds likely that it is related to the node. MapMagic sets up a bit of the systems on a different thread.

    Does the message come when you unload terrains? For a test, what would happen if you pin all the terrains? Do you only get this when exiting playmode then?

    Lennart
     
  40. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    868
    I wonder if the new Jobs system would help out a lot with this factor.
     
  41. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    868
    Also, this might be worthwhile to put into the documentation / examples / tutorial section -- perhaps with a little more detail on the subject.

    I'm almost certain this is not a unique use-case scenario, plus it offers lots of other visual opportunities for those willing to get adventurous enough to modify VS a little bit. Knowing where to place our code, and having an overview of what is happening in the particular function via docs / videos / whatever, is a great asset when you're not familiar with the source.

    Additionally, it demonstrates the flexibility of your source code. Always a plus to know that if you ever want to add in some slightly different behavior, it's at least fairly straightforward to do so. :)
     
    Last edited: Jun 25, 2018
  42. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Mainly it occurs when I changed some of my codes and return to unity, after unity complete compiling.
    Didn't test if it is caused by destruction of terrain tiles, will try this tomorrow.
     
  43. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    251
    @LennartJohansen
    I just tried il2cpp and VS seems to break with lots of errors like below.

    ArgumentNullException: Argument cannot be null.
    Parameter name: method
    at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0
    at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.GeometryUtilityAllocFree..cctor () [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.DistanceLODCulling () [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.ExecuteRenderVegetation (Boolean forceRender) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.Update () [0x00000] in <filename unknown>:0
    Rethrow as TypeInitializationException: The type initializer for 'AwesomeTechnologies.GeometryUtilityAllocFree' threw an exception.
    at AwesomeTechnologies.VegetationSystem.DistanceLODCulling () [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.ExecuteRenderVegetation (Boolean forceRender) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.Update () [0x00000] in <filename unknown>:0
    (Filename: currently not available on il2cpp Line: -1)
    NullReferenceException: A null value was found where an object instance was required.
    at AwesomeTechnologies.GeometryUtilityAllocFree.CalculateFrustrumPlanes (UnityEngine.Camera camera) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.DistanceLODCulling () [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.ExecuteRenderVegetation (Boolean forceRender) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.Update () [0x00000] in <filename unknown>:0
    (Filename: currently not available on il2cpp Line: -1)
    NullReferenceException: A null value was found where an object instance was required.
    at AwesomeTechnologies.GeometryUtilityAllocFree.CalculateFrustrumPlanes (UnityEngine.Camera camera) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.DistanceLODCulling () [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.ExecuteRenderVegetation (Boolean forceRender) [0x00000] in <filename unknown>:0
    at AwesomeTechnologies.VegetationSystem.Update () [0x00000] in <filename unknown>:0
     
    Last edited: Jun 26, 2018
  44. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Hi,
    I've tested the causes of the dispose issue. It indeed shows up after terrain tiles are destroyed.
     
  45. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    80
    Hi,
    My VR scene has mixed trees (that have LODGroup and LOD0/1/2/billboard versions in the prefab) and rocks (with LODGroup and 0/1/2/3 versions). I can see the trees fading into the distance - through the LODs to become billboards - all good. However, the rocks don't seem to change LOD and cull quite close to the camera - around the same point the trees transition from LOD1 to LOD2.

    - How do I control the LOD transition points - is that done via the LODGroup on each prefab or is VStudio controlling that?
    - Can VStudio do billboards for rocks?

    Thanks!
     
  46. brettj

    brettj

    Joined:
    Feb 9, 2015
    Posts:
    29
    Any updates on the biome feature? Would be super helpful. Thanks!
     
  47. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    I've met a high delta-time peak on VS' billboard system when terrain tiles are generated and enabled by MapMagic:
    upload_2018-6-28_10-9-13.png
    Any optimizations?
     
  48. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    87
    Hey Lennart,

    I'm running into a crash with Vegetation studio on importing trees from my terrain. Is there a limit ? I have 15 trees setup and 20000 trees on my terrain.The more I'm having vegetation, the more the crash occurs.
    I'm using unity 2017.4.3f1 and lastest version of vegetation studio.
    I have some speedtrees, FAE trees and Tropical forest pack trees, all should be compatible with Vegetation Studio. (Also, i'm only using FAE shader)

    Thanks in advance for you time and help.
    Thanks also for providing this very good asset :)

    Jonathan

    Edit : I think I solved it. I tried to put my Vegetation Package to No textures and it does not seem to crash anymore. That's still strange because my terrain have 4 textures so I guessed I also should put that number on the package (or maybe it's for the vegetation studio terrain shader, that i'm not using, what would explain the crash)

    Edit 2 : Having the crash again, so setting to no textures did not solved it...
     
    Last edited: Jun 29, 2018
  49. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    Vegetation Studio Professional
    Hi.

    I promised to show some of the new stuff we have been working on and demoed at Unite Berlin 2018.

    We have been working hard on a new version of Vegetation Studio.

    Vegetation Studio Professional is a version of Vegetation Studio using the new Job system and Burst compiler from the core. All editor and run-time generation of vegetation is multithreaded and optimized using the new burst compiler.

    VS Pro will be released as a new asset, but there will be an upgrade path for current Vegetation Studio users and a time limited additional discount at release time.

    Development of the current Vegetation Studio version will continue as planned and some of the new functionality like mesh terrain support, instanced indirect tree support and billboard upgrades will arrive shortly for the current version.

    Current minimum Unity version is Unity 2018.2 but this will probably increase to 2018.3 during the beta.

    What is new!
    • Core technology using the new Job system and Burst compiler for increased speed and multi-threading. Live update in Editor when changing rules.
    • Single Vegetation System component supporting multiple terrains
    • Single Vegetation System component supporting multiple cameras
    • Biomes. New biome system that allows you to define biome areas on your terrains, each with its own vegetation package and splatmap rules.
    • Support for Mesh Terrains and Raycast terrains in addition to normal Unity terrains
    • Shader Controller system. This allows 3rd party shaders to expose UI elements and control run-time material changes. Controllers with support for several of the most used vegetation shaders are already included
    • Wind controller system. Like the shader controller allows for 3rd party wind settings.
    • Instanced indirect tree support

    We are getting ready for a beta and current Vegetation System users can sign up to join.

    Have a look a the new forum thread here to follow the development and beta info.



    Video showing the new biome system more videos in the WIP forum thread.

    Lennart
     
  50. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,327
    I will answer all questions on the forum soon. Just been a busy couple of days.

    Lennart