Search Unity

[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. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yea it's definitely a mess to deal with dynamic terrains especially with the terrain colliders with trees, not an easy problem to fix but hopefully will have a solution soon :)
     
  2. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Got an error warning and all colliders in tree's pool won't be enabled when player come close:

    NullReferenceException: Object reference not set to an instance of an object
    uNature.Core.ClassExtensions.ClassExtensions.GetRelativeScale (Vector2 scale, uNature.Core.Terrains.UNTerrain terrain) (at Assets/uNature/Scripts/Core/Utility/ClassExtensions/UNClassExtensions.cs:239)
    uNature.Core.Sectors.TIChunk.OnSizeChanged () (at Assets/uNature/Scripts/Core/Terrain/Sectors/TIChunk.cs:68)
    uNature.Core.Sectors.Chunk.set_size (Vector2 value) (at Assets/uNature/Scripts/Core/Terrain/Sectors/Chunk.cs:76)
    uNature.Core.Sectors.Chunk.CreateChunk[TIChunk] (uNature.Core.Sectors.Sector sector, Vector2 position, Int32 x, Int32 z, Vector2 scale, Int16 chunkID) (at Assets/uNature/Scripts/Core/Terrain/Sectors/Chunk.cs:142)
    uNature.Core.Sectors.Sector.GenerateSector[UNTerrainSector,TIChunk] (UnityEngine.Transform owner, Vector3 bounds, uNature.Core.Sectors.UNTerrainSector sector, Int32 res) (at Assets/uNature/Scripts/Core/Terrain/Sectors/Sector.cs:131)
    uNature.Core.Terrains.UNTerrain.GenerateSector (Int32 sectorResolution, Boolean multiThread) (at Assets/uNature/Scripts/Core/Terrain/UNTerrain.cs:274)
    uNature.Core.Terrains.UNTerrain.GenerateSector (Int32 sectorResolution) (at Assets/uNature/Scripts/Core/Terrain/UNTerrain.cs:285)
    uNature.Core.Terrains.UNTerrain.get_sector () (at Assets/uNature/Scripts/Core/Terrain/UNTerrain.cs:121)
    uNature.Core.Terrains.UNTerrain.OnDisable () (at Assets/uNature/Scripts/Core/Terrain/UNTerrain.cs:443)

    Yesterday it was all fine, today I updated the MM terrain data (which I made yesterday's night at home) then this error shows up.
     
    ElroyUnity likes this.
  3. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Will take a look today when I get to the office :)

    EDIT:
    was able to take a look now, is there a UNTerrain attached to your terrain? seems like its not able to find it.
     
    Last edited: Jun 8, 2017
  4. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I'm using my script to apply UN Terrain to every terrain tile.
    I destroyed foliage manager, all terrain tiles and pools then apply uNature from window---uNature---auto apply uNature.
    Then repin the first terrain, it's then solved magically...
    Actually tried the steps before, not useful, but now it is fine, seems it's my own scripts causing this problem
     
    ElroyUnity likes this.
  5. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Hey Elroy!
    I was waiting to get documentation or more info about this asset to switch to it and replace my terrain w grass generation to a mesh with unature but Im not sure yet if unature is fully prepared to my necessities.

    I have a procedural terrain generation and I generate my terrains on runtime based on noise and divided by chunks (not fixed, but actually 400 units), and then I generate the grass based on the actual terrain conditions (noise, height, slope, etc), only for the close terrains, unity terrains, the far terrains are meshes right now with no grass support, I want to switch these close unity terrains to meshes with unature, but I want to know how can I handle the grass generation for these chunks in runtime, I watch some tutorials and one of them is about update one detail layer, but I need something similar to unity terrain where I can set a fully array of prototypes for a specific terrain chunk (mesh), or group of sectors, Im not sure yet how to do this with unature, I was waiting to a tutorial for this runtime generation, or more info about this subject but I didnt find it.

    Can you give me more information about this subject, if unature support this and how can I manage this?

    Thanks in advance.

    Ruben.
     
    ElroyUnity likes this.
  6. ElroyUnity

    ElroyUnity

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

    Well, seems like what you are looking for is something like the terrainData.SetDetailLayer isn't it?
    For making comaptibility easier, I added the exact method in uNature (FoliageCore_MainManager.instance.Set/GetDetailLayer) but instead of local cords it uses world coordinates.

    Or did you mean something else?
     
  7. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Any guess to when some MapMagic fixes will roll out? :)
     
    ElroyUnity likes this.
  8. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Hey,

    I have problems to understand how to work on chunks. so we can imagine I have a 400 unit size mesh("terrain") in -200,0,-200 , so the center of the mesh is in 0,0,0 and I want to add grass on it, in unity terrain I fill the data based on calculations of my detail resolution (128 or 256 depend on quality settings) and I set the details with:

    Code (CSharp):
    1. DetailMapData = new int[128,128];
    2. /** fill the details array information */
    3. terrain.Data.SetDetailLayer(0, 0, i, DetailMapData);
    How should I add the detail information? should I take into account the detail resolution? should I need to indicate the information based on x and z coordinates and per unit distance? need I perform resolution calculations based on the unit distance ? if you can show me an example here to how to set the information of the grass per layer it would be awesome.

    My main question is how can I limit the zone where I perform the grass changes, and to disable it should I set empty array of details or with 0 density?

    There is other ways to set the information, I think I watch an image with the information of the grass per color layer, can I set that image with the information? how is the information of the grass stored to increase the performance setting the information.

    I have multiple grasses , but I have a limit of grasses per chunk to avoid memory usage, unity store it as a splat map, so if I want to use for example 16 grasses in my entire world I dont want to use the memory to store all the grasses in the entire world, is this possible?

    Also I have questions about the grass heights, when I declare the grass of a chunk the mesh is already created, should I update the heights like this?:

    Code (CSharp):
    1. instance.UpdateHeights(-200,-200, 400,400,true);
    can I set the heights manually? I already have that information cause I generate the maps in runtime code, so I think it would be awesome to avoid unature to calculate it again.

    sorry for my huge post, but I have a lot of questions and I couldn't find any information about them.

    thanks in advance.
     
    Last edited: Jun 9, 2017
    ElroyUnity likes this.
  9. ElroyUnity

    ElroyUnity

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

    Regarding details - should be exactly like with the heights so:

    Var details = new byte[400, 400];
    FoliageCore_MainManager.instance.SetDetailLayer(-200, -200, details, prototypeIndex)


    Regarding heights - I actually need to add that, nice one. (Ability to insert pre calculated heights)
     
    buronix likes this.
  10. ElroyUnity

    ElroyUnity

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

    Fixed lots of issues with uNature so far, already pushed a few things but nothing map magic related. Rewriting the integration today, hopefully will be done by Sunday :)
     
    Dwight_Everhart and malkere like this.
  11. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Ok, thanks,
    but there is no other way to set a custom detail resolution ?

    I usually use 128x128 on a 400 units chunk for performance reasons.

    128 resolution = 16.384 calculations.
    400 resolution = 160.000 calculations.

    this is kind of mad for me, almost 10 times my actual calculations.

    Can unature change the resolution of their grids?
     
    ElroyUnity likes this.
  12. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Resolution changes are a bit broken atm, hopefully will have a fix soon.

    But I see where you are coming from... uhmm
     
    buronix likes this.
  13. diamonddesign

    diamonddesign

    Joined:
    Jun 9, 2017
    Posts:
    1
    I have a question of uNature workflow. My project has 6 large (8kmx8km) terrains - should I have one foliage manager per terrain, or one to manage them all?

    uNature_Workflow.jpg

    This shows problem - one foliage manager is too small to cover all terrains, too big for a single terrain? How to resize foliage manager with more chunks?

    Also, it stops working if I move the foliage manager - can I set the centre point of foliage manager? Or do I move everything else instead?
     
    ElroyUnity likes this.
  14. ElroyUnity

    ElroyUnity

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

    You should be able to move your manager :)

    Regarding the size - that is very surprising considering the size of a foliage manager is from -10k to 10k o_O

    Regarding using more than 1: well thats not supported, so only one :)
     
  15. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Well if its on the roadmap its fine to me, (well it would be awesome if it was working right now ofc xD).
    about the detail layers, if I use a detail in a grid, would the resources of that detail shared in the entire world?

    I will explain better myself, my map is pretty big (the reason to load it by chunks in runtime) and I will have a very large number of different grasses (different biomes, etc) so at start I included all my detail grasses in all the unity terrain data but I only use some of the grasses in each chunk, the result was a painful performance problem even with out set the data for the detail layer, unity terrains load and stored the resources for each detail layer, so I ended with a system to only load the detail grasses used in each chunk and Im afraid if this problem will be shared with unature.
     
    ElroyUnity likes this.
  16. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    On the current uNature version (Asset store) it will create on each chunk all of the foliage grass.
    BUT in the current repository version it will only generate the grass maps for the grass you paint, so if chunk A doesn't use grass_2 it wont generate it :)
     
    buronix likes this.
  17. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Thanks a lot for all!
     
    ElroyUnity likes this.
  18. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    @ElroyUnity
    Hi, regarding the size of foliage manager, how dose it work with infinite terrain? For now moving the manager will cause all the grass disappear, can the chunks be related to each terrain tiles? Or be dynamically streamed like terrain tiles?
     
    ElroyUnity likes this.
  19. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Interesting, will check it out.
    Regarding relating it to each chunk or an object - definitely on my plan list, will see what I can do :)
     
  20. Siamant

    Siamant

    Joined:
    Oct 27, 2016
    Posts:
    3
    HI, today i faced one problem - when i'm trying to add "Touch Bending" component to multiple objects, only first one works. what can i do to fix it?)
     
    ElroyUnity likes this.
  21. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Make sure that they are near the UNSeeker.
    Try to increase the Range on the Touch Bending Component
     
  22. Fabbs

    Fabbs

    Joined:
    Dec 2, 2013
    Posts:
    43
    Whenever i use UNature in a project i have a couple of problems. First of all when pressing play it takes foreveeeeeer to actually start playing (in editor) and when i switch from game view to scene while playing unity crashes. Any ideas?
     
    ElroyUnity likes this.
  23. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey, could you try the latest beta? It works a lot better

    Send me your invoice and email privately so I can add you
     
  24. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi Elroy, I'm wandering if this works ok for World Streamer? and Do I use uNature before I split up the scene?

    Thanx Alot Jim :D
     
    ElroyUnity likes this.
  25. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yes (I haven't tested it in the newest version but it shouldn't have broke), and yes :)
     
    llJIMBOBll likes this.
  26. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Been almost a year since I came here and uNature still doesn't seem to work at all with MapMagic =[
    I imported the latest repository in a fresh project. Some of the grass only draw as green boxes, some of the terrains don't draw any grass at all, drawing the grass onto a new terrain in runtime takes a full two seconds, the spread noise is still totally uniform under certain settings. Seems like it's gotten worse than it was a couple months ago =[

    Would really love to get uNature working sometime in the next few weeks the way my video schedule is moving. Stuck with ugly unity grass for now :(
     
    Dwight_Everhart likes this.
  27. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    I understand your pain :/ recently I wasnt able to dedicate much time into uNature or any project in general but it doesnt mean that I abandoned it. I will come back at full force soon and hammer those bugs :)
     
    Dwight_Everhart likes this.
  28. Sp-ce

    Sp-ce

    Joined:
    Feb 2, 2015
    Posts:
    65
    Hello,

    I'm a big Map Magic user and like so many others, I need a better grass/tree solution than Unity can provide. Should I wait before purchasing uNature in regards to Map Magic? Are they not working well together?
     
    Dwight_Everhart and ElroyUnity like this.
  29. ElroyUnity

    ElroyUnity

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

    Yes, I would recommend waiting for now, still have a lot of bugs to fix :)
    Will be sure to post here when its all fixed and working together :)
     
    Dwight_Everhart and Exbleative like this.
  30. Sp-ce

    Sp-ce

    Joined:
    Feb 2, 2015
    Posts:
    65
    Okay, thanks for the honest feedback! As soon as they're fixed I'll buy for sure.

    Cheers!
     
    ElroyUnity likes this.
  31. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    @Harekelas Were you able to resolve the errors about tuples? I just bought and installed uNature to use with MapMagic, but these errors are keeping me from building and running my game.

    @ElroyUnity From reading other posts, it sounds like there are many issues with the MapMagic integration. Should I try the beta, or would it be better to wait?
     
    ElroyUnity likes this.
  32. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Regarding Tuple errors, just replace Tuple with TupleSet.

    The current asset store version seems to be better than the beta (for now) so I would say stick with it :)
     
    Dwight_Everhart likes this.
  33. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    TupleSet fix worked so I tried again using the store version with MapMagic instead of the repository version and it works much better. Only the spread noise seem to be broken. Will try it in a real project.


    Not working as well in my main project. Floating grass in places, and only rendering on Terrain 0,0. Also rendering a million times faster than normal grass and looks way better.
     
    Last edited: Jun 20, 2017
    Dwight_Everhart and ElroyUnity like this.
  34. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    @ElroyUnity I installed uNature and fixed the compilation errors by replacing the two occurrences of Tuple with TupleSet and deleting the Plugins import. I ran the Flat demo scene, but the character controller falls through the terrain. This also happens with the Forest demo scene. Is there something I need to configure? Both the terrain and the controller have colliders. I'm running Unity 5.6.1p3 on macOS 10.12.5.
     
    Last edited: Jun 20, 2017
    ElroyUnity likes this.
  35. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    That is the first time I am hearing that o_O
    Could you try in a new scene?
    Will try reproducing that today :)
     
  36. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hey, Elroy!
    I'm tinkering around to find a way to solve the terrain tree colliders issues with MapMagic,
    I got an idea: I make 2 prefabs for trees, one is model without colliders and this one is to be planted on terrains through MM, and the other is only colliders without model and this one is used to let uNature generate the trees pool, the only thing I need to do is going into uNature's scripts and set some sort of link between these two prefabs and let the pool use the collider prefab instead of grabbing colliders from terrain trees.
    What do you think? Let me know if you've got something better!
     
    ElroyUnity likes this.
  37. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    That's a cool idea! might actually work :)
    You can get the code at UNTerrain.cs, its in the bottom, in the method: "CreatePool"
     
  38. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Unfortunately, I gave up trying to make uNature work with MapMagic after spending a few hours on it without getting any grass to appear at runtime. I saw grass in the scene view but not when I ran the game. I'll try again when you have a new release with improved MapMagic integration. I'm excited by the potential uNature has, but I don't have time right now to deal with a lot of integration issues. Good luck!

    I didn't see any collider issues when working with my own scene, but I wasn't using your character controller.
     
    ElroyUnity likes this.
  39. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yep I understand,
    Will try to get a much more stable integration build out soon enough, thanks for trying and sorry for the inconvenience!
     
    Dwight_Everhart likes this.
  40. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    No problem. I understand some of the challenges of writing software for an engine like Unity, where you don't have the source, and it runs on a dozen platforms with hundreds of supported GPUs. It's challenging, especially for low-level stuff like you're doing. Good luck.
     
    ElroyUnity likes this.
  41. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Thanks! Will keep you updated with the progress :)
     
  42. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, Elroy!
    I've managed to use the method I mentioned before to avoid the terrain tree colliders, and even get it generate the collider's pool more quickly!
    But now I have another uNature issue that the colliders are not following my player quickly enough. This makes me run through terrain trees when I leave the original position about 1 or 2 hundred meters.
    And there are some tree's colliders are not applied even when my player is standing beside it for a long time, but when I run away for about 50 meters the missing collider shows up. I checked that the enabled colliders are not reaching the limits in the pool (15 colliders per tree by default, but I reduced it to 7 to save some time when enabling new terrains.
    Any ideas how to make the collider's positions more precise?
     
    ElroyUnity likes this.
  43. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yea seems like for some reason the priority system is broken, seen it with someone else as well. This week I hope to push a fix for the trees priority system and some more fixes to the grass system :).

    Will keep you updated!
     
    Harekelas and Dwight_Everhart like this.
  44. FungusMonkey

    FungusMonkey

    Joined:
    Jun 30, 2016
    Posts:
    41
    OK, bought this a while back but just trying it out now. Been busy with other things .When I import, I get three errors where it appears I am missing scripts.

    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?

    Assets/uNature/Scripts/Core/Extensions/Integrations/MapMagic/Integration/UNMapMagic_Manager.cs(365,16): error CS0246: The type or namespace name `Tuple' could not be found. Are you missing an assembly reference?
     
    ElroyUnity likes this.
  45. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    the using Plugs line is at the top of that script, just comment it out with // it's not needed
    the tuple errors need to be renamed TupleSet instead of Tuple then they will work fine.
     
    Dwight_Everhart and ElroyUnity like this.
  46. FungusMonkey

    FungusMonkey

    Joined:
    Jun 30, 2016
    Posts:
    41

    Thank you very much. :)
     
    ElroyUnity likes this.
  47. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Cheers :)
     
  48. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I logged in literally the moment he posted, lol
     
    ElroyUnity likes this.
  49. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Haha :D

    Btw, working on map magic fixes, I hope to get a fully working version soon enough (finally).
    Been slacking off lately due to personal stuff that I need to put time into so I apologise for that :)
     
  50. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi,@ElroyUnity
    Any news on uNature's mapmagic fixes?