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

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
    Yes, I'm using the MapMagic's VS node. PMing right now =)
     
  2. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    Is there a way to have some water plants float on top of water? Using AQUAS.
     
  3. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    use aquas bouyancy? it would kill your fps touh.. projection? naah that more suitable for leaves..
     
  4. LennartJohansen

    LennartJohansen

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

    You would have to make some custom code to get the plants follow the water movement. Problem is speed. You do not want to do this on the CPU as it could potentially be a lot of plants. One solution could be to make a GPU version of the Aquas wave math. Then add a section to the compute shader in Vegetation Studio that does frustum culling.
    There you modify the Matrix4x4 that holds the mesh position/rotation/scale to follow the wave.

    This have to be done before the frustum culling part since the wave might move it into view.

    Send me a pm if you want to give it a try. I can show you where inject your code.

    Lennart
     
    recon0303 and mattis89 like this.
  5. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    I dont have my tree trunks when i place them with Vegetation Studio..When i put them in scene manualy by draging in from Hierarchy they have everithing.. :/
     

    Attached Files:

  6. LennartJohansen

    LennartJohansen

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

    What trees/shader are you using? Could the tree be split up in multiple meshes?

    Lennart
     
  7. fmoeglich

    fmoeglich

    Joined:
    May 24, 2016
    Posts:
    2
    Hi, I trying to remove trees (with possibility to re-grow) dynamically from terrain.
    I have access to desired VegetationItemInfo and using 'RemoveVegetationItemInstance'
    I have terrain with initialized 'Persistent Storrage' but with custom Debug.Logs I see that method stops in file 'PersistentVegetationStoragePackage' on method 'RemoveVegetationItemInstance' saying that 'persistentVegetationInfo' from 'GetPersistentVegetationInfo(vegetationItemID)' is null

    For test I using free camera which is casting raycast and trying to remove vegetation instance at position, if hits gameObject with 'RuntimeObjectInfo' component.
    After few tries I noticed that something happening after using 'RemoveVegetationItemInstance' it looks like it is destroying tree but respawning it immediately (inspector shows null transform for a blink, but in game view it isn't noticable)

    What I am doing wrong? Can't figure out right now.
     
  8. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    You can remove and add instances with the persistent storage API. But if you want the tree to regrow it could be better to create an VegetationItemMask that will remove the tree as long as the component is present.

    Have a look at the harvesting script in the demo scene. It does this. This approach works for run-time spawned vegetation also.

    Just send me a pm if you have more questions.

    Lennart
     
  9. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    Has anyone else had the following happen when going in to play mode? The scene initialises, the camera shows the terrain and there's no vegetation at all and then after a second or two it suddenly pops up?

    Am I missing an option somewhere to get it all to appear before the scene is shown?
     
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi.
    The way the culling group works in Unity we can only get the internal cell culling working from frame 2.
    I am adding an event at first render that allows you to remove loadscreens etc. I will also try to do a manual culling the first frame to have the right selection.

    Lennart
     
  11. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    Hmm... perhaps I need to have 2 cameras initially - the main one to render the terrain, VS, etc. and a secondary one that is initially active but pointing somewhere to a 'blank' area so you don't see the pop in of the
     
  12. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Easiest solution is probably to make a loading screen image you have full screen on a canvas and turn this on at the "first render vegetation" even I am adding now.

    Lennart
     
    Mark_01 likes this.
  13. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    its prefeb that have 2 parts 1 of them top and other is trunk trunk uses Legacy Shader / Bumped specular..
     
  14. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi.
    That is probably the issue then. Vegetation has to be a single mesh. Multiple submeshes and materials works good.

    Using multiple meshes would complicate the structure and be slower since we would have to store and process a Matrix4x4 for each mesh (they could be children with a different orientation/position). With submeshes this is not a problem.

    Lennart
     
  15. BrokenVector

    BrokenVector

    Joined:
    Feb 2, 2017
    Posts:
    40
    Is there any way to blend the edges of perlin noise? I have a dense 2D grass that looks weird because it just stops at the edge. If I add another grass with a lower cutoff and density to make it appear like it's fading, the second grass overlaps the original so I am getting additional renderings that I would prefer to not have for optimization purposes. Any ideas?
    Cheers
     
  16. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will look at using the 0-1 value of the perlin as a density and not a cutoff. that will give a more smooth transition.
    Adding this as an option.

    Lennart
     
    BrokenVector and Mark_01 like this.
  17. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    That sounds like a good option. Rarely do you get such defined boundaries in nature. This will just make already exceptional looking grasses look even better :D
     
    BrokenVector likes this.
  18. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    hey :)

    what about adding a noise slider under the perlin noise ? i could really use that one too !

    same thing when you want to limit vegetation spawning with Height ... transition is very abrupt and unatural.
     
    BrokenVector likes this.
  19. DragonmoN

    DragonmoN

    Joined:
    Nov 27, 2016
    Posts:
    26
    Hello there, does Vegetation Studio work with WebGL builds? (Targeting only WebGL 2.0)
     
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I do not think WebGL 2.0 supports instancing. I did a test now with the lates 2018.1 beta.
    I managed to get it running in the editor with some components disabled and render mode to normal but you loose all the speed benefits of instanced rendering that Vegetation Studio is built on...

    Lennart
     
    DragonmoN likes this.
  21. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will look at the noise.

    For the height rules there is an advanced mode you can enable. then you can configure a curve for the height distibution that will give you a gradual result.

    Lennart
     
    mattis89 and sarum like this.
  22. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    I'm probably overlooking extremely simple and obvious, but how can I stop grasses from spawning close to trees and leave a small area around each tree? (a bit like the area around that can be made around a navmesh obstacle)
     
  23. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    good question
     
  24. DragonmoN

    DragonmoN

    Joined:
    Nov 27, 2016
    Posts:
    26
    Thank you for testing. At least it works, which should be enough to beginn with :)
    Found somehting in Unitys Manual, where it lists WebGL2.0 to supports GPU instancing.
    https://docs.unity3d.com/Manual/GPUInstancing.html
    Dont know if his helps.
     
  25. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    I wish I could double like this post !
     
  26. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Hey Lennart, any progress on the pooling system for multi-tile terrains?

    Also: Did I read somewhere that you are planning to add dynamic snow on trees? (I know I can swap out different veg packages for snowy trees, but I'm thinking of dynamic accumulation during snowfall.)
     
    mattis89 and cygnusprojects like this.
  27. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    +1
     
    mattis89 likes this.
  28. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I found the same info, but in playmode Unity reported. Instancing not supported. Target was set to WebGL 2.0 only.

    Lennart
     
    DragonmoN likes this.
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will try to get a prototype pool ready later this week.

    What I want to add is a way to pass snow and wetness info to the shaders. Then 3rd party shaders that support this can get the settings passed to the matierial.

    Lennart
     
    AndyNeoman and Mark_01 like this.
  30. LennartJohansen

    LennartJohansen

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

    Lennart
     
  31. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    Thanks. I was sure I'd read something like this before, I just couldn't remember where I'd seen it. :D
     
  32. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Development update.

    Hi. I just submitted a new update to the Asset Store. It should be available soon.

    This is the list of changes

    Lennart

    Improvements
    • Speedtree vertex LODFade is now working on Unity 2018.1+
    • Added LightProbeUtility to extract lighting components from SphericalHarmonicsL2
    • Trees and objects can now be painted on the peristent storage.
    • Max radius on painting tool increased.
    • Max sample distance on painting tool increased
    • Grass meshes generated with the GrassPatchGenerator now supports the wind in the HD.Lit shader of the HD SRP
    • Added single and Quadoption for billboard atlas (1x1 and 4x1)
    • Added a Gaia extention to easy add Vegetation Studio to scenes with Gaia terrain.
    • Added advanced option to enable editing Vegetation Item IDs
    • Vegetation Masks now have an optional Ground Layer for snapping to terrain. This is for future mesh terrain use.

    Changes
    • Increased perlin noise max value to 500

    Fixes
    • Fixed error when trying to paint with an empty vegetation package. Fix for washed out billboards in Linear mode on 2018.1
    • Fixed material refresh when changing some spawn rules not syncing accross multiple vegetation systems
    • Fix for computeshader link error on OpenGL on Windows.
    • Added fix for curve labels in wrong color on light skin.
    • Colliders now work for instanced indirect rendered vegetation items
    • Fix for error in Amplify Editor node for touch bend
    • Added workaround for another asset hiding the UnityEngine.Tools class
    • Fixed error that could happen in 2018.1 with Speedtree lodfade and invisible trees casting shadow.
     
    ice2011, ftejada, AndyNeoman and 4 others like this.
  33. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Hello,

    I'm getting this error, I believe it has to do with having over 64 items added:

    IndexOutOfRangeException: Array index is out of range.
    AwesomeTechnologies.VegetationSystem.UpdateVegetationInstanceLists () (at Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/VegetationSystem.cs:1325)
    AwesomeTechnologies.VegetationSystem.ExecuteRenderVegetation (Boolean forceRender) (at Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/VegetationSystem.cs:1979)
    AwesomeTechnologies.VegetationSystem.Update () (at Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/VegetationSystem.cs:1876)

    Is there a limit of 64 items Vegetation Studio can handle?

    Thanks in advance,
    Nathan
     
  34. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    delete the last item you added, and add it again
     
  35. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. There is a 64 item limit on the internal threading pool. I am adding a workaround for this.

    Lennart
     
    nathanjams and mattis89 like this.
  36. Suavomirro

    Suavomirro

    Joined:
    Dec 3, 2012
    Posts:
    61
  37. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Excellent update @LennartJohansen . This one I was really waiting for it's great to have colliders on instance indirect trees.
     
  38. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Unity 2018.2 Beta 1

    Hi. I just did some fast testing on the new 2018.2 Beta that was released today. Everything seems to be working with Vegetation Studio.

    Lennart
     
  39. Paratope

    Paratope

    Joined:
    Jun 27, 2017
    Posts:
    20
    Hey, where exactly did you exclude the vegetation layers in Enviro? I'm having this same exact bug. I did as you did; put all vegetation on a different layer, and then excluded that layer from Enviro Lightning Prefab's culling mask. But the artifacts still persist. Thanks for your helpful post.
     
  40. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Make sure the vegetation that is rendered instanced indirect is on different layers. You can set this on the render tab.
    Search for "light" in the project. this should give you all the objects with a light on. Find the enviro lights that are not the main directional light and exclude the instanced indirect layers.

    Switching to Deferred mode would also remove this issue since the lighting is done on the g-buffer. In the 2018.2 Beta Unity added instanced support for multiple ADD passes in shaders. I did not have time to test this yet, but I will when the beta gets stable. Should be only 1 pragma setting to add in shaders.

    Lennart
     
  41. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    @LennartJohansen Could you explain the difference between Sample Distance and Density. They both seem to do the same thing.
     
  42. Pryzmeister

    Pryzmeister

    Joined:
    Jan 21, 2015
    Posts:
    26
    Hi, i am having an issue where i cannot modify splatmaps and receive an error when clicking the Generate Terrain Splatmap button.

    I am using Unity version Unity 2017.3.1f1 (64-bit)

    when i press it i get the following error:

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[AwesomeTechnologies.TerrainTextureSettings].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    AwesomeTechnologies.TerrainSystem.GenerateTerrainSplatMap (Bounds bounds, Boolean useBounds, Boolean clearAllLayers) (at Assets/AwesomeTechnologies/VegetationStudio/TerrainSystem/TerrainSystem.cs:245)
    AwesomeTechnologies.TerrainSystemEditor.DrawGenerateInspector () (at Assets/AwesomeTechnologies/VegetationStudio/TerrainSystem/Editor/TerrainSystemEditor.cs:98)
    AwesomeTechnologies.TerrainSystemEditor.DrawAutoTextureInspector () (at Assets/AwesomeTechnologies/VegetationStudio/TerrainSystem/Editor/TerrainSystemEditor.cs:115)
    AwesomeTechnologies.TerrainSystemEditor.OnInspectorGUI () (at Assets/AwesomeTechnologies/VegetationStudio/TerrainSystem/Editor/TerrainSystemEditor.cs:72)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1253)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Thanks in advance for any assistance
     
  43. LennartJohansen

    LennartJohansen

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

    There is several settings that affect vegetation spaning.
    • There is a global density setting for grass, plants, trees, object and large objects. The idea behind this is to set up your scene with the default density of 1. Then use these settings to run-time modify density based on user settings or hardware. You can have a mode for low end computers that render grass and 50% (0.5) or increase it at a "Ultra quality" mode
    • Sample distance is used to set up a samle grid on the terrain where each point is evaluated based on all enabled rules to see if a vegetation item would be spawned.
    • The distance setting is used on top of this as a spawn chance for each sample point. Setting a lower density will give a bit different distribution than a higher sample distance. Items could still be spawned closer together based on the random sample. This value is also there to allow Vegetation Mask include rules to modify density for the mask area. The density you set on vegetation masks are multiplied with the set density.
    Lennart
     
  44. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I will add a test with a warning message to this. It seems related to the number of textures on the terrain and in the vegetation package. Are they the same?

    Lennart
     
  45. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Forum

    We just passed 100 000 views on the Vegetation Studio forum thread :)

    Lennart
     
    ice2011, blitzvb, Mark_01 and 6 others like this.
  46. LockedInside

    LockedInside

    Joined:
    Jul 28, 2010
    Posts:
    16
    Hi Lennart, congratulation for the great audience :)
    I saw on this post that you 'll work on a event system for the scene loading, is this still topical ? I am trying to optimize the scene loading, but I got a huge fps drop and no vegetation for a few seconds at start.
     
    mattis89 likes this.
  47. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Hey I have a question, So I'm using Blender to create my "Terrain" can this some how work on a mesh or does it have to be a terrain system? Please Say Yes!!! lol
     
  48. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    m
    mesh is supported
     
    Aaron2348 likes this.
  49. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I will get the onFirstRender event included for the next update.

    Lennart
     
    LockedInside likes this.
  50. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    This week.

    I am traveling for a few days this week. I might be slow responding on the forum and Discord.

    Lennart
     
Thread Status:
Not open for further replies.