Search Unity

[Released] Vegetation Studio Pro

Discussion in 'Assets and Asset Store' started by LennartJohansen, Jun 29, 2018.

  1. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
  2. JupiterOP

    JupiterOP

    Joined:
    Mar 5, 2019
    Posts:
    6
    I use entities to generate my terrain chunks. Is it possible to use Vegetation studio/pro for generating foliage where I tell it to, without any standard terrain gameobject?
     
  3. Roboserg

    Roboserg

    Joined:
    Jun 3, 2018
    Posts:
    83
    What does VS pro offers that the regular version doesnt? Is the following list ONLY for the PRO version?

    Code (CSharp):
    1. -Extensive Biome system
    2. -Supports both Unity terrains and mesh terrains
    3. -Rule based vegetation
    4. -Manual paining system
    5. -API for 3rd party tools and shaders
    6. -Run-time masking system
    7. -Instanced rendering
    8. -Rule based splat map generation
    9. -Touch bend grass and plants
    10. -Universal billboard system
    11. -Collider system
    12. -Real-time editor updates
    13. -Multiple terrains/cameras on a single Vegetation System
    14. -VR-Support
     
  4. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    who kidnapped Lennart ? he usually answer fast !
     
  5. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Hi Lennart,

    I'm contemplating an upgrade to Pro and I was wondering if you ever managed to add the bitmap support for biomes?

    Thanks,
    Matthias
     
  6. rayD8

    rayD8

    Joined:
    Mar 7, 2018
    Posts:
    32
    Hello,
    Could you tell me why the Vegetation Item preview thumbnails would be missing on many of the items?
    However, they still work in the scene...
     
  7. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    42
    Please tell me who knows if there is a script that allows you to convert Unity vegetation already planted on the Terrain into Vegetation Studio Pro vegetation, or at least change something in the Vegetation Studio Pro code so that I can use both types of vegetation in parallel (for Vegetation Studio Pro)?
     
  8. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Try to right click on the prefab and reimport. This is a unity issue with generating previews.

    Hi. There is no system for that. You will have to set up procedural rules to spawn the vegetation wih Vegetation Studio.

    Hi. The biome system is polygon based. You can not use bitmap data to define areas.

    Use the discord server for support requests. I only check the forums sometimes.

    Hi. Answered you on the discord server.

    Hi. If you join the discord server there is a channel where I post progress on the VSP 2020 version with SRP support.

    Lennart
     
    IsDon likes this.
  9. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Support request.

    Hi. Please use the discord server for support requests and questions. I do not check the forums often.
    Since most of my requests come in the discord serve I try to keep it there.

    Link in my sugnature.

    Lennart
     
    IsDon likes this.
  10. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Hi,
    Sorry if this question has probably been asked, but does Vegetation Studio (Pro or not) only work with Unity's Terrain component ? Thanks !
     
  11. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Vegetation Studio Pro has support for using meshes as terrains. Have a look here.

    https://www.awesometech.no/index.php/mesh-terrain-pro/

    Lennart
     
  12. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Hi, got almost the same issue.
    • Try to convert your custom mesh with MeshTerrainToolWindow you'll find under Windows -> Awesome Technologies.
    • On this new component,generate the Mesh TerrainData by clicking on Create MeshTerrainData object in the Mesh Terrain script component.
    • Then, all the others parameters on the VegetationSystemPro gameobjects seems ok in your screenshot.
    • Next, and that's when I thought it did not work, zoom very close to your terrain. The objects (your grass) might not show only because you are too far.
     
    newguy123 likes this.
  13. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    44
    Hi Lennart,

    I'm using HDRP and keep getting many instances of this error:
    Shader properties can't be added to this global property sheet. Trying to add _GrabTexture_HDR (type 1 count 1)

    I've installed all required packages and Vegetation Studio Pro.
    Do you know how I can solve this?


    Also my AwesomeTechnology shaders are pink. Are there special HDRP shaders in Vegetation Studio Pro or is there something else that needs to be done to make the VS shaders work in HDRP?


    upload_2020-6-14_12-31-42.png
     
    Last edited: Jun 14, 2020
  14. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,194
    Is there a method for setting multiple vegetation items to the same rule? Perhaps a biome wide rule set. For instance, I am trying to set most of my vegetation to not spawn on my terrain's mountains, so I'm using a Terrain Texture rule, which works. But it seems tedious to have to do this for each vegetation item, so I feel like I'm missing something. Thanks!
     
  15. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    I have a problem with "area mask"

    1- I have a created area
    2- I want to modify some points of that area. (image "area_ini")
    3- When I move the cursor over it, without touching any point, the area moves "automatically", varying the location. (image 2 "area_fin", after passing the courses by scene view 15 times -so that it looks good-)
    4- When I move one of the "handles" all the vegetation in the area is automatically relocated, completely distorting its original situation. (image 3 "area_rdo")

    I look forward to your help or advice.

    Thank you.

    EDIT. More info

    a) I think the problem may be due to the areas being too large.
    b) with the option "show handles" deactivated, it does not happen.

    And I take this opportunity to ask a question.

    Is there a way to detect ("collision" style) that an object enters these areas without creating a collision zone?
    (It would be very useful)

    area_ini.png area_fin.png area_rdo.png
     
    Last edited: Jun 17, 2020
  16. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Hi Lennart,

    I upgraded to Vegetation Studio Pro and am trying to integrate it into an existing open world system that streams many terrain objects of different sizes and resolutions from disk.

    In Vegetation Studio I assigned a VegetationSystem component to each terrain object.
    Then I used AddVegetationPackage() to add the same VegetationPackage to each.
    Finally I was able to assign different mask textures to each individual terrain object using VegetationSystem.UpdateLocalTextureMaskTexture().

    In Vegetation Studio Pro that seems no longer be possible and everything is managed globally with a single mask list shared between all terrains. I'm unable to make this work for my setup and at this point it seems like the only option might be to create a duplicate instance of each vegetation package for each terrain piece just so I can apply local terrain object masks.

    Is there any other way to do this? It's not feasible for me to rewrite the system to use the Vegetation Studio Pro management of multiple terrain objects, especially since mine are of various sizes.

    Thanks for any ideas,
    Matthias
     
  17. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    25
    Hello, I have a question here that needs your help. I run the scene in edit mode and everything is normal. But when I build the project, it runs again. There will be a stuck frame rate. In the profiler window, you will find that there is a problem with the WaitForJobGroupID thread. Do you have any suggestions for me? I cut a picture for your reference.
     

    Attached Files:

  18. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Lennart,

    FYI, there is a bug in VegetationPackagePro.cs line 735 in CopySettingValues(). It copies VegetationType twice but does not copy PrefabType.

    Edit:
    Ran into a number of other properties not being copied:
    DisableShadows
    Density
    RandomizePosition
    ScaleMultiplier
     
    Last edited: Jun 29, 2020
  19. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey Lennart, Is Cross Fade for the LODs placed with VS a possible option in the future? Know it is not as performant friendly but definitely more effective for higher poly trees that need to drop down quite a bit.

    Edit- Also know about primary support being on discord. Do not use discord so okay to wait for a response here as it is not critical.
     
  20. amit-chai

    amit-chai

    Joined:
    Jul 2, 2012
    Posts:
    80
    Hi! does vegetation studio pro supported with 2019.4?
     
    Barritico and fusion242 like this.
  21. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    Hello, does vegetation studio Pro supports URP?
     
    p87 likes this.
  22. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Works... but it has lost performance.
     
  23. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Bug - Hi, just wanted to report an infinite Save Assets loop when you click on Apply Textures to terrain (Terrain System Pro script). I'm using 1.2.2. I was wondering why and how can I fix this issue ?

    upload_2020-7-13_10-52-6.png

    Also I can't tell you if it's linked, but I can see this warning in the console : upload_2020-7-13_10-55-56.png
     
    Last edited: Jul 13, 2020
  24. damir2076

    damir2076

    Joined:
    Feb 13, 2018
    Posts:
    10
    I have Vegetation studio and Vegetation studio Pro from Dec 2018. Several times tried to install VSPro without success.

    I tried with 2019.2.15f1 and 2019.3.15.f1.

    I always getting a lot of errors.
    upload_2020-7-20_2-5-39.png

    Jobs is part of Unity not package anymore, if I understand correctly.

    I changed api compatibility level, but I don't see Scripting Runtime Version
    upload_2020-7-20_2-7-38.png

    Does anybody know what is a problem?
     
    aditya2912 likes this.
  25. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Not sure. But double check that you have all of the packages that are required. Seems like something is missing.
    I had to follow the set up in steps provided and then it all worked.
    Check read me and/or website for full set up walkthrough. I think it is on their website, but I don't remember.
     
  26. Dark-Muppeteer

    Dark-Muppeteer

    Joined:
    Feb 24, 2013
    Posts:
    26
    Jobs is still in the package manager, you likely just need to go to the Advanced tab in the package manager window and select Show Preview Packages, so that it shows in the list.

    I think the Scripting Runtime Version just defaults to .Net4.xx under the hood in latest versions of Unity version so it shouldn't be an issue

    There's a few notes on the setup page about package versions, but just installing all the latest ones should be OK currently (unless you have a really old version of VSP). https://www.awesometech.no/index.php/setup-guide/
     
    dsilverthorn likes this.
  27. damir2076

    damir2076

    Joined:
    Feb 13, 2018
    Posts:
    10
    Tnx, it is working. Finally I install VS Pro, CTS 2019, RAM 2019 and Forest Environment HDRP without errors :)

    But Forest VS Biomes dont work.

    It is really great asset. I will try to make scene from blank.
     
    Dark-Muppeteer likes this.
  28. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,300
    All you need to install is Entities. The rest is installed implicitly via dependencies.
     
  29. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Hi.

    I don't want the LightProbe to affect the billboard of VegetationStudio Pro.
    Is it possible to turn it off like the inspector of Mesh Renderer with VegetationStudio Pro?

    BillBoards_LightProbe.jpg MeshRenderer.jpg

    Thanks.
     
  30. Sackwut

    Sackwut

    Joined:
    Nov 13, 2018
    Posts:
    5
    Hi, i have already asked a question in the R.A.M. hread, because i have an issue with the River as it cracks in artifacts.
    I found out, that this is because of the biomes is use with vegetation studio pro. As soon as i deactive the Biome/GO, the river shows clearly.
    Using Unity 2019.2.21f1

    Thanks in advance

    Edit 11.08.2020
    With help of another user on discord, we found a solution for this behaviour. Alot of prefabs were set to Instanced Inderect on the Biome General Render Setting. This caused the issue!
    I needed to change all prefabrs in the biome to Instanced and now everything is working fine.

    Regards
     

    Attached Files:

    Last edited: Aug 11, 2020
  31. TimeSniper

    TimeSniper

    Joined:
    Nov 26, 2012
    Posts:
    18
    I have great help from the terrain texture masking feature. It speeds up the process so much. I love it. But it seems like there is no for meshes. At this moment, not to see the plants and trees on such as rock, road, bridge meshes, I have only an option to paint textures under them and set the textures as exclude terrain mask, which is very annoying and time consuming.
    Do you have this feature already and am I missing it? If not, do you have a plan to add this feature, masking according to mesh or layer, tag?
     
    Last edited: Aug 15, 2020
  32. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    I was always thinking that VS pro is supporting HDRP, now I have seen some posts that it is not.
    So what is the actual truth?
     
  33. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    How does this interact with / compare to Gaia Pro? Im assuming this is going to be the more performant vegetation system?

    If theres a reason to use this with Gaia, what would the recommended workflow be? Create the terrain with Gaia and then populate the vegetation with this? I know Gaia has its own rule set for biomes ... would this entirely replace that system outside of generating the terrain itself, and I guess whatever terrain shader I use (CTS I guess)?

    Theres so many different things out there Im having a hard time wrapping my head around the best looking - most performant - easiest to use combination.

    Thanks!
     
  34. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    I am using MapMagic to create infinite world streaming system with VSPro and my technique right now is to create a clone of a 'source' system when a new terrain is loaded. I cannot use persistent storage because MapMagic basically generates texture masks for where the vegetation will go when terrain is loaded into view. I saw that one performance hit I was getting was the constant re initializing of VegetationPackageProModelInfo. Since multiple terrains span the same biome, I created a cache to manage this. It will cache all vegetation models for all packages referenced in the scene on startup of the game so it doesn't have to reinit any when new terrains are loaded. I did this by adding the following code:

    In VegetationSystemPro.cs, I added:
    Code (CSharp):
    1. // reference to the model cache being used, if one is.
    2.         public VegetationSystemPro_ModelCache ModelCache;
    3.  
    4. /// <summary>
    5.         /// Creates a cache of all models of all packages from all existing Vegetation Studio systems and uses it to make new models
    6.         /// when setting up/refreshing vegetation. If a model does not happen to be in the cache when the system is created,
    7.         /// it will create a new one and add it to the cache.
    8.         /// </summary>
    9.         public void EnableCacheModels ( bool refreshVegetationSystem ) {
    10.             if ( this.ModelCache == null ) {
    11.                 this.ModelCache = GameObject.FindObjectOfType<VegetationSystemPro_ModelCache>();
    12.                 if ( this.ModelCache == null ) {
    13.                     // create a model cache
    14.                     VegetationStudioManager manager = VegetationStudioManager.Instance;
    15.                     GameObject managerGo = manager != null ? manager.gameObject : null;
    16.                     if ( managerGo != null ) {
    17.                         this.ModelCache = managerGo.AddComponent<VegetationSystemPro_ModelCache>();
    18.                     }
    19.                 }
    20.                 if ( this.ModelCache != null ) {
    21.                     this.ModelCache.AddCachingSystem(this);
    22.                     if ( refreshVegetationSystem ) {
    23.                         this.RefreshVegetationSystem();
    24.                     }
    25.                 }
    26.             }
    27.         }
    28.         /// <summary>
    29.         /// Disables the use of cached models for this system.
    30.         /// </summary>
    31.         public void DisableCacheModels ( bool refreshVegetationSystem ) {
    32.             if ( this.ModelCache != null ) {
    33.                 this.ModelCache.RemoveCachingSystem(this);
    34.                 this.ModelCache = null;
    35.                 if ( refreshVegetationSystem ) {
    36.                     this.RefreshVegetationSystem();
    37.                 }
    38.             }
    39.         }
    40.  
    41. void OnDisable () {
    42.             //...
    43.             DisableCacheModels(false);
    44.             //...
    45. }
    In VegetationSystemPro_Models.cs, I altered the 'SetupVegetationItemModels ' method:
    Code (CSharp):
    1. public void SetupVegetationItemModels () {
    2.             List<GameObject> windSamplerList = new List<GameObject>();
    3.             for ( int i = 0; i <= VegetationStudioCameraList.Count - 1; i++ ) {
    4.                 windSamplerList.Add(VegetationStudioCameraList[i].WindSampler);
    5.             }
    6.  
    7.             ClearVegetationItemModels();
    8.  
    9.             float additonalBoundingSphereRadius = 0;
    10.             int cameraCount = VegetationStudioCameraList.Count;
    11.             for ( int i = 0; i <= VegetationPackageProList.Count - 1; i++ ) {
    12.                 // if we have a model cache setup, create a clone of the model info to use instead of creating a new one.
    13.                 VegetationPackageProModelInfo vegetationPackageProModelInfo = this.ModelCache != null ? this.ModelCache.makeClone(VegetationPackageProList[i], EnvironmentSettings, windSamplerList, cameraCount) : null;
    14.                 if ( vegetationPackageProModelInfo == null ) {
    15.                     vegetationPackageProModelInfo = new VegetationPackageProModelInfo(VegetationPackageProList[i], EnvironmentSettings, windSamplerList, cameraCount);
    16.                 }
    17.  
    18.                 VegetationPackageProModelsList.Add(vegetationPackageProModelInfo);
    19.  
    20.                 additonalBoundingSphereRadius = Mathf.Max(additonalBoundingSphereRadius,
    21.                     vegetationPackageProModelInfo.GetAdditionalBoundingSphereRadius());
    22.             }
    23.             AdditionalBoundingSphereRadius = additonalBoundingSphereRadius;
    24.         }
    In VegetationPackageProModelInfo.cs, I added a copy constructor:
    Code (CSharp):
    1. /// <summary>
    2.         /// Copy Constructor used to limit reloading the same models when multiple (cloned) systems are used.
    3.         /// </summary>
    4.         /// <param name="infoToClone"></param>
    5.         /// <param name="environmentSettings"></param>
    6.         /// <param name="windSamplerList"></param>
    7.         /// <param name="cameraCount"></param>
    8.         public VegetationPackageProModelInfo ( VegetationPackageProModelInfo infoToClone, EnvironmentSettings environmentSettings, List<GameObject> windSamplerList, int cameraCount ) {
    9.             EnvironmentSettings = environmentSettings;
    10.  
    11.             List<VegetationItemModelInfo> modelListToClone = infoToClone.VegetationItemModelList;
    12.             if ( modelListToClone != null ) {
    13.                 foreach ( VegetationItemModelInfo modelToClone in modelListToClone ) {
    14.                     if ( modelToClone != null ) {
    15.                         VegetationItemModelInfo vegetationItemModelInfo =
    16.                             new VegetationItemModelInfo(modelToClone, EnvironmentSettings, windSamplerList, cameraCount);
    17.                         VegetationItemModelList.Add(vegetationItemModelInfo);
    18.                     }
    19.                 }
    20.             }
    21.         }
    In VegetationItemModelInfo.cs, I also added a copy construtor:
    Code (CSharp):
    1. /// <summary>
    2.         /// Copy Constructor used to limit reloading the same models when multiple systems are used.
    3.         /// </summary>
    4.         /// <param name="infoToClone"></param>
    5.         /// <param name="environmentSettings"></param>
    6.         /// <param name="windSamplerList"></param>
    7.         /// <param name="cameraCount"></param>
    8.         public VegetationItemModelInfo ( VegetationItemModelInfo infoToClone, EnvironmentSettings environmentSettings, List<GameObject> windSamplerList, int cameraCount ) {
    9.             EnvironmentSettings = environmentSettings;
    10.  
    11.             VegetationItemInfo = infoToClone.VegetationItemInfo;
    12.             VegetationModel = infoToClone.VegetationModel;
    13.  
    14.             DistanceBand = infoToClone.DistanceBand;
    15.  
    16.             SelectedVegetationModelLOD0 = infoToClone.SelectedVegetationModelLOD0;
    17.             SelectedVegetationModelLOD1 = infoToClone.SelectedVegetationModelLOD1;
    18.             SelectedVegetationModelLOD2 = infoToClone.SelectedVegetationModelLOD2;
    19.             SelectedVegetationModelLOD3 = infoToClone.SelectedVegetationModelLOD3;
    20.  
    21.             ShaderControler = infoToClone.ShaderControler;
    22.             LODCount = infoToClone.LODCount;
    23.  
    24.             CreateCameraWindSamplerItems(windSamplerList);
    25.  
    26.             LODFadePercentage = infoToClone.LODFadePercentage;
    27.             LODFadeCrossfade = infoToClone.LODFadeCrossfade;
    28.  
    29.             VegetationMeshLod0 = infoToClone.VegetationMeshLod0;
    30.             VegetationMeshLod1 = infoToClone.VegetationMeshLod1;
    31.             VegetationMeshLod2 = infoToClone.VegetationMeshLod2;
    32.             VegetationMeshLod3 = infoToClone.VegetationMeshLod3;
    33.  
    34.             VegetationRendererLOD0 = infoToClone.VegetationRendererLOD0;
    35.             VegetationMaterialsLOD0 = cloneMaterialArray(infoToClone.VegetationMaterialsLOD0);
    36.  
    37.             VegetationRendererLOD1 = infoToClone.VegetationRendererLOD1;
    38.             VegetationMaterialsLOD1 = cloneMaterialArray(infoToClone.VegetationMaterialsLOD1);
    39.  
    40.             VegetationRendererLOD2 = infoToClone.VegetationRendererLOD2;
    41.             VegetationMaterialsLOD2 = cloneMaterialArray(infoToClone.VegetationMaterialsLOD2);
    42.  
    43.             VegetationRendererLOD3 = infoToClone.VegetationRendererLOD3;
    44.             VegetationMaterialsLOD3 = cloneMaterialArray(infoToClone.VegetationMaterialsLOD3);
    45.  
    46.             VegetationMaterialPropertyBlockLOD0 = infoToClone.VegetationMaterialPropertyBlockLOD0;
    47.             VegetationMaterialPropertyBlockLOD1 = infoToClone.VegetationMaterialPropertyBlockLOD1;
    48.             VegetationMaterialPropertyBlockLOD2 = infoToClone.VegetationMaterialPropertyBlockLOD2;
    49.             VegetationMaterialPropertyBlockLOD3 = infoToClone.VegetationMaterialPropertyBlockLOD3;
    50.             VegetationMaterialPropertyBlockShadowsLOD0 = infoToClone.VegetationMaterialPropertyBlockShadowsLOD0;
    51.             VegetationMaterialPropertyBlockShadowsLOD1 = infoToClone.VegetationMaterialPropertyBlockShadowsLOD1;
    52.             VegetationMaterialPropertyBlockShadowsLOD2 = infoToClone.VegetationMaterialPropertyBlockShadowsLOD2;
    53.             VegetationMaterialPropertyBlockShadowsLOD3 = infoToClone.VegetationMaterialPropertyBlockShadowsLOD3;
    54.  
    55.             LOD1Distance = infoToClone.LOD1Distance;
    56.             LOD2Distance = infoToClone.LOD2Distance;
    57.             LOD3Distance = infoToClone.LOD3Distance;
    58.  
    59.             BoundingSphereRadius = infoToClone.BoundingSphereRadius;
    60.  
    61.             CreateCameraBuffers(cameraCount);
    62.  
    63.             HeightRuleCurveArray = new NativeArray<float>(4096, Allocator.Persistent);
    64.             UpdateHeightRuleCurve();
    65.  
    66.             SteepnessRuleCurveArray = new NativeArray<float>(4096, Allocator.Persistent);
    67.             UpdateSteepnessRuleCurve();
    68.  
    69.             BillboardMaterial = infoToClone.BillboardMaterial;
    70.         }
    71.  
    72.         protected static Material[] cloneMaterialArray ( Material[] toCopy ) {
    73.             int toCopyLength = toCopy != null ? toCopy.Length : 0;
    74.             Material[] clonedArray = new Material[toCopyLength];
    75.             for ( int i = 0; i < toCopyLength; i++ ) {
    76.                 clonedArray[i] = new Material(toCopy[i]);
    77.             }
    78.             return clonedArray;
    79.         }
    Finally, here is my code the cache itself. It gets added to the vegetation studio manager script's game object and gets removed when its not being used:
    Code (CSharp):
    1. using AwesomeTechnologies.VegetationStudio;
    2. using AwesomeTechnologies.VegetationSystem;
    3. using System;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6. using UnityEngine;
    7.  
    8. /// <summary>
    9. /// Represents cached models of all models of all packages of all Vegetation Studio Pro systems.
    10. /// Primarily used when there are multiple systems (maybe a source system is copied to each terrain loaded in an infinite world streamer).
    11. /// </summary>
    12. public class VegetationSystemPro_ModelCache : MonoBehaviour, IDisposable {
    13.  
    14.     // create an object to hold the model info to clone.
    15.     protected Dictionary<string, VegetationPackageProModelInfo> cloneablePackageModelInfoByPackageNameMap;
    16.  
    17.     // keep track of the systems using cached models.
    18.     protected HashSet<VegetationSystemPro> systemsUsingCachedModels;
    19.  
    20.  
    21.     void Start () {
    22.         // populate the cache
    23.         this.PopulateModelCache();
    24.     }
    25.  
    26.     /// <summary>
    27.     /// Adds a reference to the caching system.
    28.     /// </summary>
    29.     /// <param name="system"></param>
    30.     public void AddCachingSystem ( VegetationSystemPro system ) {
    31.         if ( system != null ) {
    32.             if ( this.systemsUsingCachedModels == null ) {
    33.                 this.systemsUsingCachedModels = new HashSet<VegetationSystemPro>();
    34.             }
    35.             this.systemsUsingCachedModels.Add(system);
    36.         }
    37.     }
    38.  
    39.     /// <summary>
    40.     /// Removes a reference to a system that might have once used caching.
    41.     /// If there are no more cached systems, remove this component as we dont need it anymore.
    42.     /// </summary>
    43.     /// <param name="system"></param>
    44.     public void RemoveCachingSystem ( VegetationSystemPro system ) {
    45.         if ( system != null && this.systemsUsingCachedModels != null ) {
    46.             this.systemsUsingCachedModels.Remove(system);
    47.             if ( this.systemsUsingCachedModels.Count <= 0 ) {
    48.                 this.Dispose();
    49.                 GameObject.DestroyImmediate(this);
    50.             }
    51.         }
    52.     }
    53.  
    54.     /// <summary>
    55.     /// Finds all existing vegetation systems and populates the cache with all the models from all referenced packages in each system.
    56.     /// </summary>
    57.     public void PopulateModelCache () {
    58.         if ( VegetationStudioManager.Instance != null ) {
    59.             // find all existing systems.
    60.             List<VegetationSystemPro> allExistingVegetationSystems = VegetationStudioManager.Instance.VegetationSystemList;
    61.             if ( allExistingVegetationSystems != null ) {
    62.                 foreach ( VegetationSystemPro existingSystem in allExistingVegetationSystems ) {
    63.                     if ( existingSystem != null ) {
    64.                         // iterate over the package list and populate cache with cloneable models.
    65.                         List<VegetationPackagePro> packageList = existingSystem.VegetationPackageProList;
    66.                         if ( packageList != null ) {
    67.                             foreach ( VegetationPackagePro package in packageList ) {
    68.                                 if ( package != null ) {
    69.                                     string packageName = package.PackageName;
    70.  
    71.                                     // see if we already made a clone of this item.
    72.                                     VegetationPackageProModelInfo vegetationPackageProModelInfo = null;
    73.                                     if ( this.cloneablePackageModelInfoByPackageNameMap != null ) {
    74.                                         this.cloneablePackageModelInfoByPackageNameMap.TryGetValue(packageName, out vegetationPackageProModelInfo);
    75.                                     }
    76.  
    77.                                     if ( vegetationPackageProModelInfo == null ) {
    78.                                         // need a cloneable model, so create and add one.
    79.                                         this.setCloneableModelInfo(packageName, new VegetationPackageProModelInfo(package, existingSystem.EnvironmentSettings, new List<GameObject>(), 0));
    80.                                     }
    81.                                 }
    82.                             }
    83.                         }
    84.                     }
    85.                 }
    86.             }
    87.         }
    88.     }
    89.  
    90.     /// <summary>
    91.     /// Use the cached models to make a clone of the cached models to use when setting up vegetation.
    92.     /// </summary>
    93.     /// <param name="package"></param>
    94.     /// <param name="environmentSettings"></param>
    95.     /// <param name="windSamplerList"></param>
    96.     /// <param name="cameraCount"></param>
    97.     /// <returns></returns>
    98.     public VegetationPackageProModelInfo makeClone ( VegetationPackagePro package, EnvironmentSettings environmentSettings, List<GameObject> windSamplerList, int cameraCount ) {
    99.         if ( package == null ) {
    100.             return null;
    101.         }
    102.         string packageName = package.PackageName;
    103.         VegetationPackageProModelInfo vegetationPackageProModelInfo = null;
    104.         if ( this.cloneablePackageModelInfoByPackageNameMap != null ) {
    105.             this.cloneablePackageModelInfoByPackageNameMap.TryGetValue(packageName, out vegetationPackageProModelInfo);
    106.         }
    107.         if ( vegetationPackageProModelInfo != null ) {
    108.             // clone it
    109.             vegetationPackageProModelInfo = new VegetationPackageProModelInfo(vegetationPackageProModelInfo, environmentSettings, windSamplerList, cameraCount);
    110.         } else {
    111.             // create a new one and cache a clone of it for later.
    112.             vegetationPackageProModelInfo = new VegetationPackageProModelInfo(package, environmentSettings, windSamplerList, cameraCount);
    113.             this.setCloneableModelInfo(packageName, new VegetationPackageProModelInfo(vegetationPackageProModelInfo, environmentSettings, windSamplerList, cameraCount));
    114.         }
    115.         return vegetationPackageProModelInfo;
    116.     }
    117.  
    118.     /// <summary>
    119.     /// Helper method to set a cloneable model into the cache.
    120.     /// </summary>
    121.     /// <param name="packageName"></param>
    122.     /// <param name="vegetationPackageProModelInfo"></param>
    123.     protected void setCloneableModelInfo ( String packageName, VegetationPackageProModelInfo vegetationPackageProModelInfo ) {
    124.         if ( packageName != null && vegetationPackageProModelInfo != null ) {
    125.             if ( this.cloneablePackageModelInfoByPackageNameMap == null ) {
    126.                 this.cloneablePackageModelInfoByPackageNameMap = new Dictionary<string, VegetationPackageProModelInfo>();
    127.             }
    128.             this.cloneablePackageModelInfoByPackageNameMap.Add(packageName, vegetationPackageProModelInfo);
    129.         }
    130.     }
    131.  
    132.     void OnDisable () {
    133.         this.Dispose();
    134.     }
    135.  
    136.     public void Dispose () {
    137.         if ( this.cloneablePackageModelInfoByPackageNameMap != null ) {
    138.             foreach ( KeyValuePair<string, VegetationPackageProModelInfo> entry in this.cloneablePackageModelInfoByPackageNameMap ) {
    139.                 VegetationPackageProModelInfo cloneableModelInfo = entry.Value;
    140.                 if ( cloneableModelInfo != null ) {
    141.                     cloneableModelInfo.Dispose();
    142.                 }
    143.             }
    144.             this.cloneablePackageModelInfoByPackageNameMap = null;
    145.         }
    146.     }
    147. }
    148.  


    Directions to use
    ---------------------
    When I copy the source vegetation studio pro system to a loaded terrain, I call system.EnableCacheModels() and it will cache all models from all packages in all vspro systems in the scene and instantiate a copy of the model when setting up vegetation for copied systems.

    What do you think @Lennart?
    Is this a feature you could possibly add in a future update?
     
    Last edited: Aug 25, 2020
    AsoraX, RafaelMartin, mick129 and 2 others like this.
  35. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Here's a video demonstrating my above solution with MapMagic: It will cache all vegetation models for all packages referenced in the scene on startup of the game so it doesn't have to reinit any when new terrains are loaded.


    With optimized vegetation, it virtually gets rid of most lag when creating new terrains. FPS was also +10 when I wasnt recording my screen with Bandicam.

    I hope Lennart can maybe implement these changes as a nice solution for large world streaming systems that have lots of in-common models across terrains when using mutliple systems.
     
    Last edited: Aug 25, 2020
    RafaelMartin, mick129 and dmenefee like this.
  36. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    IsDon, Emiles and combatsheep like this.
  37. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Will Unity 2020 be supported?
     
  38. wuming888

    wuming888

    Joined:
    Jun 1, 2020
    Posts:
    4
    Hello, Lennart
    Does the billboard system not support URP?
    I can see the billboard in the standard pipeline, but not in the URP. Is there a solution?
    My mother tongue is not English, through the translator to communicate, sorry Oh.
     
  39. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey, No SRP support yet. Can use VS Pro still but the shaders like Billboards and grass are not working.
     
  40. wuming888

    wuming888

    Joined:
    Jun 1, 2020
    Posts:
    4
    Use the grass patch generator to generate a grass model. Then, in the instance FPS, there can be less than 50. In instance indirect FPS, it's less than 20.
    What settings have I missed?
     

    Attached Files:

  41. wuming888

    wuming888

    Joined:
    Jun 1, 2020
    Posts:
    4

    Is this problem finally solved?
     
  42. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    166
    after working completely fine for months now that i release my game I have noticed that the trees on half of one of my maps have their billboards appearing right up close to the camera. So you have geometry trees and their billboards right on top of each other. For half the map it's completely fine. the other half has this problem. My two other maps do not have this issue at all. There is nothing unique about this problematic half of the map.

    The trees work fine in the editor, even playing in the editor it's fine. it's only when I do a build that I get this problem.

    Has anyone had a similar problem? Any ideas?
     
  43. psistalk

    psistalk

    Joined:
    Sep 23, 2013
    Posts:
    68
    Vegetation Studio is one of the best assets in the asset store. I do have a question tho. I use slope now to not place vegetation on roads is there a way to not place vegetation on a certain texture. I use gravel texture as roads. Thank you for the great asset and have been using vegetation pro for a bit now. It is a masterful asset.
     
  44. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Try using the texture mask in the lower part of the editor, under where you set the slope, height, etc. When you select it it will expand.
    What Makes it hard to use is that it uses a numbering system instead of names. So it might take some trial and error. I use this for basically the same thing, paths, and you can even set a blending so it is more real looking. Either blending into the path or blending outside the path in your case.

    the other option is creating a spline but the texture mask is the easiest if you have a complicated road network as it just removes the assigned veg object from that texture.

    but with the mask you have to do it with each grass, tree, rock, etc.
     
  45. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    I hope I’m not confusing the original with pro on the setup. I’ve used both. So I apologize if I have some details wrong. I’ve just finished a project and it has been a while since I did the vegetation.
     
  46. psistalk

    psistalk

    Joined:
    Sep 23, 2013
    Posts:
    68
    Thank you. looking into that. Has anyone got grass to work in URP? I know he is working on a new version for 2020 but I can find a solution that works.
     
    MarkusGod likes this.
  47. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Just finished my latest project, a classical music video called "By the Brook" using VSP.
    Thought I'd share it with everyone. This was developed throughout the pandemic as a form of relaxation.The music and scene were both began in February when everything was getting shut down. The music (composed by my wife) was finalized in late September and the scene was finally completed this week.

    The goal was to take a few minutes and relax and let all of the world's trouble pass you by and just have a few minutes of peace before you have to get back to reality. I hope you enjoy the escape.

     
    BackwoodsGaming, fusion242 and Rowlan like this.
  48. Dw009

    Dw009

    Joined:
    Oct 31, 2020
    Posts:
    1
    I'm also willing to make a video game... I think, I should make with unity.
     
  49. xarshi

    xarshi

    Joined:
    Jul 27, 2019
    Posts:
    7
    Very happy with this so far, provides a great starting point for vegetation. I'm not sure if this is mentioned elsewhere, but there are a few things that I've modified in my copy that I think others could potentially benefit from as well. I can share code with the author if desired, though its not exactly complicated stuff to implement. Perhaps this is all possible beforehand and I jumped the gun but I couldn't see any obvious ways to accomplish this stuff so went ahead and coded it; felt it would be helpful to others who aren't relying on procedural generation.

    The first thing is having vegetation masks optionally affect persistent storage. For me, this is actually fairly important as I am in effect trying to paint forests from a birds eye view and then carve roads into them (which are prone to change so baking didn't feel appropriate). Currently I have mine set up to mask persistent vegetation at spawn time using some extra jobs for that specific purpose similar to the SampleMask method in BaseMaskArea and its derivatives.

    I also added in vegetation palettes to the persistent vegetation storage editor to allow you to paint multiple vegetation items or entire forests with single clicks or brush strokes. To aid this, I also added an intensity field which will filter sample points at random during placement of persistent vegetation. I also added the vegetation type filter to the persistent vegetation storage editor, as well as a name filter to quickly search through larger lists of vegetation items. Using vegetation palettes and modifying the intensity of the brush allows you to achieve more variable placement and create areas with less dense vegetation while still retaining a fairly natural aesthetic rather than being obviously crafted by hand. These actually work quite well in letting you build vast forests that appear natural quite quickly.

    Figured I'd just bring those modifications up - if the author wants I can supply this code in private, though of course these changes are fairly trivial so I doubt thats necessary.
     
    Last edited: Nov 3, 2020
    dsilverthorn likes this.
  50. xarshi

    xarshi

    Joined:
    Jul 27, 2019
    Posts:
    7
    Made some changes to the previously mentioned stuff, and took some screenshots to better show what I'm talking about. I think I can extract the code I did myself to my own files and write some quick instructions on plugging it in to the assets code, I'm just not going to release actual vegetation studio pro code for obvious legal reasons. So I may do that if there is interest. Alternatively, if you have a private git repository somewhere I could always submit a pull request and you could look it over, I think it could be useful for others aside from myself.

    Anyways, I added in serialization for the palettes to make them more convenient when working on painting vegetation, and they do come in handy if you need to switch between different types of vegetation in the same biome (for my purposes I'm just using a single biome).

    Here is a little album showing what I'm talking about a little more clearly. First image shows a blank vegetation palette selected (if none is selected no add to palette button will appear of course, and if palette is empty painting proceeds as usual). Second image shows a quickly filled palette with all types of grass in the biome (I have a ctrl+click shortcut to add vegetation to the palette so it can be done in a few seconds). The third image shows what two mouse clicks with a vegetation palette can do - needless to say if you are trying to paint more complex environments in the persistent storage editor this little modification is quite handy.
     
    Last edited: Nov 7, 2020