Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Vegetation Studio

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

Thread Status:
Not open for further replies.
  1. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Nice. you imported them using the Terrain Tree Importer module?
     
  2. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
  3. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    yes

    the terrain was also made in Gaia .. a bit of stamping madness :)
     
  4. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @LennartJohansen It is an interesting development with TerraFirma. The combination seems a natural fit. Do you have any time frame guides at least as I am wanting to grab both of these or the combination or whatever it ends up being. Ready to test it right now actually as I need to make some decisions soon on the terrain/foliage tech used and these seem to fit the requirements perfectly.
     
    ZoneOfTanks and AlwaysBaroque like this.
  5. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Superb! The only remaining question is when will this asset release, I'm gonna try it with no doubt! :D
     
  6. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    First version of Vegetation Studio will be sent to asset store review in just 3-4 weeks if the rest of beta testing goes as planned.

    Terrafirma core tech is working but we have a list of features we want to add. We also want to make a high and low level API, the high level designed similar to the Unity Terrain API. It will make it fast and easy for existing terrain tools and systems to support and edit the Terrafirma terrain.
    The low level API will help to give direct access to the internal buffers for more advanced manipulation.

    The API for 3rd party tools is important as we want to focus on a performance with the core mesh terrain technology and not another system for stamping or procedural terrain generation.

    We are looking at a few months before a beta with most of the functionality. When we get the first version of Vegetation Studio shipped we will start adding Terrafirma documentation to the website and make a separate forum thread. I post development progress there as we complete features.

    I will post the link her and in the old Terrafirma forum thread when we have something online.

    Lennart
     
  7. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @LennartJohansen Thank you for the informative reply. Clarity is very important when looking at tech and tools.

    I can only speak for myself in saying that all sounds very nice but I personally would like to suggest that there may be a number of people that would be more than happy to have just a basic fast rendering pipeline for the systems they already have, even if this required a simple conversion step before use. Is something like that possible?
     
    ZoneOfTanks and b_game_studios like this.
  8. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    There will be a import system to import the height and splatmap from existing terrains. This is a good option for existing terrains. For new projects/terrains it would be much better with direct API access from terrain tools. Helps you work faster.
     
  9. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Good to hear. I was kind of hoping that this might align with timing of a major development I am on but I am now a little concerned that the risk with this may be too great as it is now a sometime next year product before we can even test it, which may now be too late in the development to switch tech. I thought it may have been one of the ducks in a row, but looks to be swinging on the hook now. I'm sure it will be good when it arrives though.
     
  10. LennartJohansen

    LennartJohansen

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

    I have added a small importer module. It helps you import grass textures from a Unity terrain and set up the rules for spawning. You will have to manually set the type to plant if the texture is a plant or flower. Also set the rotation mode as grass is set by default to follow the terrain and scale for the additional area of steeper hills.

     
  11. ranaUK

    ranaUK

    Joined:
    Mar 1, 2017
    Posts:
    166
  12. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi there!
    One more question just come into my head:
    I'm using MapMagic to create and stream terrain tiles in runtime, so the terrain tiles are not in the scene, but pop up during runtime.
    Can vegetation studio support that?
    And I'll put some rocks through MpMagic on the terrain, they are of my own item objects which have mono scripts on them with functions( like mining rocks produce stones), can vegetation studio auto detect gameobjects and avoid the trees to grow on rocks?
     
  13. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    1. We did a small plugin component for use with MapMagic infinite terrain. It will instantiate a new VegetationSystem based on a reference VegetationSystem component you provide when it detects a new Terrain created by MapMagic.
    Have a look at the website for a small guide. http://www.awesometech.no/index.php/set-up-with-map-magic-infinite-terrain/

    2. Vegetation system will not detect the rocks automatic, but there is a system designed for that. You can add and configure a VegetationAreaMask on the rock prefabs. When added to the scene the mask with register with the VegetationStudio manager and control spawning. The masks has multiple settings. you can remove trees and objects from spawning on your rocks but still allow grass to grow closer etc. In additon to this you can add a TouchBendCollider component to your rocks that will make sure grass does not grow into the rock.


    Rock with a TouchBendCollider


    This is an example with a House with a VegetationArea mask. You can have different distances for trees, grass plants etc.
     
    Last edited: Sep 19, 2017
  14. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    So basically I'll just add mask component to my rock prefab then the system will avoid vegetation overlapping on them, right?
    And it's great to know that MapMagic is supported already!
    Now I'm eager to know how can I join the beta?
     
  15. TylerO

    TylerO

    Joined:
    Aug 21, 2011
    Posts:
    35
    Hi Lennart,

    I have a question - does the system work for non-Unity terrains? We're looking at using your asset (which looks great btw!) for our game, but we use Voxel based terrain - specifically using the Voxeland asset (https://assetstore.unity.com/packages/tools/terrain/voxeland-9180)

    Looking forward to hearing back from you.
     
    Harekelas likes this.
  16. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Yes, just add and adjust the mask on the prefab.

    Send me a PM about beta.

    Lennart
     
  17. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. At release Vegetation Studio will only support Unity terrains.

    We have started the work of accessing the Unity TerrainData using a wrapper class that implements a custom interface. When done it will be possible to make other classes that implement this interface. It could then be used to create support for mesh terrains or systems like Terrafirma or Voxeland.

    making a custom Voxeland class would be done with a custom class implementing the interface. This class would have to provide the dimensions of the terrain and implement functions to sample height and terrain normal at a position.

    Ideally this would be done using internal functions in voxeland that support multithreading. If this is not possible a raycast version of the class could be implemented but the spawnprocess would fallback to single thread cell spawning.

    I will talk to Denis about the voxeland API.
     
    Last edited: Sep 19, 2017
  18. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
    when do you think it release?

    greetz Reiner
     
  19. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. If everything is going as planned 3 weeks and the time unity uses, but there is still a bit of work again on the list.
     
    antoripa likes this.
  20. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    One more question about the billboard shader, does it written into depth buffer so that custom global fog can work well with them?
    for example I'm using Tenkoku dynamic sky and it has it's own global fog than using unity's fog, I found some billboard shaders can not react with it, but speedtree's billboard shader can apply the fog.
    I'm not very happy with speedtree generated billboards, the quality is a bit low, and I see that this asset's built in billboard quality is quite impressing, wondering if it can work with all global fog or only unity fog?
     
  21. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The billboards write to the depth buffer.



    Here is a screenshot of the depth buffer from the debug mode of the post processing stack. As you can see the billboard trees in the back write the same way as normal meshes.

    The billboards can also cast shadows. Here I increased to a large shaodw distance to get billboard shadows at a distance.

     
    ftejada, mwituni and docsavage like this.
  22. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great! I've sent a PM to you asking about the beta :)
     
  23. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Fantastic work Lennart, the potential here is immense. It really takes unity to another level vegetation wise.

    I've only scraped the surface so far but it is clear that even in beta this package provides substantial improvements. I need to spend a few days with lighting and fine tuning but with an hour of throwing things into the editor and trying settings I was getting very good results.
     
    mwituni and LennartJohansen like this.
  24. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I got a little sidetracked from completing the Vegetation Studio release today and made something new.

    I added a new component to Vegetation Studio. The VegetationColorMaskCreator. Just add to any gameobject with a VegetationSystem component and press the button.




    The idea of this is to be able to render out a high res unlit color map of all the vegetation in a terrain. This is a combination of all run-time spawned and vegetation added manually in the persistent storage. You can render all vegetation but the main idea is to render out grass, flowers and smaller plants to a mask.



    this is a 4096x4096 export of my demos scene terrain, rendered in the editor from the actual meshes of the grass and plants added to the terrain. took about 10-15 seconds to spawn and render, but since it in editor it does not matter that much.

    Next step will be to use this on a terrain shader set up to blend this data into the terrain at the point of the far culling on the grass. This way you reduce/remove the grass cutoff edge you can get.

    I will try to get this running on a terrain and add some screenshots tomorrow. If it turns out good it would be a nice and super fast way of adding grass/plant range.
     
    ftejada, feathersock, Seneral and 5 others like this.
  25. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Man, you're out of control. Over the years people have repeatedly claimed that an Asset Store plugin should be, "picked up by Unity" or "hire this guy". This is one of those assets that legitimately should be picked up by Unity.

    This is basically a must have asset for high quality terrain in Unity now, there's no way around it.
     
    ZoneOfTanks and AndyNeoman like this.
  26. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I'm wondering if I can let MapMagic export the tree's locations directly into Vegetation Studio, for I have to use many geo data generated by MM to place the trees but have no idea how to let vegetation studio use these data as well.
    For example:
    upload_2017-9-21_17-24-18.png
    I generated a river in my mangrove biome and excluded the river bottom from the areas for generating mangrove trees.

    upload_2017-9-21_17-26-41.png
    But other pools will allow trees to grow inside, these two areas are both inside Mangrove biome and have no special texture. But I use the date to generate the river to prevent trees grow in rivers.
    Don't know how to achieve this kind of results through Vegetation Studio?
     
  27. LennartJohansen

    LennartJohansen

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

    1. It is possible to import trees from existing terrains using the importer module included in the persistent storage.
    This will set up the Vegetation Items in the VegetationPackage and import all instances, including scale and rotation.



    There is also a scene object importer that will allow you to import rocks or trees if you have them in the scene as GameObjects. This is done by matching names, tags and layers.

    2. To exclude trees in a area or include custom vegetation in another you can use the VegetationMaskArea , VegetationMaskLine and VegetationBeacon components.

    Have a look at the links.

    Lennart
     
    Alverik likes this.
  28. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    The problem is I have to let MapMagic generate my terrain tiles in runtime, and I don't think let the importer to import terrain foliage into Vegetation Studio at runtime is a good idea.
    Maybe I'll just assign a special texture for the rivers and let textures from MM to control the generation in VS.
    BTW, does VS able to recognize MegaSplat's texture arrays?
    For unity's terrain shader is quite slow and limited by 4 textures per pass. I'll change to MegaSplat which support 256 textures in one pass, and that system seems to use an entire different rendering method. Don't know if the texture data can be accessed from unity terrain's terrain data.
     
  29. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I did not know it was run-time. Adding a texture for the rivers sound like a good solution.
    When using MegaSplat you can not use the terrain texture rules. They read from the splatmap and MegaSplat uses a control texture.

    Vegetation Studio has support for both the control and params texture from MegaSplat. On the Mask Tab in the VegetationSystem component you can add new texture masks to the Vegetation package.
    Add a mask of the MegaSplat control texture type and assign the texture.



    you can then make "Texture mask rules" on the Vegetation Items that test for the texture index used on a location. The index is the position of the texture in the MegaSplat texture index.
     
  30. TylerO

    TylerO

    Joined:
    Aug 21, 2011
    Posts:
    35
    Hi Lennart,

    That sounds great. There are some methods that allow you to get blocks based on position, but I believe that only returns the byte that represents the specific block. So am not sure there is some API call (yet!) to get the specific height of a column (but I could be wrong)

    What could work is reading the data - which, as I have been told by Denis, is basically just a list of bytes explaining each column - first with the block type, and the number of blocks of that type going up. You could likely determine the height this way :)

    I will definitely keep my eyes peeled on this asset, it looks great, and if not supported out of box, having the ability to support it (and any other mesh based terrain system) ourselves would be good as well!

    Regards,
    Tyler
     
    LennartJohansen likes this.
  31. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great to know that it supports megasplat as well.
    And does the mask function work with runtime generated terrains? Or should I assign the splat map for each terrain manually?
     
  32. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Masks you add to the VegetationPackage has 2 storage modes. They can be referenced in the VegetationPackage or by the VegetationSystem. If referenced by the package it will use the same mask on all terrains using this package. This is good for noise, some distribution masks etc.

    If set to be referenced by the VegetationSystem component they are unique for each terrain. You would have to make a script that gets the run-time generated megasplat control mask and assigns it to the VegetationSystem component.
    I probably need to expose a function to do this but it is not hard to do.

    If we look at this together we might be able to find a general way to do this. Maybe add this to the MapMagic plugin that exist today.
     
    Alverik likes this.
  33. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    It'll be excellent if we can add it into MapMagic's output node!
    I'm quite familiar with MapMagic but only started to learn how to use MegaSplat, I'll start digging tonight :)
     
  34. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I finished the VegetationColorMaskCreator component.
    It now allows for exports up to 8k textures.


    It is set up with default values that should work, just add the component and press generate. It will ask for a location to save and create the mask texture. Mask is saved with Alpha

    The idea behind the mask was to use it with terrain shaders and blend in the mask at the distance where mesh grass is removed.

    I took some screenshots with the mask on and off to show the result.









    You do see a difference where the grass stops, a bit less specurlar highlights. But compared to without the difference is huge.

    Microsplat has added a custom Vegetation Studio function for the masks. Just assign the texture and fine tune with a tint color. The start distance is set automatic from the current vegetation distance in Vegetation Studio.

    I am also talking to Bart about how to use the mask with the new color mask feature they are adding in CTS, we need to remap the alpha a bit but then I think it should work. I will keep you updated on this.
     
  35. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Nice results! Can this texture be rendered in runtime?
     
  36. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    In therory yes, but took me 15-20 seconds to spawn and render the 1.4 million grass and plant instances in the mask.
    Code is editor only now but if someone needs it for run-time use I can move the parts needed.
     
  37. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    The release candidate of Unity 2017.2 is out. I did a test build. Except for 2 warnings that will be easy to fix the latest beta seems to run as it should.
     
    ZoneOfTanks and Alverik like this.
  38. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    upload_2017-9-23_2-31-4.png
    I was playing with VS and planted the first kind of trees on my terrain tile, then there seems to be a problem, the leaves rendering got overrided by Tenkoku's skybox rendering. Lower part that got covered by the terrain is somewhat normal.
    But seems still can't render in front of the bark.
    These trees are using optimized unity tree creator's shader, they look right in the scene view but transparent in game view:
    upload_2017-9-23_2-37-22.png
    I'm using unity's post-processing stack, don't know if this can affect the tree leaves rendering.
     
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will send you a PM about details.

    Update: It seems like this only happends with the Tenkoku skybox enabled. I will try to investigate. My guess is some render queue related problem with Tenkoku and instanced Optimized tree creator shader.
     
    Last edited: Sep 22, 2017
  40. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Is there already a system in place for saving/load changes. For example a rock that gets used up or removed from game. My game is very harvesting heavy. Should I be throwing around little mask components or?
     
  41. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Edit:- Fixed issue over with my settings..
     
    Last edited: Sep 23, 2017
  42. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Sent you a PM to get some more info.
     
  43. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I will explain in a post a bit later today.
     
    Alverik and malkere like this.
  44. LennartJohansen

    LennartJohansen

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

    I have finished some work on integration for 3rd party shaders.
    Vegetation Studio is by default using Instanced Indirect rendering for grass rendering. The grass instances are uploaded to a computebuffer on the GPU and rendered direct from the buffer. This does not have the 1023 instances per batch max as instanced rendering has and you do not need up upload the instance list to the GPU every frame.

    In order for a grass shader to support instanced indirect rendering and the Vegetation System framework it needs to run a setup function to set the ObjectToWorld and WorldToObject matrixes for each instance.

    this is done by adding
    #pragma instancing_options procedural:setup

    The setup function will then read the matrixes from a structured buffer provided by Vegetation Studio.
    In addition to this there is 2 parameters _CullFarStart and _CullFarDistance. These are also set by Vegetation Studio and used to fade/scale out grass in the distance. This is also handled by the setup funtion.

    This will now also work on shaders made in Amplify Shader Editor. Put everything except the #pragma line in a .cginc include file. Then add this as an include file. The latest Amplify version also supports adding custom pragma lines.

    The changes needed for this will be in the next beta version of Vegetation Studio.

    Code (csharp):
    1.  
    2.  #pragma instancing_options procedural:setup
    3.  
    4. #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    5. struct IndirectShaderData
    6. {
    7.     float4x4 PositionMatrix;
    8.     float4x4 InversePositionMatrix;
    9. };
    10.  
    11. StructuredBuffer<IndirectShaderData> IndirectShaderDataBuffer;
    12. fixed        _CullFarStart;
    13. fixed        _CullFarDistance;
    14. #endif
    15.  
    16. void setup()
    17. {
    18. #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    19.  
    20.     unity_ObjectToWorld = IndirectShaderDataBuffer[unity_InstanceID].PositionMatrix;
    21.     unity_WorldToObject = IndirectShaderDataBuffer[unity_InstanceID].InversePositionMatrix;
    22.         #define transformPosition mul(unity_ObjectToWorld, float4(0,0,0,1)).xyz
    23.         #define distanceToCamera length(transformPosition - _WorldSpaceCameraPos.xyz)
    24.        
    25.         float cull = 1.0 - saturate((distanceToCamera - _CullFarStart)/ _CullFarDistance);
    26.         unity_ObjectToWorld = mul(unity_ObjectToWorld, float4x4(cull,0,0,0,0,cull,0,0,0,0,cull,0,0,0,0,1));
    27.        
    28.         #undef transformPosition
    29.         #undef distanceToCamera
    30. #endif
    31. }
    32.  
     
  45. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hi, this looks great. I was wondering if you have an evaluation? I am interested in using it for surprisingly small scenes - is there still any benefit in cases like that?

    And also, is it for terrain purposes only? Can I use meshes?

    Thanks :)
     
  46. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    You still get the benefit on the instanced grass and all the procedural placement tools, the run-time polygon mask system etc, but since the overhead of unity processing all gameobjects, culling etc is much less on very small scenes I guess the speed gain in percent will be lower.

    Currently terrains only. I am working on accessing all the terrain info using a interface. When this part is complete it will be possible to implement a MeshTerrain version or other terrain systems.

    I will send you a PM.
     
    Last edited: Sep 23, 2017
    Alverik, manpower13 and antoripa like this.
  47. lawsochi

    lawsochi

    Joined:
    Oct 24, 2016
    Posts:
    107
    Hi, this is the most anticipated asset in the store ...
    Take your time, let the launch be fantastic, we all really need that your sales exceed all expectations, and you could develop for many years ...
     
    Alverik and LennartJohansen like this.
  48. LennartJohansen

    LennartJohansen

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

    I was asked to explain a bit how to set up a harvest system using Vegetation Studio.
    There is now an example included in the demo scene of the Beta.



    Vegetation Studio has 2 main sources of vegetation.
    • Run-time spawned vegetaion from rules.
    • Persistent storage. Persistent storage is used for manual edit, import from terrain, 3rd party systems using the API or run-time rules that is baked to the storage
    A harvest system should work with trees, rocks etc. from both sources.
    In the example video I have one of the tree types set up with a capsule collider.



    These colliders are created run-time by the ColliderSystem component for trees close to the camera.



    When a collider is created it gets an VegationItemInstanceInfo component. This holds the position, scale, rotation, VegetationType and VegetationItemID of the instance.



    In the script below I raycast for the collider on MouseDown, detect the presence of a VegetationItemInstanceInfo on the collider and do my harvest logic.
    In order to remove the tree it has to be masked out from the terrain. This is done by creating a gameobject with a VegetionItemMask and assigning the VegationItemInstanceInfo to it.



    Code (csharp):
    1.  
    2. void Update()
    3. {
    4.        if (Input.GetMouseButtonDown(0))
    5.        {
    6.            RaycastForHarvestObject();
    7.        }
    8. }
    9.  
    10. void RaycastForHarvestObject()
    11.         {
    12.             Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    13.             RaycastHit raycastHit;
    14.             if (Physics.Raycast(ray, out raycastHit))
    15.             {
    16.                 GameObject hitObject = raycastHit.collider.gameObject;
    17.                 VegetationItemInstanceInfo vegetationItemInstanceInfo = hitObject.GetComponent<VegetationItemInstanceInfo>();
    18.                 if (!vegetationItemInstanceInfo) return;
    19.  
    20.                 //We have detected a collider spawned from the collider system. Here we can add more logic to confirm that this is a object we can harvest. In this example we accept all types as harvestable
    21.  
    22.                 //Now we create a new GameObject with the VegetationItemMask component. This will mask out the selected VegetationItem. If you want this item to respawn include a script with logic that will remove it when time has passed.
    23.                 GameObject vegetationItemMaskObject = new GameObject {name = "VegetationItemMask - " + hitObject.name};
    24.                 vegetationItemMaskObject.transform.position = vegetationItemInstanceInfo.Position;
    25.                 vegetationItemMaskObject.AddComponent<VegetationItemMask>().SetVegetationItemInstanceInfo(vegetationItemInstanceInfo);
    26.  
    27.                 //Spawning an particle system for effect
    28.                 SpawnHarvestEffect(vegetationItemInstanceInfo.Position);
    29.             }
    30.         }
    31.  
    The tree will then be masked out and you can instantiate any object with your effect, falling tree etc.
    if you want the tree to return later just destroy the mask item.
    For loading/saving games you will be responsible for serializing and recreating the VegetationItemMask objects.

    If you are working only with vegetation from the persistent storage there is another possible solution.

    The persistent storage has an API where you can remove VegeationItems.
    follow the procedure from above but call

    Code (csharp):
    1.  
    2. VegetationStudioManager.RemoveVegetationItemInstance(VegationItemInstanceInfo);
    3.  
    this will remove the instance from the storage.
    You could then add another at the same location that was a tree stump etc.

    The end result is the same but you do not have to work with the VegetationItemMasks.
    Since the persistent storage does not save updates outside the editor you will have to log your changes and apply them at scene load.
     
    Claytonious, Caffeen, POC0bob and 8 others like this.
  49. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Vegetation Studio and Sentieri ....what else ?

     
    Mark_01, tapawafo, Olander and 2 others like this.
  50. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great to see an example of harvesting!
    It raised some questions: what do you intend to do the integration with MapMagic? Will the trees generated from MM's node be treated as persistent trees or dynamic ones?
    And about the collider, I noticed in the beta, there are only one collider for each tree, I'm wondering if it's possible to assign custom colliders for each tree type. I use colliders on tree to test if player is under shadow, and this factor affects the sunlight heat on the player and can not be achieved by only a capsule collider on the root of a tree.
     
Thread Status:
Not open for further replies.