Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[NEW PATCH] uNature - GPU, Interactable Grass. Interactable Trees, MultiThreading and more!

Discussion in 'Assets and Asset Store' started by ElroyUnity, Apr 29, 2016.

?

Pre-release Integrations

Poll closed Nov 29, 2016.
  1. TerrainComposer2

    43.1%
  2. GAIA

    54.9%
  3. GENA

    49.0%
  4. World Creator

    13.7%
  5. World Streamer

    37.3%
  6. Map Magic

    27.5%
  7. Landscape Builder

    0 vote(s)
    0.0%
  8. SkyMaster ( Weather )

    7.8%
  9. InfiniGrass, AFS, DX11 (Integration will provide built-in shader support)

    33.3%
Multiple votes are allowed.
  1. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    I commented out, "using Plugins;". That fixed the error and didn't seem to break anything.
    However I can't figure out how to get uNature working with MapMagic. Any chance of a quick tutorial?

    Oops. Messing around I broke something. I added a foliage Manager to a MM terrain, painted some grass, then added a Grass generator in MM. All the grass disappeared and got a red flag. Now even the uNature demo scene has no grass and throws this error:

    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[System.Int32,uNature.Core.Utility.FoliageGrassMap].get_Item (Int32 key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
    uNature.Core.FoliageClasses.FoliageManagerInstance.UpdateGrassMapsForMaterials (Boolean poppulateMapPixels) (at Assets/uNature/Scripts/Core/Foilage/GPU_Utilities/FoliageManagerInstance.cs:572)
    uNature.Core.FoliageClasses.FoliageCore_MainManager.WarmUpGrassMaps (uNature.Core.FoliageClasses.FoliageCore_Chunk[] specificChunks, Boolean AdvancedPoppulation_MeshInstances_MapPixels) (at Assets/uNature/Scripts/Core/Foilage/GPU_Utilities/FoliageCore_MainManager.cs:735)
    uNature.Core.FoliageClasses.RenderingPipielineUtility.CreateRenderingQueue (uNature.Core.FoliageClasses.RenderingQueueReceiver receiver, Boolean threaded) (at Assets/uNature/Scripts/Core/Utility/RenderingPipelineUtility.cs:67)
    uNature.Core.FoliageClasses.RenderingQueueReceiver.CreateInstances (Boolean threaded) (at Assets/uNature/Scripts/Core/Utility/RenderingPipelineUtility.cs:859)
    uNature.Core.FoliageClasses.RenderingQueueReceiver.CheckPositionChange () (at Assets/uNature/Scripts/Core/Utility/RenderingPipelineUtility.cs:837)
    uNature.Core.FoliageClasses.FoliageMeshManager.DrawEditorCameras () (at Assets/uNature/Scripts/Core/Foilage/GPU_Utilities/FoliageMeshManager.cs:507)
    uNature.Core.FoliageClasses.FoliageMeshManager.Update () (at Assets/uNature/Scripts/Core/Foilage/GPU_Utilities/FoliageMeshManager.cs:497)
    uNature.Core.FoliageClasses.FoliageCore_MainManager.Update () (at Assets/uNature/Scripts/Core/Foilage/GPU_Utilities/FoliageCore_MainManager.cs:317)​
     
    ElroyUnity likes this.
  2. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    You added a foliage manager to an MM terrain? What do u mean? o_O


    Also the steps are simple -
    1) Enable extension
    2) Create foliage manager
    3) Add UNSeeker to player
    4) Repin current terrains

    And done!
     
  3. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    I scrubbed that. Started a new project with MapMagic and uNature. Followed your steps above. As soon as the repinned terrain popped, I got the same error "KeyNotFoundException" and no grass. :/
     
    ElroyUnity likes this.
  4. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    I reran the same process but this time I had the MM Editor window open, AND IT WORKED! :D
    I think the error was something to do with Prototypes not populating. When I had the error the Prototype Management list was empty, but when it worked it had automatically populated the existing grasses.

    I've got it working in the MapMagic scene, but when I went back to the ForestDemoScene, this error popped up again and no grass. The Prototype Management window still has the grass from the Map Magic scene.
     
    ElroyUnity likes this.
  5. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yea to deal with prototypes for each scene I am adding presets to 2.3
     
  6. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Hi, Elroy
    I also got the same error warning:
    "Assets/uNature/Scripts/Core/Extensions/Integrations/MapMagic/Integration/UNMapMagic_Manager.cs(10,7): error CS0246: The type or namespace name `Plugins' could not be found. Are you missing an assembly reference?"

    I'm using the asset store MapMagic 1.8 and uNature 2.2.1 from asset store in Unity 5.5.2
    This looks like an universal issue, any hot fix?

    Edit: I tried to rerun with MM editor window opened, still no luck...
     
    ElroyUnity likes this.
  7. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yep sorry,
    Just remved that "using Plugins;" line at the top :)

    Sorry for that, will submit an hotfix soon!
     
  8. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Hi, Elroy.
    Is there any tutorial to show how to set up uNature with MapMagic properly?
    I found the mapmagic's grass output can transfer the data directly to uNature's sectors, but can not hide the sectors with terrain tiles when some of them are hidden for long distance to the player.

    And I cannot figure out how to transfer the trees' data into uNature's pool, there is no dynamic generated trees pool for every terrain tile. Just need to know how to let uNature set everything up automatically in runtime when some new terrain tiles are generated or hidden by MapMagic.

    Edit:
    I ran into another problem with grass: all the grass disappear regularly for 1-2 frames every 2-3 seconds if I move a bit quickly in runtime ( say running with FP character), I tested it with and without mapmagic, both have this issue, any ideas?
     
    Last edited: May 22, 2017
    ElroyUnity likes this.
  9. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Regarding trees - yes that is correct didnt get to integrate them yet unfortunately, will be added soon :)

    Regarding grass staying - thats fine for now as I am workimg on a manager instance streaming solution which is aimed to fix it :)


    Regarding grass dissapearing - this was fixed long ago in the beta(and in the current asset store version), what version are you using?
     
  10. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    The latest asset store version, 2.2.1
    I'm thinking maybe it's because of the low frame rate? around 16 FPS.
     
    ElroyUnity likes this.
  11. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhmm could be -
    could you try reproducing this on a new project?

    Try disabling multi threading in Window/uNature/Settings/General and see if that fixes it (obviously will fix it if thats the case)

    Also, could you check what's producing that low fps? (related to uNature?)

    And lastly, if its uNature then the streaming solution for dynamic terrains will most likely fix it :)
     
  12. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    I'll try it tomorrow, and the low FPS is not caused by uNature I'm sure, I'm developing on a low hardware PC. A thousand speed trees with 4k tris each can cause very low frame rate.
     
    ElroyUnity likes this.
  13. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    With this asset is it possible to access properties of each single tree so that I can change its appearance during game play. e.g The tree is healthy and green then later it is unhealthy and losing its bark.
     
    ElroyUnity likes this.
  14. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Not precisely, it doesnt allow you to access the tree prototyoe directly, you will have to do some coding but not sure how worth it would be :(
     
  15. InvertedCat

    InvertedCat

    Joined:
    Apr 16, 2017
    Posts:
    22
    Hi we are also interesting in purchasing it. Whats the overhead of placing a new tree into the scene during runtime? We constantly have trees growing and being chopped down. Also are we able to control the tree size when placing the trees?
     
    ElroyUnity likes this.
  16. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey-

    Placing a tree would require you to just place a unity tree as at the end of the day uNature's trees interaction is based on the unity tree system, once you do that uNature will update automagically :)

    Note that the terrains must have UNTerrain attached and you will need to disable the tree colliders on the Terrain Collider (unity doesn't expose that unfortunately) and lastly, have a UNSeeker on your player/ camera.
     
  17. InvertedCat

    InvertedCat

    Joined:
    Apr 16, 2017
    Posts:
    22
    Thanks for the reply. Unity tree system as in the tree creator? What about speedtree?
     
    ElroyUnity likes this.
  18. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    No, there isnt any custom trees solution in uNature atm it simply uses the terrain trees and allows you to interact with them. Nothing more atm.

    The custom stuff happens on the grass where its a completely different rendering approach than unity's
     
  19. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hello,

    do you support non terrain trees? I would like to interact with trees, e.g. tank drives in the tree and the tree falls. That is possible by dropping the tree in the scene, but not with the unity tree editor. I'm hoping that your asset can also speed up that kind of trees.
     
    ElroyUnity likes this.
  20. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Nope, not atm :/
    Sorry! But it will be done in the future :)
     
  21. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    If @ElroyUnity allows you to have some form of callback when a certain object collides with a tree (OnColliderEnter) then you could delete that tree and replace it with a version with a rigidbody?
     
    ElroyUnity likes this.
  22. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yep thats one approach you can go with,
    Pretty easy :)
     
    Stormy102 likes this.
  23. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi @ElroyUnity I have a question before buying your asset, I've seen that it pretty much is an amazing replacement for the ugly unity trees and grass handling system, but I need to know if I will be able to do this things:

    1. place any kind of tree or prefab: being able to place trees from speedtree or tree creator or even mesh prefabs with LOD for example for rocks, or even abandoned cars in a city.

    2. place trees (or any of the above mentioned) in any place, and not only in terrain surface:
    this would be necessary to be able to place trees in for example, meshes, in pre made parks, above road meshes, above anything or anywhere.

    thanks!

    EDIT: to clarify, I'll probably don't need any of the stuff regarding effectors and interactable trees, I'm working on a game that occurs in different cities, kind of simcity or cities skyline, and I need fast rendering of trees with different LODs and billboards, but these trees are pretty much static, and the camera will stay almost always at a distance where I don't even need wind effects happening.
     
    ElroyUnity likes this.
  24. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey -

    Sorry the trees in uNature aren't like the grass, they use the built-in terrain system so pretty much all you written above is no as of now :)

    What you said above is the grass system hehe, the trees are only interaction as of now ( I plan on making a custom tree system like the grass in the future )

    Sorry!
     
  25. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    so you are saying that I could use the grass placement system to place anywhere and any mesh? including trees, rocks, or any mesh renderer? (also with LOD and custom components in it?)

    thanks!
     
    ElroyUnity likes this.
  26. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Well, the grass system wont work wtih anything that uses more than 1 mesh/ more than 1 material.
    So I would not recommend using it for anything other than grass.

    I hope that the UTrees (which will come this year maybe) will cover that :)
     
  27. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,209
    @Dorian-Dowse how did you get uNature to work with MM? I can kind of get it to work with a fresh install, but not with my main project. Are you in Unity 5.5 or 6.0? Elroy has fixes on the way, but you said you got it working, sounds like with no problems. Would love to get that far! =D
     
  28. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    I wouldn't say no problems. I had all sorts of problems. I managed to over-come most of them to get it working. However, I couldn't get it to transport. We have a pipeline. I make the terrains then pass them over for integration into the main project. The terrains with uNature would arrive with no grass. Tried all sorts of things and couldn't get it to work. So I've dumped uNature for now.

    Some things to try:
    Make sure your Grass generator is top level. uNature won't read from biomes. (though I was able to trick it by replicating my grasses in a top level generator)
    Have the seeker on your character first with the camera reference filled.
    Have the MM editor open when installing the Foliage manager.
    Unpin the repin the terrain, then force generate.

    If you have multiple scenes with different grass in each, forget it. uNature doesn't support this.
     
  29. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Indeed, using it on a personal project (map magic + uNature) I found a lot of problems in both.

    Listed them all and will start working on a huge hotfix in a day or two!

    (Will post the full list in a few days!)
     
  30. pixelR

    pixelR

    Joined:
    Sep 16, 2013
    Posts:
    58
    Hello, I just started to test uNature in my scene and I'm wondering:

    1) how to delete *any* grass with the Foliage Manager painter, not just the selected prototype (as in Unity's workflow, where Shift + Left click erases everything under the brush)

    2) how to avoid painting prototypes (grass) only on the Unity terrain but not on meshes... If I paint right ow then there is grass even on top my houses, fences, etc.

    Thanks for the help in advance. :)
     
    ElroyUnity likes this.
  31. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey!

    1) Not possible atm, select all of the prototypes and then click shift + lctrl (will be added in the upcoming update)

    2) Basically follow the following steps:

    1. Move your terrain to a unique layer (lets say -> Terrain)
    2. Go to the foliage manager window and at the bottom you will see "Map Generation Mask", you will see that its set on default, remove the default (Click no on the opened dialog), then add your unique terrain layer (in our case Terrain) and then click Yes.

    Once that's done it will only consider your terrain layer :)
     
  32. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    hi, Elroy, I ran into some problems using uNature with MapMagic again...
    1. it seems uNature has problems when I use the same grass texture for several different grass types, in the foliage manager it generated a dozen of the second grass type that used the same texture as the first grass type. Or is it because I used two output nodes for grass in MM.
    2. Then I deleted all exceeded grass types, copied the texture and named it another name. Created a new grass type for this copied texture, everything seems fine now. But then I found this problem: all the grass disappeared when I enter play mode, it's not the UNSeeker problem, I got UNSeeker on player (used uNature's first person controller), the grass also disappeared in editor, they'll come back when I exit play mode.
    3. The grass looks quite uniform, like planted in grid, not in the exact places MapMagic outputs, and they tend to grow on places they shouldn't, there is a big difference between MM generated grass and uNature manipulated grass.
    4. Can I disable uNature's grass feature and only use the interactive trees feature? For now I can't really get uNature compatible with MM, and there is a huge freeze when a new terrain tile is generated with uNature processing the grass. Considering only use the interactive trees system for game mechanics.
     
    ElroyUnity likes this.
  33. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey!

    1) Yea I experienced that as well, found a fix and will apply it to the upcoming fixes update :)
    2) uhmm didn't see this one, regarding duplicating the same texture (yea that's the work around I used before), could you get me some reproduction steps for the in game issues?
    3) "3. The grass looks quite uniform, like planted in grid, not in the exact places MapMagic outputs, and they tend to grow on places they shouldn't, there is a big difference between MM generated grass and uNature manipulated grass."

    Yep Indeed, will be fixed in the patch as well, easiest work around is to play with the resolution of map magic.
    4) "Can I disable uNature's grass feature and only use the interactive trees feature? For now I can't really get uNature compatible with MM, and there is a huge freeze when a new terrain tile is generated with uNature processing the grass. Considering only use the interactive trees system for game mechanics."

    The trees feature isn't yet supported with MM, I made a lot of changes to the interactive trees with V2.2 and the new fixes version will add the compatibility.


    I am very sorry for the time it takes, but I am really trying to fix any kind of an issue that I find to make sure its all working good, some of them would be:

    1) Map magic Integration generation time and inaccuracy.
    2) Map Magic Integration issues
    3) HUGE scene sizes
    4) Memory usage
    5) Adding manager instances streaming so it wont always allocate new ones when not needed
    6) Rewriting the shaders to be faster and look better.
    7) Hopefully improve rendering times even further
    8) Fix some internal errors that I noticed
    and more..
     
    iddqd likes this.
  34. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Good to know that the fix is on the way!
    I suspect that the disappearing grass is concerned to my terrain's layer? I set my terrains to a custom layer, not in default layer. Or it is just because of the remained data from problem 1 I mentioned up there. I don't know how to clear the grass data generated by uNature, tried to destroy foliage manager from Foliage panel then recreate it, no help, it cannot read data from MM again, but using the cached data. Any way to reset all data so I can try to locate the problems :)
    BTW, when approximately will the next update that can fix all those problems come out? My project is about to build an alpha version, it's a bit hurry now :(
     
    ElroyUnity likes this.
  35. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yea I think it relates to the first problem.
    Regarding estimation really cant tell :/ very busy but will try my best to get it out asap :)
     
  36. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    So how can I clear the cached or remained data? Will re-import uNature help? Or is there any button I can click?
     
    ElroyUnity likes this.
  37. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhmm remvoing the foliage manager should be enough. But try to reimport if for some strange reason it didn't work.
     
  38. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    My trees are well optimized: kinetic rogidbody, no update methods on script and just a trigger collider on trees (infantry can walk through trees/forest and vehicles hit the trees). At trigger collider enter the rigidbidy kinetic will be unchecked and the collider will be a non trigger collider. Instantiating the tree prefab must be done by knowing the rotation and scale. And then I would need pre-instantiated trees, because processing Unity's Instantiate method is pretty heavy.

    But this feature is not that important, but I always wondering why Unity tree editor trees are polished, interacting with them is not that simple. I have 7000-8000 trees (Big env. packs) in an RTS, if the camera angle is small, not fp view, then the performance is acceptable. The trees have also lods, that can be also adjusted. But however, I feel the impact, if I scroll over dense tree areas.
     
  39. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    I ran into this. It turned out I didn't have the Camera reference set on the UN Seeker.

    Same here. It's like neat little rows of grass.
     
    Dwight_Everhart and ElroyUnity like this.
  40. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    I may found the source of this problem finally XD
    I wrote my own script to apply tree's pool and some other terrain based scripts ( like uConstruct's base socket script and Ceto's auto shore mask script) on every terrain tile when they are generated. The grass will disappear if I put my script on MM object. I think maybe I did something wrong on applying tree's features on terrains.
    Any suggestions?
     
    ElroyUnity likes this.
  41. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhmmm could you send me what you have done? Maybe I can find out :)
     
  42. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    I would like to have a bit more customizable bending effect. At least one that DirectX 11 Grass does. Is there any chance to add custom bending variants? Or maybe is there a possibility to do the same bending that DirectX 11 Grass (asset) does? Somehow the grass should restore its bending after a much more longer time. E.g. tank rolls over the grass.

    Hint: The grass (tinted by terrain color) looks awesome, especially from top down, from where I need it.
     
    ElroyUnity likes this.
  43. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Regarding bending - I am currently rewriting the shader, so I will most likely be looking at improving it :)
     
    mkgame likes this.
  44. pixelR

    pixelR

    Joined:
    Sep 16, 2013
    Posts:
    58
    How can I fix the "Chunk cannot be found" error?

    Also, is there any ETA already for Gaia and Gena integration? As I see those are part of 2.3, but I'm a bit worried as I see many other stuff as well for 2.3 and right now it is a bit messy to create foliage from GeNa generated grass. :( Does "GeNa Output Reading" mean that if I do anything with GeNa then it will be automatically *merged* with what I have already to be GPU instanced by uNature?
     
    ElroyUnity likes this.
  45. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey -
    Fix the chunk cannot be found? it basically means that no chunk is created, its fine :)
    or are you talking about something else?

    Regarding the GeNa integration unfortunately it's not within my powers, I spoke to Adam a few times but unfortunately he didn't add a callback that I requested which is essential for the integration so I really can't do anything about it.
     
  46. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Hello again, I have a quick question about MM and uNature:
    uNature need to disable terrain collider's "Enable Tree Colliders", it's easy to do so in editor but I need to disable it when new terrain tile is generated in runtime. Can't find any API to do so, any ideas?
     
    ElroyUnity likes this.
  47. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Unfortunately unity never exposed it which is why I had to delay the trees support, so I am currently looking for work arounds
     
  48. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Hi Elroy,
    I'm using MM's world shift function to avoid glitching shadow, then I found the grass disappeared after the terrain and the foliage manager got moved( they moved the same distance)
    How do I use uNature with this MM feature?
     
    ElroyUnity likes this.
  49. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Oh did he add world shifting now? o_O
    Uhmm rewriting the integration now to fix all of the issues and will take a look of that now as well.
     
    Last edited: Jun 6, 2017
    iddqd likes this.
  50. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Good to hear that the integration is in developing.
    In the mean time, I managed to write my own script to apply the tree's pool in runtime, but still got the world shift problem I said up there and the terrain tree collider issue. My displaced model trees always got blocked by the terrain tree collider, very annoying :\
    Can't wait to see your solutions!
     
    ElroyUnity likes this.