Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

MapMagic 2 - infinite procedural land generator

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

  1. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,557
    Is there a way to reduce the detail instance density on generated terrains? Mine are always 512 but id like to lower it to see if I can save memory.

    Screen Shot 2021-05-08 at 1.31.36 PM.png
     
    jukibom likes this.
  2. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    I'm having a problem where i have a list of outputs (all stumps) but its only outputting two of them and ignoring the rest most of the time; its popping out the two with arrows and mostly ignores the other ones; is there anyway i can force it to rotate/circulate through all of the object outputs in order so that it outputs 1 then 2 then 3 etc. so that it goes through the whole list of objects to avoid skipping outputs objects?

    upload_2021-5-8_20-38-59.png
     
  3. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    164
    Map magic always crashes unity whenever I tried to save terrain data. But it does save the terrain data. But why crashing Everytime?
     
  4. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    59
    I can't seems to expose value from the stamp and adjust node, is it normal?
    I can expose value from scatter node, but I need the size value from stamp node exposed
     
  5. Nyxo

    Nyxo

    Joined:
    Mar 12, 2013
    Posts:
    23
    Just wanted to report another bug: The VSProMapsTile class derives from MonoBehaviour, but its filename (VSProTile.cs) doesn't match the class name, which causes various issues in Unity (at least in the Editor).
     
    7Ye likes this.
  6. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    164
    Hi I like your new game wilderless. I think 512 is a good number for details on mobile. But yeah we would love to be able to manage resolutions independent of terrain size or heightmap resolution.
     
    protopop likes this.
  7. zalos1337

    zalos1337

    Joined:
    Dec 7, 2020
    Posts:
    6
    Trying to fire off stuff when map loading is complete however this never fire because the queue seems to never be empty:
    upload_2021-5-11_17-58-18.png

    Settings wise I have pretty much everything default, on start I am changing the seed and doing a .Refresh();
     
  8. Nyxo

    Nyxo

    Joined:
    Mar 12, 2013
    Posts:
    23
    @Wright I realize that the splines module is currently in beta, so I shouldn't expect a lot in regards to its current state, and I'm okay with that, but I'm curious about the roadmap -- specifically thinking about whether it will eventually support infinite terrains, specifically for river generation, where the river source (say, the top of a mountain) may be one or more terrains away from what is currently generated, yet runs into one of the currently generated terrains. Can you speak at all to that?
     
  9. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    I'm thinking of a special sub-graph node (like biome or function) that will generate large scale terrains - one for several tiles. This way each tile will have low resolution base map to generate details - similarly to the Import map. It should work fine with maps and objects, and will require some work to make it support splines. It's just a plan yet - can't promise anything.

    MM graph window is using this for enabling/disabling gauge. Could you look whether it hides the gauge on finishing generate in your case?

    It was planned for 2.1.4, but unfortunately it takes some time to implement it. I had to release 2.1.4 swiftly to fix major issues, but now going to make it for 2.1.5 without any haste.

    Thanks for reporting it! Will change the file name in next version.

    It's not normal, unfortunately it's a bug. Going to fix it for the next version. Thanks for letting me know!

    Are you using MicroSplat/CTS/VSPro or RTP?

    Could you please show what nodes precede the output? It seems that some node doesn't create random ids for some reason.

    The brush can paint only the splatmap information. However, CTS can convert splatmaps information to it's control textures.

    Actually you can look for the version number in MapMagic object - About, but yes, including a txt file would be handy since you won't have to open Unity for that.
    I can archive the whole project containing MM only with Whittaker working if you'd like to to avoid packages at all as soon as I get back to my PC (after this weekend).

    If it's still relevant - may I send you the same project like for Diego Graphics (empty project with MM Bundle with brush working) to find out whether it's related to package manager or something else (will do this after weekend)?
     
    jukibom and protopop like this.
  10. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109

    well i have monster camps that are spawned and i think what occurs is that i have a rarify that occurs and sometimes they can't be placed so when they can't be placed i only get a couple outputs and often times its a repeated output, i was hoping there was something that would force a spawn in order to make sure the objects above it is spawned and then the next object will spawn at the next acceptable position (although the log/stump spawner may have an actual error as only a couple types spawn)

    happens quite often with the camp node spawner
    upload_2021-5-14_18-15-37.png

    Here is the log/stump spawner
    upload_2021-5-14_18-18-11.png
     
    Last edited: May 15, 2021
  11. zalos1337

    zalos1337

    Joined:
    Dec 7, 2020
    Posts:
    6
    upload_2021-5-14_19-59-6.png

    When I start the game the whole graph hides, when I open the graph I see this for the gauge when it is done loading. For now I have starting using tile applied for the main tile as a workaround. The other event never fires. Im on v2.0.8, when I try upgrading everything breaks. I can keep trying to update if you think that would fix it.
     
  12. TimDoesDev

    TimDoesDev

    Joined:
    Feb 23, 2018
    Posts:
    35
    hi @Wright I'm getting a microsplat related error whenever I build to a standalone exe and I try to generate new runtime terrain.

    This is the error I get:

    Code (CSharp):
    1. Exception: Routine error: System.NullReferenceException: Object reference not set to an instance of an object
    2.   at MicroSplatTerrain.Sync () [0x000d2] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MicroSplat\Core\Scripts\MicroSplatTerrain.cs:188
    3.   at MapMagic.Nodes.MatrixGenerators.MicroSplatOutput200+ApplySplatsData.Apply (UnityEngine.Terrain terrain) [0x00072] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MapMagic\Compatibility\Runtime\MicroSplatOutput.cs:179
    4.   at MapMagic.Terrains.TerrainTile.ApplyNow (MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x00022] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MapMagic\Terrains\TerrainTile.cs:721
    5.   at MapMagic.Terrains.TerrainTile+<>c__DisplayClass42_0.<Generate>b__0 () [0x00000] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MapMagic\Terrains\TerrainTile.cs:700
    6.   at Den.Tools.Tasks.CoroutineManager.Update () [0x000c9] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MapMagic\Tools\ThreadManager\CoroutineManager.cs:136
    7.   at Den.Tools.Tasks.CoroutineManager.Update () [0x000eb] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MapMagic\Tools\ThreadManager\CoroutineManager.cs:137
    8.   at MapMagic.Core.MapMagicObject.Update () [0x0002a] in C:\Users\timgr\Documents\Unity\git\New\FarNorthGame\Assets\MapMagic\Core\MapMagicObject.cs:144
    9.  
    10. (Filename: C:/Users/timgr/Documents/Unity/git/New/FarNorthGame/Assets/MapMagic/Tools/ThreadManager/CoroutineManager.cs Line: 137)
    What do I do to fix it? I figured it maybe was related to shader stripping but I can't include the Microsplat shader in the always-include setting because it contains too many variants...


    I'm using HDRP 10.4 and Unity 2020.3.2f1.
    It all works fine in the editor but not on build.

    All the best
     
  13. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    164
    @Wright yes I'm using microsplat. I will try another scene with standard shader.

    Also I've mailed you with all the files(regarding import node bug) . Did you received it? It should be from mukul Kataria.
     
  14. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    So are these the objects from Combined... objects output are not spawned at random? I thought it is Lod/prefab/root/trunk output.

    I will take a look why the queue is never emptied - thanks for letting me know!

    Looks like MicroSplatObject.keywordSO is not assigned - and the only way it could be assigned is marked with #if UNITY_EDITOR in MicroSplat - so the only way to create keywordSO is to use editor. I don't know what can I do about it - I can try adding
    Code (CSharp):
    1.             keywordSO = ScriptableObject.CreateInstance<MicroSplatKeywords>();
    2.             keywordSO.keywords = new List<string>(templateMaterial.shaderKeywords);
    to MM output, but I don't really want to duplicate MS code. The more I do so, the bigger the chance that it will break down on new MS version.
    Try disabling/enabling Set Component in MicroSplat output - however disabling it will reduce some of the features.

    Sorry, I was going to ask you to clarify the issue, but noticed you've mentioned the readme. Yes, I have recived your files, thanks! Will try to fix it for 2.1.5!
     
    mukki014 likes this.
  15. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    Problem 1


    Problem 2
     
  16. mukki014

    mukki014

    Joined:
    Jul 30, 2017
    Posts:
    164
    Thank you sir. I'm really grateful.
     
  17. Drahtzieher02

    Drahtzieher02

    Joined:
    Oct 4, 2018
    Posts:
    2
    Hi,

    I was trying to program a custom generator placing objects along the spline. The code isn't tested, and I know, it doesn't work properly in its intended function (placing the objects on the correct positions). But nevertheless, there is a problem, I can't solve on my own.

    In the testing, I noticed, i could caluclate the positions for certain splines, but not for all! And there is the problem. In further investigation, I noticed, that some Splines (Lines and Segments) the length value is zero. I tried to have a workaround with updating the length values before accessing the value (see code), but that didn't help.

    Spline_network.PNG Spline_points.PNG

    Could there be a bug within the length calculations? I recognized further, that when changing the value in the editor graph on the PlaceObjects module, the Debug.Log prints different length values for the same configuration. I don't know, why the graph will be updated two times after changing a value, but the result values could differ. (I recognized at debugging)

    Code (CSharp):
    1.     [System.Serializable]
    2.     [System.Serializable]
    3.     [GeneratorMenu(
    4.     menu = "MySpline/Standard",
    5.     name = "PlaceObjects",
    6.     iconName = "GeneratorIcons/Constant",
    7.     colorType = typeof(SplineSys),
    8.     disengageable = true,
    9.     helpLink = "")]
    10.     public class MyPlaceObjects : Generator, IInlet<SplineSys>, IOutlet<TransitionsList>
    11.     {
    12.         [Val("Count")] public int count = 1;
    13.         [Val("UseRelativeY")] public bool useRelativeY = true;
    14.         [Val("sOffset")] public float sOffset = 0;
    15.         [Val("tOffset")] public float tOffset = 0;
    16.  
    17.         public override void Generate(TileData data, StopToken stop)
    18.         {
    19.             SplineSys splineSys = data.ReadInletProduct(this);
    20.             if (splineSys == null || !enabled) return;
    21.             // splineSys.Update();
    22.  
    23.             TransitionsList transitions = new TransitionsList();
    24.  
    25.             foreach (Line line in splineSys.lines)
    26.             {            
    27.                 // line.UpdateLength();
    28.                 // Debug.Log("Line: " + splineSys.lines.ToList().IndexOf(line) + "length: " + line.length);
    29.                 if (line.length == 0) continue;
    30.  
    31.                 float lengthSegment = line.length / (count + 1);
    32.  
    33.                 for (int i = 0; i < count; i++)
    34.                 {
    35.                     float tempLength = 0;
    36.                     int index = 0;
    37.                     while (tempLength < lengthSegment + lengthSegment * i)
    38.                     {
    39.                         // line.segments[index].UpdateLength();
    40.                         tempLength += line.segments[index].length;
    41.                         index++;
    42.                     }
    43.                     index--;
    44.              
    45.                     float percentage = line.segments[index].LengthToPercent(lengthSegment + lengthSegment * i - (tempLength - line.segments[index].length));
    46.                     Transition trans = new Transition();
    47.  
    48.                     trans.pos = line.segments[index].GetPoint(Math.Abs(((percentage + sOffset) % 1)));
    49.                     if (tOffset != 0)
    50.                     {
    51.                         Vector2D perpendicular = line.segments[index].GetPerpendicular2D(Math.Abs(((percentage + sOffset) % 1)));
    52.  
    53.                         trans.pos.x += perpendicular.x * tOffset;
    54.                         trans.pos.z += perpendicular.z * tOffset;
    55.                     }
    56.                      
    57.                     trans.scale = Vector3.one;
    58.                     trans.rotation = Quaternion.Euler(line.segments[index].GetDerivative(Math.Abs((percentage + sOffset) % 1)));
    59.  
    60.                     if (useRelativeY) trans.pos.y = 0;
    61.  
    62.                     transitions.Add(trans);
    63.                 }            
    64.             }
    65.  
    66.             data.StoreProduct(this, transitions);
    67.         }
    68.     }
    69.  
    Best regards
    Thomas
     
  18. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    187
    Ah good to know that it can be viewed via the About section, I didn't know that. I have checked I am definitely on version 2.1.4, so it is indeed a bug with the current version that makes the Whittaker unusable.
     
  19. 7Ye

    7Ye

    Joined:
    Dec 5, 2014
    Posts:
    18
    Hi there @Wright . Been playing around with your amazing collection of MM2 assets. I've been seen that compatibility with some other assets may be tricky so I'm afraid I'll not try any of those by now... For example the current lack of multibiome use with Vegetation Studio. (So the increased difficulty for stuff). That's the only one I tried and had a lot of increased performance cost so... First I'll put my doubts away with the MM2 basic generation process.(And knowing how to exactly make the biomes work with only a package was a pain)

    Having many problems to work on a Finite terrain due to Unity limitations.

    I found Pinned tiles (1024 resolution.... and a 201 tiles of size 1000 exactly) is just what I need for my project.. and also, they have a lot of better performance in Unity with Drafts totally deactivated. So my plan is just to prepare the gameplay logic with those pinned terrains (and saved just if...) and in the future see what's the better way.

    So my current try on my project is just to have saved those 201 terrains and deactivate MapMagic on gameplay.

    Of course... Unity limitations. A scene can only have 5gb of data on it so.... I was splitting the terrains on Adressables/Bundles and just load the reference on the run. Maybe that is just supposed something I should not do, and let MapMagic do its work and generate on play the terrains, but... Really my terrain is quite barren and I have 0 performance problems (for now with it, and it is easy to work even in the prototype of gameplay logic with the full map. So I'm trying to understand the logic of Saved Terrains inside the Mapmagic logic of runtime spawning.

    In the last documentation, there is no information about it. Also..... I could say MM2 documentation is a bit sparse in the inner logic (I'm not a deep coder...)

    What's exactly the point of Saved Terrains? I mean... Due to Unity limitations, You can't have many saved.. or isn't different with the concept of just letting them pinned, so they're supposed maybe to be activated via MapMagic auto activate-deactivate factor on gameplay?

    But... if you unpin those saved terrains... Does MapMagic knows that he has to load a Saved Terrain in that tile instead of generating a new one?
    If before building I just go one by one and tell them that they're "deactivated" instead of "Main", in order just to let MM2 to activate and deactivate them before building the game..... Isn't right that Unity saves on scene all the referred terrains in the deactivated terrains so the 5gb of terrains are loaded (sadly) into the sharedassets0?.

    I really..... well. I'm experiencing with it, as when I'm sure about terrain loading I'll think about other stuff like the little vegetation I need.) (Not much problem with objects... it's a game low on logic).

    Maybe I'll finally just use the pinned terrains to prepare the game logic and in the end use the "magic" of runtime generation, but for the moment, knowing exactly what is the point of Saved Terrains (and if using them as Adressables is a good idea) will be a good start.

    Thank you, and for your great work.
     
  20. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    73
    Thanks for this great tool. However, I have an issue with your Microsplat integration (including Microsplat URP module) on Unity 2020.3.8 URP: I changed the microsplat shader in your demo project to from standard to URP. Everything looking good but I cannot draw textures, nothing happens.
     
  21. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    By drawing - do you mean drawing by brush? If so then MapMagic Brush doesn't update MicroSplat control maps - it just draws standard splatmaps, and MicroSplat reads these splatmaps as if you were painting with the standard terrain tools. Can't say why it doesn't do so in URP.

    I guess it's not the Unity limitation - a scene of 200 tiles would be a limitation in every game engine. Try looking in the direction of streaming assets (like WorldStreamer or something).

    Will try to look further in Whittaker to find out what's wrong with it.

    Try calling splineSys.Update before reading spline data, or calling line.UpdateLength() in particular for each line in spline system.
     
  22. TimDoesDev

    TimDoesDev

    Joined:
    Feb 23, 2018
    Posts:
    35
    For some reason I cannot see VSPro Objects if I don't toggle the Copy VS checkbox in the VS PRO OBJS node. However I'm not sure if using that affects performance negatively. Thoughts on this @Wright ?
     
  23. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    73
    Yep just drawing by brush using the unity terrain draw texture function. It works when using just microsplat without mapmagic and it works when using just mapmagic without microsplat, just not both together in URP. Since MapMagic is sitting on top of microsplat when combined I assume the issue is in the MicroSplat node (it also shows an error on the node saying the material is not a microsplat material; this error is wrong both the node and the terrain use the correct microsplat material).
     
  24. Giantsmall

    Giantsmall

    Joined:
    Apr 28, 2019
    Posts:
    18
    Hello,

    I am trying to create roads using splines, so far I encounter two major problems:
    1. Any idea how to make roads that would avoid water regions? Currently avoiding water causes problems making roads curvy. I got this result by increasing water regions' height beyond pathfinding threshold and reducing it back afterwards.
    2. Roads are often discontinuous between tiles (see second screen) - can i fix it somehow?
    Curvy roads vs roads that go through water regions


    Another case: would that be possible to merge two road systems together so they would use one another to find the right path?
    (Brown and black like on the screens)

    UPDATE: Now I noticed that curvy roads are result of path nodes being placed high above the map level..
     

    Attached Files:

    Last edited: May 18, 2021
  25. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    If you are using objects output node to create lakes then you can avoid them with splines using the Avoid node.
    Yes, splines might not be welded properly. I plan to change the splines engine sooner or later, and go on fixing this issues with the new engine.

    Might be some MS event should be triggered to update it. I will look the way MS does it, can't promise fixing it for 2.1.5, but at least try to see what I can do about it.

    CopyVS should be faster then using single VS system, non-copy mode is still here mainly for the compatibility reasons.
     
    Falondrian likes this.
  26. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    Were my 2 videos confusing?
     
  27. IvanWeeskey

    IvanWeeskey

    Joined:
    Jan 8, 2017
    Posts:
    12
    Hello,
    In my project I'm using tile features. So I have a world of 12x12 tiles. Btw each tile has 257 res. Problem is when MM generating world when smth changed - some random tiles are generated with bugs. They are just plains or simply skipped - I dont know. Also sometimes I get "spikes" artefacts between tiles along the edges. What is the problem?
    upload_2021-5-19_17-14-15.png upload_2021-5-19_17-14-36.png
     
  28. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Does anyone have an idea why my center tile disappeared? All I did was quit play mode.

    Also, randomly a draft tile gets messed up when modifying the nodes (see the green tile) I have to set it as draft again to fix it.
    upload_2021-5-19_16-50-2.png
     
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    I will appreciate if you could describe the problem in words. I guess the first issue is that objects output skipping placing some objects - could you please make a screenshot of nodes that precede this output?

    Does this happen each time you hit re-generate? If so could you please send me the scene? This is the issue I'm aware of, it happened to some users, but I still can't reproduce it.

    BTW is there any error in the console?

    Isn't it appearing after re-generate? Does it look similar to the issue IvanWeeskey described?
     
  30. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    Can you force spawn, in order, the objects in the object output node so that when there is a failed placement of an object due to a spread node that it would force the next object in the order of the object output node to be placed so that it is not random therefore giving me an even placement/amount of those objects from that object node. This would avoid the same objects doubling or tripling in a given area.
     
  31. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    For the missing tile: It does not reappear after re-generate.
    I also remember having another issue with the tile getting offset (in height) with the neighboring tiles which caused a gap. I couldn't fix that either and had to delete the tile and restart from scratch.

    Does it look similar to the issue IvanWeeskey described?: I have seen similar problems so it could be related, except his tile didn't disappear.

    For the tile with the wrong textures (in green): It sometimes fixes itself with a re-generate but then it sometimes break the textures of another tile. Hitting re-generate multiple times eventually gets lucky and all the tiles are ok.

    FYI there is also a bug with the node debug view (the green, yellow, red overlay), I have been enabling and disabling the debug view of several nodes trying to troubleshoot something and often the view of a node would get stuck active even when enabling the debug view of another node or disabling it. Enabling and disabling the preview of a node a few times usually fixes it.

    Really hope you can figure these out, I LOVE this asset! (I think it can go much further than Gaia + Gena but don't tell them I said this :p )

    Thank you.
     
    Last edited: May 21, 2021
  32. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    I am also having another problem when trying to use microsplat that I've never seen before (it was setup the same as your youtube tutorial):

    MAIN TERRAIN
    upload_2021-5-21_23-42-25.png

    DRAFT TERRAIN
    upload_2021-5-21_23-43-38.png

    Every time I change the graph and it regenerates it adds new layers to the terrain. Only the last 5 are good.
    You can see on the second screenshot that the draft terrain and the main terrain dont match. The draft and main terrain getting out of sync appears to be a consistent problem.

    Also, the whole terrain turns black once in a while, happened 3 times now. I have to delete all the layers and mess around with the microsplat output node (disconnect reconnect, recreate it) to eventually fix it.

    Additionally, the grass node stopped working when I tried to change it's density. The grass disappeared and no matter what I do I can't get it back.

    Not sure what to do here, I really want to use this but things keep breaking, what am I doing wrong?

    There are a bunch of errors in the console, some appear related (there is also a ton of null ref errors about the grass but I have NOT been able to find how to fix it):

    [Warning] Component of type MonoBehaviour was added to Main Terrain using GameObject.AddComponent() and had become dangling during an undo operation.
    Use Undo.AddComponent to correctly add a component which can be handle by the undo system
    UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()

    [Warning] Component of type MonoBehaviour was added to Main Terrain using GameObject.AddComponent() and had become dangling during an undo operation.
    Use Undo.AddComponent to correctly add a component which can be handle by the undo system
    UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()

    [Error] GrassFlow: Not all required assets assigned in the inspector!

    [Warning] You are trying to create a SelectionGrid with zero or less elements to be displayed in the horizontal direction. Set xCount to a positive value.
    UnityEditor.UIElements.Tooltip:SetTooltip (single,single)

    [Warning] You are trying to create a SelectionGrid with zero or less elements to be displayed in the horizontal direction. Set xCount to a positive value.
    UnityEditor.UIElements.Tooltip:SetTooltip (single,single)

    [Error] Thread failed: System.NullReferenceException: Object reference not set to an instance of an object
    at MapMagic.Locks.GrassData.Stamp (System.Int32[,] arr, System.Int32[,] stamp, Den.Tools.Coord stampOffset, Den.Tools.Coord center, System.Int32 radius) [0x00001] in C:\Unity Projects\ALPHA - Terrain Map Magic\Assets\MapMagic\Locks\LockDatas\GrassData.cs:159
    at MapMagic.Locks.GrassData.WriteInThread (MapMagic.Nodes.IApplyData applyData) [0x00071] in C:\Unity Projects\ALPHA - Terrain Map Magic\
    ...
    [Error] Thread failed: System.NullReferenceException: Object reference not set to an instance of an object
    at MapMagic.Locks.GrassData.Stamp (System.Int32[,] arr, System.Int32[,] stamp, Den.Tools.Coord stampOffset, Den.Tools.Coord center, System.Int32 radius) [0x00001] in C:\Unity Projects\ALPHA - Terrain Map Magic\Assets\MapMagic\Locks\LockDatas\GrassData.cs:159
    at MapMagic.Locks.GrassData.WriteInThread (MapMagic.Nodes.IApplyData applyData) [0x00071] in C:\Unity Projects\ALPHA - Terrain Map Magic\
    ...
    [Warning] [CS0219] The variable 'meshIdx' is assigned but its value is never used
    [Warning] [CS0612] 'ColorPickerHDRConfig' is obsolete
    [Warning] [CS0618] 'EditorGUILayout.ColorField(GUIContent, Color, bool, bool, bool, ColorPickerHDRConfig, params GUILayoutOption[])' is obsolete:
    'Use EditorGUILayout.ColorField(GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, params GUILayoutOption[] options)'
    [Warning] [CS0618] 'TerrainData.splatPrototypes' is obsolete:
    'Please use the terrainLayers API instead.'
    [Error] Thread failed: System.NullReferenceException: Object reference not set to an instance of an object
    at MapMagic.Locks.GrassData.Stamp (System.Int32[,] arr, System.Int32[,] stamp, Den.Tools.Coord stampOffset, Den.Tools.Coord center, System.Int32 radius) [0x00001] in C:\Unity Projects\ALPHA - Terrain Map Magic\Assets\MapMagic\Locks\LockDatas\GrassData.cs:159
    at MapMagic.Locks.GrassData.WriteInThread (MapMagic.Nodes.IApplyData applyData) [0x00071] in C:\Unity Projects\ALPHA - Terrain Map Magic\
    ...
     
    Last edited: May 23, 2021
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    How objects output node will know where to spawn an object if spread fails to provide it it's location? Anyways, it seems like a hack - if you have an issue with the spread - could you please describe the steps to reproduce it on ideainformer?

    Do you mean that each time you press re-generate some of the tiles is always the green one? If so could you please email me the scene and the graph?
    And their meta files. I will need only 4 files, there's no need to send models or textures. I will appreciate if you don't compile the unity package with the dependencies. A description of the issue in email will also come in handy - way more handy than mentioning post on forums.
     
  34. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    i was just hopinig there would some way to get an even output of all objects in an output node.
     
  35. Giantsmall

    Giantsmall

    Joined:
    Apr 28, 2019
    Posts:
    18
    Hello, I would like to get output from spline generator.
    Unfortunately data property is null after generation..
    It is the right way of getting the output, is it not?:

    var mmo = this.GetComponent<MapMagicObject>();
    var relaxGen = mmo.generators.First(g => g.GetType() == typeof(Relax200));
    var splineSys = mmo.tiles.pinned[new Den.Tools.Coord(0, 0)].main.data.ReadOutletProduct(relaxGen);

    Another thing is the graph seed. I do not have access to it like in MM1. How can I change it in script?
     
    Last edited: May 24, 2021
  36. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    The problem remains with the log outputs, i can put each log by itself and it will spawn but if i put them all in the spawner it generally favors only 1 of 3 logs and occasionally it will put out a different one other than the favored log. Each seed appears to favor a certain log.
    upload_2021-5-22_16-12-0.png
     
    Last edited: May 22, 2021
  37. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    So i went back and played around.I was able to get this output results on a 512x512 terrain with this output node.

    Many of the output nodes do this; where they repeat 1 or 2 outputs and occasionally put one of the other prefabs on the map. (this does not seem random)

    I am trying to get your output nodes to place more of an even spread.

    upload_2021-5-22_17-42-23.png upload_2021-5-22_17-46-35.png
    upload_2021-5-22_17-49-0.png
     
  38. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    now if i switch out log 3 with a Beech_forest_stump_02_02 then it puts that out instead at high numbers
    upload_2021-5-22_18-6-40.png


    it appears to favor output objects based on where they are in the object node
     
  39. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Not always. It's random. It can happen when clicking re-generate or changing the graph.

    You already have the files. It happens in your demo scenes. Just open your scene called "Tutorial" pin terrains as draft around the center tile already in the scene and then click generate several times.

    I just tested it in a new project on Unity 2019.4.26 with a fresh import of Map Magic.
     
    Last edited: May 23, 2021
  40. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    Any plans to support 4097 heightmap resolution?
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    Yes, since Unity added 4K support for terrain maps, I can MM support them as well. But note that high resolutions are not performance-friendly - it's better to split such big tiles in several ones to make them generate in separate threads.

    Odd... I can see some draft tiles green sometimes, but it all gone when the generating is ended. It happens when a draft tile receive a command to cancel generate process on starting a new one.

    I guess it's related with thread number. Could you try to reduce maximum threads in MM object -> Multithreading (disable auto threads first) to 1-2?

    Thanks for your findings! But still a screenshot of the nodes that precede this output node (that outputs Log3 and Log2) will help me a lot to find out why this happens.

    I'm afraid there is no way to access generated data after the generate is finished - at least in playmode. MM does not keep unnecessary data here and tries to free it as soon as possible to reduce memory. You can access it during the generate using the custom node.
     
  42. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    upload_2021-5-24_21-50-14.png
    upload_2021-5-24_21-49-49.png
     
  43. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Heads up: A major MicroSplat update has moved it into Packages and added assembly definitions. MapMagic can no longer refer to MS code until an assembly reference is added to the Compatibility folder. BTW, if anyone has already built the reference it'd be great if you could post it here. Otherwise, I'll work on it...
     
    DR_Studio likes this.
  44. saiykoh

    saiykoh

    Joined:
    May 25, 2021
    Posts:
    1
    Hello guys, We have a problem with our prefabs, they turn all red when we place them on our terrain with the MapMagic asset. Have you guys experienced this ? Thanks !!! Capture.PNG
     
  45. Byberg

    Byberg

    Joined:
    May 20, 2013
    Posts:
    74
    Hey. Been searching for an answer but couldnt find it anywhere.

    Is there anyway to remove grass at a specific place? For example if a player placesa building or a campfire on the ground i wanna be able to clear the grass under that object. Also perhaps change the ground texture.

    Any ideas?
     
  46. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    Yes, you can use Stroke to create masks around objects, and then subtract them with a Blend node:


    Do you place them as trees or objects? If the last one - are you sure you your Color value in Tree output Properties is not set to red?

    So there will be additional assembles then - something intermediate like MM_MS. The way it's done for VSPro. Not very convenient, but actually it seems the only way to make two assets compatible.

    Hmm, I could not reproduce it with the scatter and masks. Seems that the thing is in rarefy, but I don't know where the portals go. Could you please email me the scene and the graph?
    And their meta files. I will need only 4 files, there's no need to send models or textures. I will appreciate if you don't compile the unity package with the dependencies. A description of the issue in email will also come in handy - way more handy than mentioning post on forums.
     
    dmenefee likes this.
  47. Byberg

    Byberg

    Joined:
    May 20, 2013
    Posts:
    74
    Sorry for not being specific. I meant during runtime.
     
  48. GambitMonkey

    GambitMonkey

    Joined:
    Apr 5, 2016
    Posts:
    65
    Does anyone know how you can grab the biome layer that a terrain tile is being generated for? I have gone through most of the properties for the tile and data on MapMagic.Terrains.TerrainTile.OnTileApplied event and I can see the Graph and the Biome layers taht are setup, but I do not see anything indicating that this tile is using this Biome.

    Any thoughts or anyone else played with this? I would like to have this info so I can do x, y, and z based on what Biome the Terrain is.

    Thanks in advance!
     
    Last edited: May 27, 2021
  49. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,261
    It's better to use scripting for this. There is pretty simple way to erase grass with terrainData.SetDetailLayer. MM was designed to generate terrains as a whole, it would be a performance overkill to use it this way.

    You can get this data during generate with a custom node. This is fine if you need to evaluate the biome at particular position only once. But it won't help if you need to get biome based on player position each frame. I've got the similar request and one day going to add some map output node or something, but it's not ready yet.
     
  50. GambitMonkey

    GambitMonkey

    Joined:
    Apr 5, 2016
    Posts:
    65
    Thanks for the response and yes I think this would be very valuable. I am looking to swap Microsplat materials, set Enviro Weather Zones, change out Crest/RAM material, VS PRO masks, and do other player related processes all based on biome and would be great if you could just grab this from an output or an event.
     
    Last edited: May 29, 2021