Search Unity

MapMagic 2 - infinite procedural land generator

Discussion in 'Assets and Asset Store' started by Wright, Apr 24, 2020.

  1. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I don't believe there is a limit on unity terrain textures. The built in shader just draws the terrain once for every 4 texture sets on the terrain (regardless of if they are used or not), so it will draw as many as you like, just getting slower and more memory intensive (for the uncompressed splat maps) every 4 textures.
     
  2. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    99
  3. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    @jbooth thanks for the clarification. That code I posted does seem to fix that index out of bounds I was getting with the microsplat node generator though. Any idea if that is correct?

    @Wright hope you feel better!
     
    Duffer123 likes this.
  4. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Hope you are on the mend and feeling better soon.
     
  5. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Does anyone know why this weird greenish blueish coloring happens at distant pinned tiles?
    Seems to only happen when using microsplat node too.
    upload_2020-7-23_20-42-39.png
     
  6. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    99
    For everyone having issues using MicroSplat and MapMagic 2 together (including manually painting the terrain with MicroSplat layers. I did a quick video on the solution:
     
  7. tgamorris76

    tgamorris76

    Joined:
    Apr 24, 2013
    Posts:
    292
    Hi, quick question. I want to create a biome set with polar, temperate, desert, temperate, polar. and i'm having difficulties. How would i go about it anyone pls?
     
  8. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    When i build my project MM2 not generate next tiles...its just white tiles without anything...i can see only pined tiles ...rest is just flat white spots...how to fix?
     
  9. tgamorris76

    tgamorris76

    Joined:
    Apr 24, 2013
    Posts:
    292
    Found something in the doc's that explained it. Now im curious how to increrase the size of the temperate/desert band on larger maps
     
  10. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Make sure architecture is x86_64 in the build settings.
     

    Attached Files:

    Nunez-Torrijos and malditonuke like this.
  11. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Ive found that if you use the whittaker node, and with your precipitation noise, add contrast node to the precipitation, it will generate wider areas of non precipitation areas..like deserts..see my screenshot (this works for me):

    upload_2020-7-25_14-15-11.png

    This is working really nice for me.
     
    Nunez-Torrijos and RagingJacob like this.
  12. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Hi Denis, hope you are feeling better, I found an index of out of bounds bug with vegetation studio that happens quite frequently with the 2.0.5 version of map magic, to fix it, I did this:

    In the VegetationStudioTile class:
    See the 'START - Bug Fix 1' and 'START - Bug Fix 2' comments below:

    Code (CSharp):
    1. public static void FlushObjects ( Rect terrainRect, bool clearCache = true ) {
    2.             VegetationSystemPro system = GameObject.FindObjectOfType<VegetationSystemPro>();
    3.             if ( system == null )
    4.                 return;
    5.  
    6.             PersistentVegetationStorage storage = system.PersistentVegetationStorage;
    7.  
    8.             PersistentVegetationStoragePackage storagePackage = system.PersistentVegetationStorage.PersistentVegetationStoragePackage;
    9.             if ( storagePackage == null )
    10.                 return;
    11.  
    12.             List<VegetationCell> overlapCellList = new List<VegetationCell>();
    13.  
    14.                 // START - Bug fix 1:
    15. QuadTree<VegetationCell> vegetationCellQuadTree = system.VegetationCellQuadTree;
    16.             if ( vegetationCellQuadTree  != null) {
    17.                 vegetationCellQuadTree.Query(terrainRect, overlapCellList);
    18.             }
    19.                 // END - Bug fix 1
    20.  
    21.                 int cellCount = storagePackage.PersistentVegetationCellList.Count;
    22.             for ( int i = 0; i < overlapCellList.Count; i++ ) {
    23.                 int cellIndex = overlapCellList[i].Index;
    24.  
    25.                 //storagePackage.PersistentVegetationCellList[cellIndex].ClearCell();
    26.  
    27.                 // START - Bug fix 2:
    28.                 // Check IOB exception.
    29.                 if ( cellIndex < 0 || cellIndex >= cellCount ) {
    30.                     continue;
    31.                 }
    32.                 // END - Bug fix 2
    33.  
    34.                 var infoList = storagePackage.PersistentVegetationCellList[cellIndex].PersistentVegetationInfoList;
    35.                 for ( int j = 0; j < infoList.Count; j++ ) {
    36.                     var itemList = infoList[j].VegetationItemList;
    37.  
    38.                     for ( int k = itemList.Count - 1; k >= 0; k-- ) {
    39.                         Vector3 pos = itemList[k].Position + system.VegetationSystemPosition;
    40.                         Vector2 pos2 = pos.V2();
    41.  
    42.                         if ( terrainRect.Contains(pos2) ) {
    43.                             itemList.RemoveAt(k);
    44.                             //storage.RemoveVegetationItemInstance(infoList[j].VegetationItemID, pos, 1, clearCellCache:false);
    45.                         }
    46.                     }
    47.                 }
    48.  
    49.                 //VegetationItemIndexes indexes = VegetationSystemPro.GetVegetationItemIndexes(vegetationItemID);                
    50.                 //system.ClearCache(overlapCellList[i],indexes.VegetationPackageIndex,indexes.VegetationItemIndex);
    51.  
    52.  
    53.             }
    54.  
    55.             //if (clearCache)
    56.             //{
    57.             //    for (int i=0; i<system.VegetationCellList.Count; i++)
    58.             //        system.VegetationCellList[i].ClearCache();
    59.             //}
    60.  
    61.             system.RefreshBillboards();
    62.         }
     
    Last edited: Jul 26, 2020
  13. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Unity 2020 has been released. I have not been tested right-click menu with the release version yet (while in hospital), but if it has any problem - try enabling the experimental new-style right-click menu. It's enabled by turning on Experimental Features in Window - MapMagic - Settings (since ver.2.0.3). I'm going to expand it with some advanced features like search string and make it default in Unity 2020 or later, but now you've got to turn it on yourself - sorry for that.

    jimmygladfelter, thanks! Will look into it a bit later!
     
    Last edited: Jul 31, 2020
    RagingJacob likes this.
  14. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Hi, I decided to have a first try at Biomes, this is the result when I run the tutorial demo that comes with the module. Any ideas why? Using Unity 2019.4.4f1Personal.
     

    Attached Files:

    Last edited: Jul 27, 2020
  15. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    99
    Make sure the heightmap (default 256) is the same for all your maps. Use a curve instead to regulate the height.
     
  16. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I'm also trying to build a Whittaker biome map but the names on the node don't match the names in any Whittaker diagrams online. The count is also different. Can you please share where you got these names from so they can be matched?
     
    Nunez-Torrijos likes this.
  17. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    I had a similar issue when I tried to determine what the outputs were (mainly the difference between tropical rainforests and tropical forests and the difference between mild rainforests and mild forests. So I ended up combining the outputs of tropical rainforest and tropical forest and combined mild rainforest and mild forests. I made a google doc (converted it to pdf and attached it here) of my findings...maybe it would be of use to you.
     

    Attached Files:

  18. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    Rainforests are composed of evergreen trees but Forests are composed of deciduous trees. That's the main difference between those two biome types.

    One problem I'm running into is the biome often called "grassland/cold desert". Other diagrams online mix up even more biomes. The closest I've found so far is the link below but I have no idea if it matches the MapMagic node classifications.

    https://www.researchgate.net/figure/Whittaker-Biome-Diagram-derivation-Whittaker-1975_fig3_330811543

    Edit: That's a good pdf, thanks. I've added it to my reference.
     
    Nunez-Torrijos likes this.
  19. tgamorris76

    tgamorris76

    Joined:
    Apr 24, 2013
    Posts:
    292
    How do i create a shoreline with no plants below it? pls help
     
  20. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    I bought MapMagic 2 Objects -module to use with Vegetation Studio Pro but when I import the package to my project, it lacks of VsProObjectOuts.cs which is in package description in Asset Store. What I am missing?

    EDIT. With the helpful people from the discord-channel I managed to get it working. I removed mm2 asset store package from unity appdata cache and redownloaded them. Now I see vegetation studio pro -folder. so issue solved lol
     
    Last edited: Jul 29, 2020
  21. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    99

    Also make sure you use contrast to tweak the strenght of the texture, the better the contrast, the less bleeding from other textures, the better the vegetation masking
     
    Nunez-Torrijos and mick129 like this.
  22. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Hi Denis, hope your are feeling better.

    I was wondering if you had some trick that could help me to set the textures based on the height?
    Example:
    Sand texture below the sea level
    More snow above X level etc.
    Thank you!
     
  23. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    It would be really nice if the VSProMaps node could be used with more than just one package. I wasn't aware of this until I started to create a function for a different biome. I added an initial biome (grassland package) and all was fine and then I added my new biome VSPro package (savanna)...and saw that my VSProMaps node that referenced my grassland package now references my savanna package. Seems I will have to combine a ton of objects into one package which is pretty hard to manage. Just an fyi..both packages had separate texture masks where vegetation of that area occurs.
     
    Nunez-Torrijos likes this.
  24. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    upload_2020-7-30_23-19-28.png
     

    Attached Files:

  25. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    I actually was able to implement this myself by modifying the VSPro nodes of MapMagic. Added a global setting for enabling global package (current MM version) or multi package support. Also got rid of some IOOB exceptions and optimized setting the mask textures as well so that there is not a texture set unless there actually is something to mask for the different mask groups of each vspro package.

    Added these:
    upload_2020-8-1_12-27-54.png

    And now my project can have multiple vspro packages/biomes now:
    BTW, I did this for the VSPro objects as well.
    upload_2020-8-1_12-29-4.png

    Also added the ability to turn off VSPro node logic for draft tiles. In my case I like to pin a bunch of tiles to see where I'm at sometimes and with VSPro nodes running, it bogged down the experience so I added a global variable here to deal with that when I want to disable it for draft tiles.

    Its been pretty reliable for me so far, need do some more testing. I can post the code or give to Denis/@Wright if he likes!
     
  26. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    When I use CTS with MapMagic, MapMagic no longer generates new terrain tiles. In the editor I can generate new ones but I have to generate it twice and errors occur. Unfortunately there is still no documentation about the CTS node. upload_2020-8-1_18-43-31.png
     
  27. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Nice job! I'm still staying on MM 1 especially for those reasons (lack of multiple biomes etc). I find MM2 + VSPro a bit hard to setup compared to MM1.
     
  28. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    So I wanted tall mountains with mostly flat land in between, but i wanted to give the land inbetween the mountains some small hills, is there a way i can add another flatter perlin noise node that doesnt affect the initial noise node?
     
  29. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Don't you play around with the curve node?
     
    Nunez-Torrijos likes this.
  30. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    thanks, i love you
     
  31. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Thanks. Im going to look into making it work with infinite worlds and have no flicker when new terrains are added or removed. This would be a VSPro implementation though. Will be much harder to do. But if I implement a good solution I will share it.
     
    Nunez-Torrijos likes this.
  32. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    is there a way i can set an area in a draft terrain to a certain height then lock it, then click pin new tile and generate everything around the locked area?

    My other problem is, is that i sometimes get floating objects from previous seeds when i do a new seed

     
    Last edited: Aug 3, 2020
  33. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    I was able to get full infinite vegetation for infinite terrain in VSPro by copying a 'source' vegetation studio system to each tile as its loaded into view. So each tile has its own vegetation studio system game object. This prevents the flickering when automatic calculation is checked for VSPro system and new terrains are added and also prevents the interface from being super laggy when you enter really large coordinates for total area as well.
    upload_2020-8-2_22-58-26.png

    I further optimized the scene by not adding VSPro integration until a tile has been generated (not draft) while in play mode.

    I can share my solution if Denis would like.
     
    Last edited: Aug 3, 2020
  34. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Thanks everyone for discussing MM! I'm going to get back to work at least for half a hour a day. Sorry for not being able to review all the posts, so if you need my attention feel free to post them again and mention Wright.

    Could not reproduce it with the standard trees, is it VSPro or something?

    Looks really interesting. Not sure I will make that for 2.0.6., but I will try to make it once since it really can solve the lags problem, especially when applying drafts.Thanks for idea, this one seems really good one!
     
    Nunez-Torrijos likes this.
  35. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109

    It’s not just the trees it’s the rocks too, im using nature manufacture trees and rocks

    my main problem is not the floating rocks/trees it’s that i would like to make a starting area that is flat prior pinning a new terrain and populating the terrain.

    Is there a way i can lock the draft terrain to a certain height then populate the surrounding areas?
     
  36. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    my trees are are objects and not using the tree node because they have scripts to them, however even the rock objects float that do not have scripts attached to them. The floating objects only occur when i take a current seed and make a new seed.
     
    Last edited: Aug 3, 2020
  37. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    @Wright can I email you my solution for VSPro? It has multi package support and this infinite streaming thing as well. Its just updates to your existing classes for VSPro compatibiity. If so, where should I upload it or what email address should I send it to? My email is jimmy.gladfelter@gmail.com just an fyi.

    EDIT: I started a private conversation with you that has my code changes and a description of what i did:

    Summary:
    1. Added VSPro multi-package support
    2. Optimized texture mask writing to VSPro packages.
    3. Added a flag to disable rendering VSPro maps for draft tiles for when you have to pin a bunch of tiles.
    4. Added infinite terrain solution for VSPro
    https://forum.unity.com/conversations/map-magic-vspro-changes-i-made.558144/

    P.S. The reason I started a private conversation was because I uploaded a few code files and didnt want to infringe on your IP.
     
    Last edited: Aug 5, 2020
    Nunez-Torrijos and mmaclaurin like this.
  38. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    @Wright I still have this problem. Do you have any suggestion?

     
    Nunez-Torrijos likes this.
  39. baddiego

    baddiego

    Joined:
    Jan 21, 2018
    Posts:
    6
    Hi all,

    I am having an odd problem, and I am not sure if I am terribly missing something :p

    I am using Map Magic2 together with Microsplat, and I have a few textures that appear too big. I therefore would change the tiling value for these textures. With the normal texture output this is no problem, but with microsplat and the microsplat output node, I cannot find the setting.

    Who knows a solution..? :)
     
  40. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    It should be on the per texture setting (at the bottom) of the microsplat material you created, its not on the node. Change UV scale there
     
    Nunez-Torrijos and Wright like this.
  41. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    182
    Hope you're feeling better, dude. Take it easy.
     
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Thanks! I will look into it after a while!

    Yep. And don't forget to enable Set Component and assign propdata (should be created by MicroSplat). This should be made if you are changing any of the MicroSplat's per-texture properties.

    For me any time I change the seed MM generates from scratch, placing both trees and objects where they should. So I'm missing something to reproduce this issue. Could you please describe the exact steps I should follow?

    I have not looked into this asset and not made MM compatible with it. Just mention that the grass is not an object - it's not a prefab placed on the terrain, but a part of Unity terrain engine. That's why it might not seemed by this asset.

    Trying to keep it up, thanks!
     
  43. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    Does this help with the floating objects?
     
    Nunez-Torrijos likes this.
  44. malditonuke

    malditonuke

    Joined:
    Apr 15, 2017
    Posts:
    18
    Try deleting the tree child objects in the tile gameobject and run the object placement again. You may have made some changes to the objects and the old objects weren't cleared.
     
    Nunez-Torrijos likes this.
  45. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    ya some of the objects stay from the previous seed. Maybe i can just delete the object parent each time for each tile and the generate The tile?
     
    Nunez-Torrijos likes this.
  46. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Yes, that's what it was. The manual didn't make that clear at all, and the way it's supposed to work is to place the grass as trees.
    I assume, that doing it that way would not cause any unforeseen problems with MM right?
     
    Nunez-Torrijos likes this.
  47. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I have been trying MM2 with Unity 2020, the experimental feature help to solve the problem with the nodes, but unfortunately it is impossible to add a layer on any node (experimental or not) upload_2020-8-5_16-39-45.png
     
  48. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Following up on my problem above. when I try to open the demo's graph I get this error



    NullReferenceException: Object reference not set to an instance of an object
    MapMagic.Nodes.GUI.GraphWindow.GetNodesCenter (MapMagic.Nodes.Graph graph) (at Assets/MapMagic/Nodes/Editor/GraphWindow.cs:520)
    MapMagic.Nodes.GUI.GraphWindow.ScrollZoomOnOpen () (at Assets/MapMagic/Nodes/Editor/GraphWindow.cs:826)
    MapMagic.Nodes.GUI.GraphWindow.OpenRoot (MapMagic.Nodes.Graph graph) (at Assets/MapMagic/Nodes/Editor/GraphWindow.cs:766)
    MapMagic.Nodes.GUI.GraphWindow.Show (MapMagic.Nodes.Graph graph) (at Assets/MapMagic/Nodes/Editor/GraphWindow.cs:690)
    MapMagic.Core.GUI.MapMagicInspector.DrawGUI () (at Assets/MapMagic/Core/Editor/MapMagicInspector.cs:124)
    Den.Tools.GUI.UI.Draw (System.Action drawAction, Den.Tools.GUI.UI+RectSelector rectSelector, System.Boolean offsetAfterDraw) (at Assets/MapMagic/Tools/GUI/Editor/UI.cs:218)
    MapMagic.Core.GUI.MapMagicInspector.OnInspectorGUI () (at Assets/MapMagic/Core/Editor/MapMagicInspector.cs:98)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <b17f35b08b864a3ca09a7032b437596e>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     

    Attached Files:

  49. malditonuke

    malditonuke

    Joined:
    Apr 15, 2017
    Posts:
    18
    I think the objects only stay if you change one of them in the editor. Try clearing them, regenerate the tile, and then change the seed. Changing the seed should work fine and none of the objects will float as long as you don't edit the objects. Before you release the game, remember to delete the objects in the pinned tiles and regenerate.
     
  50. baddiego

    baddiego

    Joined:
    Jan 21, 2018
    Posts:
    6
    Thank you!
     
    jimmygladfelter likes this.