Search Unity

MapMagic 2 - infinite procedural land generator

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

  1. rillani

    rillani

    Joined:
    Dec 16, 2020
    Posts:
    6
    Hello! I love MapMagic2 and I use it all the time in my project. :)

    In Unity 2021.2.0b3, I am getting an error when I have a graph file selected and visible in the inspector.

    NullReferenceException: Object reference not set to an instance of an object
    Den.Tools.Serialization.Serializer.SerializeRecursive (System.String name, System.Object val, System.Collections.Generic.Dictionary`2[TKey,TValue] serializedObjsIds, System.Collections.Generic.List`1[T] unityObjs, System.String offset) (at Assets/MapMagic/Tools/Serializer/Serialize.cs:218)
    Den.Tools.Serialization.Serializer.SerializeRecursive (System.String name, System.Object val, System.Collections.Generic.Dictionary`2[TKey,TValue] serializedObjsIds, System.Collections.Generic.List`1[T] unityObjs, System.String offset) (at Assets/MapMagic/Tools/Serializer/Serialize.cs:218)
    Den.Tools.Serialization.Serializer.Serialize (System.Object val, UnityEngine.Object[]& unityObjs) (at Assets/MapMagic/Tools/Serializer/Serialize.cs:64)
    MapMagic.Expose.Override.OnBeforeSerialize () (at Assets/MapMagic/Expose/Override.cs:244)
    Den.Tools.Serializer.SerializeObject (System.Object obj, System.Collections.Generic.Dictionary`2[TKey,TValue] serialized, System.Boolean skipNoCopyAttribute, System.Action`2[T1,T2] onAfterSerialize) (at Assets/MapMagic/Tools/Serializer.cs:379)
    Den.Tools.Serializer.SerializeObject (System.Object obj, System.Collections.Generic.Dictionary`2[TKey,TValue] serialized, System.Boolean skipNoCopyAttribute, System.Action`2[T1,T2] onAfterSerialize) (at Assets/MapMagic/Tools/Serializer.cs:422)
    Den.Tools.Serializer.Serialize (System.Object obj, System.Action`2[T1,T2] onAfterSerialize) (at Assets/MapMagic/Tools/Serializer.cs:177)
    MapMagic.Nodes.GraphSerializer200Beta.Serialize (MapMagic.Nodes.Graph graph) (at Assets/MapMagic/Nodes/GraphSerializer.cs:53)
    MapMagic.Nodes.Graph.OnBeforeSerialize () (at Assets/MapMagic/Nodes/Graph.cs:1149)
    UnityEditor.HostView:OnInspectorUpdate()
     
  2. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Sadly looks like ClearAll and StartGenerate won't works as expedted :(

    Code (CSharp):
    1.  foreach (TerrainEntity t in spawnedMarkers)
    2.         {
    3.             GameObject town = Instantiate(TownPrototype, t.gameObject.transform.position, t.gameObject.transform.localRotation);
    4.             town.name = FactionsNames[factionID];
    5.  
    6.             TownAI townAI = town.GetComponent<TownAI>();
    7.             townAI.TownID = factionID;
    8.             townAI.TownName = FactionsNames[factionID];
    9.             townAI.TownColor = Random.ColorHSV(0f, 1f, 0f, 1f, 0f, 1f);
    10.  
    11.             Towns.Add(town);
    12.  
    13.             Debug.Log("Spawn Town " + townID + "/"+ Towns.Count);
    14.  
    15.             town.GetComponent<TownGenerator>().enabled = true;    // Enable the townGeneration
    16.                                                                   //Towns[townCounter].GetComponent<TownAI>().enabled = true;    // Enable AI once the town is placed.
    17.  
    18.  
    19.             MMObject.locks[locksID].worldPos.x = town.transform.position.x;
    20.             MMObject.locks[locksID].worldPos.z = town.transform.position.z;
    21.             MMObject.locks[locksID].worldRadius = townAI.TownSize + 10;
    22.             MMObject.locks[locksID].worldTransition = townAI.TownSize / 2;
    23.             MMObject.locks[locksID].locked = true;
    24.  
    25.             Destroy(t.gameObject);  // remove the marker 'cause it's useless now.
    26.  
    27.             factionID++;
    28.             townID++;
    29.             locksID++;
    30.  
    31.             if (factionID > townFactionCount)
    32.                 return;
    33.         }
    34.  
    35.         // Once the towns are placed we will refresh the terrain and so the textures, 'cause towns will splat the surface.
    36.         MMObject.ClearAll();
    37.         MMObject.StartGenerate();
    38.  
    39.  
    40.         //initFactions();                                 // Init the Factions
    41.     }
    Here is what I'm trying to achive: place town, slpat the map, refresh the terrain textures.
    At the moment the only things that is working still my code to splat the map (which is the spawnedMarker class).
    The textures won't get refreshed, and at the moment I'm not even sure that the Locks creation in runtime is working too.

    So, if there's no solution I would pray for some interface to runtime jobs :rolleyes::D

    I've investigate a bit about Position, but I can't find a way to add new position to Positions.
    could you explain a bit? :)
     
    Last edited: Jul 13, 2021
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Positions should be the right choice in your case. About adding positions - I guess you are talking about scripts, since there's an Add button in node interface. Positions in the node is a public array - Vector3[]. You can change or assign your array here before the generate (but not during this process!). To do this you've got to get access to this node - and yes, this will go to FAQ as well since it's definitely not obvious:

    You can get a generator from graph by using it's id:
    - right-click node and select Generator
    - you can see the id number in list, it should be something like Id:12345
    - clicking this number will copy it to buffer so you can paste it in code or in value.
    - execute `mapMagicObject.graph.GetGenerator(g => g.id==12345)` will return this generator as Generator type
    - cast this generator to it's original type to get access to it's variables.

    I will probably add `mapMagicObject.graph.GetGeneratorById(12345)` to simplify this in next versions, but this call will remain as well.

    Unfortunately I cannot guarantee stable work with pre-release Unity versions. In most cases these errors are fixed by Unity themselves. If not - I'm testing new MM versions in the latest stable Unity, and will have to define a rule for the latest versions to maintain compatibility with the older ones.

    You had it in previous version? Is it working now?

    Edit: I've just looked into HDRP terrain shader (TerrainLit). It supports only 8 channels. It has even this comment in code: "// TODO: support more maps?"
     
    Last edited: Jul 13, 2021
    PutridEx and MaximilianPs like this.
  4. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yup. That's the issue exactly. I first thought you cleverly juggled the available textures but then noted you didn't
    I first tried limiting the amount of textures and then finally switching over to microsplat and the problem went away and I forgot to record it.


    Sorry I completely forgot that, That was totally idiotic and remiss of me. In my defense I had just woken up.
    File under NOT A BUG
     
  5. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    @Wright is right. It's the HDRP shader. Microsplat makes it all go away. Are you using that? Or maybe VsPro 16 texture mode?

    Regarding:

    Since it takes 10 minutes to repoen my project. today has required the patience of a saint.​
    Wow. Is it related with MM as well? If so I will appreciate if you could report this as well, and I will try to look why it takes to load so long.​
    No. I use Collab :( every restart scans gigabytes of data for changes that are not there. It's the stupidest professional system I have ever had the misfortune to use and Unity3D should be ashamed. Moving on. The restarts are painful. They happen less now, I honestly think you will find you still have a wandering/dangling reference one day that ends up endlessly never being serviced. Also noted it only occurs under 100% cpu load. If that helps. It's less frequent now I have most of the annoying "move sliders" editing done.

    Also: Please add to the wiki. The color format of DirectTexturesHolder is TextureFormat.RGBA32

    I tried TextureFormat.ARGB32 earlier for a while like an idiot just assuming. :facepalm:
     
    Last edited: Jul 14, 2021
  6. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I'm sorry to bother, but I still have issue on catch Positions array:
    Here i catch the Position graph object, and looks fine.
    Code (CSharp):
    1. Generator posObj= MMObject.graph.GetGenerator(g => g.id == 13281735425673658371);
    If I'm correct, the real Position array should sit in SplinesGenerators but I can't figure how to convert posObj to SplineGenerators and access to positions[] array.
    Damn my education (cit Oasis - Don't Go Away) :confused:


    [EDIT]
    Code (CSharp):
    1. Manual210 posObj = (Manual210)MMObject.graph.GetGenerator(g => g.id == 13281735425673658371);
    2. posObj.positions = new Vector3[roadVertex];
    but it return an Invalid Cast :D
     
    Last edited: Jul 14, 2021
    twobob likes this.
  7. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    What type of generator you clicked to get id? Was it the Objects/Initial/Positions node? If so, cast it to MapMagic.Nodes.ObjectsGenerators.Positions.

    Not sure that Spline positions node is what you are looking for. It will create a single spline connecting the positions list one by one. It's a 'manual' spline node initially. But in case you want to use it - check the namespace. I'm currently working on a new splines engine, and latest MM versions come with both. MapMagic.Nodes.SplinesGenerators contains the old generators, MapMagic.Nodes.SegsGenerators - the new ones.
     
    MaximilianPs and twobob like this.
  8. apprenticegc

    apprenticegc

    Joined:
    Apr 21, 2012
    Posts:
    25
    While building android version, I frequently get

    Exception: Could not load graph data:
    System.Exception: Could not find type for: MapMagic.Nodes.MatrixGenerators.MicroSplatOutput200, MapMagic.MicroSplat, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    at Den.Tools.Serializer.DeserializeObject (System.Int32 refId, Den.Tools.Serializer+Object[] serialized, System.Object[] deserialized, System.Object[] reuse, System.Action`1[T]

    Exception: Could not load graph data:
    System.Exception: Could not find type for: MapMagic.Nodes.ObjectsGenerators.Split200+SplitLayer, MapMagic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    at Den.Tools.Serializer.DeserializeObject (System.Int32 refId, Den.Tools.Serializer+Object[] serialized, System.Object[] deserialized, System.Object[] reuse, System.Action`1[T]

    then build stop. Sometimes, I can successfully make the build.

    I just remove Demo/Compatibility folder. Don't know if this is the right fix.

    Besides, that Tool/Plugins folder has duplicate NativePlugins files, which prevents the build to android. I remove x86 folder then the build succeeds. Hope this is the correct fix as well.
     
    Last edited: Jul 15, 2021
  9. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I'm a bit confused, anyway,
    Code (CSharp):
    1. .ObjectsGenerators.Positions.
    didn't exist but there is -
    Code (CSharp):
    1. .ObjectsGenerators.Positions200
    ... I'll test it later.

    Very interesting, I'll try with it too ASAP :D
     
  10. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Any suggestion on how to update a graph to the latest version?
    I have a graph in 2.1.4 that I would like to update to 2.1.6 to push on the asset store if updating it will not be to hard to maintain.
    Thank you!
     
  11. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    It's pretty sad that we can't place the Locks in runtime :(
    I mean Immagine that you want spawn some dungeons entrance or other things in runtime, without splatting a part of the terrain terrible things could happens :rolleyes::D


    [EDIT]
    What I said is !True :D
    I fond a solution that I will share for all noobs like me!

    Code (CSharp):
    1. MMObject = FindObjectOfType<MapMagicObject>();
    2. MMObject.locks = new MapMagic.Locks.Lock[3];  // Init Lock Array
    3.  
    4. for (int townID = 0; townID < Towns.Count; townID++)
    5. {
    6.        MMObject.locks[townID] = new MapMagic.Locks.Lock(); // Init the new Lock
    7.  
    8.        MMObject.locks[townID].worldPos = Towns[townID].transform.position;
    9.        MMObject.locks[townID].worldRadius = townSize + (townSize / 2);
    10.        MMObject.locks[townID].worldTransition = townSize / 2;
    11.  
    12.        MMObject.locks[townID].locked = true;
    13. }
    Let's get drunk now! :D

    [EDIT 2]
    Ok, that I get sober again, I see that it works... only in editor, during the Play it will not works, just as has been said in previous posts :(
     
    Last edited: Jul 15, 2021
  12. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Please add a spline node which takes a position and then generates paths which traveling down slopes. Options for forks would be appreciated.

    If that is not possible fundimentaly, i would settle for an interlink node which only links between two different sets of nodes. This way i could generate high ground nodes, and then low ground nodes, and have interlink approximate rivers. Without the high ground nodes connecting with eachother.

    I would also appreciate a spline mask node, which cuts splines at points based on the edges of a mask
     
  13. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    "traveling down slopes", perhaps. "Have a hi / low selectable cutoff " or "minimum slope to weld" or something else - or all of those?

    This is pure conjecture:

    Could a Seg - properly configured in function that's being passed a groups objects - consume them in a loop
    If so perhaps we can create a "lower pass" and a higher pass set of objects? and then setup that looping function to consume of pair of the nodes from the two groups, links a high node and link to a nearby low node. - Literally NO idea if that is possible.

    however looking at the tools; feels vaguely do-able now. @Wright may announce me utterly wrong. The only reason I jump in at all is a) very likely something everyone wants including me. b) I would love to know if the extant internal tools could in fact handle this scenario performantly. I have such a graph in front of me now faffing to try all this but the Segs I have not use at all yet so learning the tools must precede testing those tools.

    Did idly wonder if the slope setting could be manipulated to give such a result, but the problem of masking only some of the results seemed required as a precursor.
     
  14. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    This feels like an "object" projected down as a request for "blank space" could solve it. no? I don't quite understand the problem with "splatting." It seems like you must only interfere with the height request no? Then just place your stuff whenever. Perhaps you mean that? I'm not sure.

    If you knew the approximate shape of your town, perhaps could provide a black / white stamp of it's required perimeter? Being able to stamp in a certain extra "flatter or w/e" town height per settlement. and then just again place the cave or dungeon mouth whenever, If passing in such a template isn't already in there it's eventual creation by a user feels inevitable. (It's a image handling engine... lot's of such code already on offer to study)

    I guess I am just saying: "Are you sure this a problem"and have you checked it can't be solved already. Please Forgive me if this seems blunt, I am literally working on a similar problem and am asking. I will likely want to solve it properly in the not too distant so seek to check we have the same problem. Stamping height as a final pass and placing possibly externally spawned towns.

    It is NOT super hard to write a matrix extender having poked around in the code and authed a few now, Always consider "could I actually just whip up this thing myself for my use case" because some things seem more suited to code solution, versus pure steer by image control, in our - admittedly limited - experience.

    Thanks
     
    Last edited: Jul 16, 2021
    MaximilianPs likes this.
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    This is rather odd - have you noticed in which cases you can perform a build, and in which you cannot? Are you using MicroSplat output node in your graph?

    I will appreciate if you could report it with these questions on ideainformer.
    It's a special page to report both ideas and issues. Helps to keep things organized, that result in some pluses:
    - You will be able to track your issue/idea and know when it's fixed;
    - This ticket can also provide a communication channel dedicated to this issue;
    - Other users can also see if the issue/idea was reported, add some comments on it or clarify details.

    If you have a graph and a scene with the reproducible issue it would be great if you could link them in issue description. I will need a scene, a graph, sub-graphs if you are using biomes, and their meta-files. There's no need to send models or other assets. I will appreciate if you don't compile the unity package with the dependencies.

    I assume it might happen without changing anything, just starting a new build after completed one might fail - but this would be extremely odd, might be related with Unity build process.

    Yep, Positions200, thanks for correcting me!

    Do you have any problems updating? There should be no issues I'm aware of, but if you have any concerns I recommend making a backup of your graphs - just in case.

    The thing lock works only in editor is that it is editor-only tool. It just prevents some already generated area from re-generate on editor graph change. All it does - it stores terrain data before re-generate and then applies it after.

    Locks do not work with new, non-generated tiles - just because there's nothing to take from them to apply after generate. If you want something to be applied to new tiles - then locks is definitely what you are looking for.

    Already existing tiles are not supposed to be re-generated in playmode. Re-generating happens in editor only, when you are working with the graph to see the result when you modify it. And since locks work only on re-generate they are meaningless in playmode.

    Even if you will make them work in playmode somehow, you can get problems during performing a build, since significant part of locks code is stored in editor scripts.

    Yes, it is possible to do, with one caveat - these splines cannot go to the other tiles. This might kill the main purpose of this node - if you want to make rivers with it, not just small steams. But if it is still okay - could you please write it down to ideainformer - just to keep it to avoid forgetting when I will add more spline nodes.

    Personally I find these hi and low pass solution quite complicated, and if I get it right it still won't allow connecting the splines from one tile to the other.
     
    mick129 likes this.
  16. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    At this point, I surrender, and I will pre-define the towns position :(
    But how do I assure that the towns still on the ground and not on the water?
    Random (object generator) could be masked but in this case I can just loose some towns
    upload_2021-7-17_14-29-15.png

    Also, looks like Rotation didn't work ... even if I select just "Rotate Y".
    upload_2021-7-17_19-15-9.png
     
    Last edited: Jul 17, 2021
  17. blueFire

    blueFire

    Joined:
    Nov 27, 2010
    Posts:
    68
    How do I save a map created with MM2 as a heightmap?
     
  18. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Is there any way to export terrain as model?


    Actually it's a subject for a whole new plugin, like this one: Terrain To Mesh
    (https://www.assetstore.unity3d.com/en/#!/content/47276). However, there is a way to export terrain into 3D editor without a plugin - since MM generates the standard terrains their heightmap could be exported using the "Export Raw" button in the terrain's settings tab. This heightmap could be could be applied to the plane with displace modifier. But terrain data could be exported as a standard Unity terrain using this script: https://www.dropbox.com/s/tnb3v1s6r5h1ss0/ExportTerrainData.cs?dl=0 Place it anywhere inside Assets folder, assign it to terrain and check "Export" (it works like a button).​

    Although that may be outdated info. Seems to me you could just walk the matrices and export one but I dont know if there is such a thing.
     
    Last edited: Jul 19, 2021
  19. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  20. blueFire

    blueFire

    Joined:
    Nov 27, 2010
    Posts:
    68
    This is an in-editor request.
     
    twobob likes this.
  21. WhipJr

    WhipJr

    Joined:
    Aug 3, 2011
    Posts:
    125
    Does there happen to be any tutorials on map generation through C# during runtime exclusively?

    Alternatively, has anyone tried to enable node manipulation in a build? exclusively without the editor in a project?

    Are either of these things possible with MM2?
     
    Last edited: Jul 18, 2021
  22. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Just click EXPORT heightmap in the Unity Terrain I guess
    upload_2021-7-18_20-57-41.png

    This thing? @blueFire

    if I wanted to do that very often I would script it.
     
    Last edited: Jul 19, 2021
  23. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    @WhipJr so.. Define "in code". You mean like never ever even touching the editor and like magic being able to wind together yourself the various objects using The internal serialiser200 . to a useable output. without even running a graph. That kind of "in code" ?

    There are a bunch of events you can jump into to manipulate stuff in runtime - but there are various caveats: Thread safety being one; Not adjusting /some/ thing after /some/ stage being another; et cetera. @Wright should know a definitive answer on this however having scrabbled around in the code for a couple of weeks the "making from scratch" feels doable - but not very easy in terms of visualision (dunno about you but I find it hard to visualise normalised stacked fractal harmonics my head EDIT: Beyond two). There may be gotchas that prevent you doing all of it I don't know. Certainly some of it can be achieved.

    HOWEVER - if you simply mean - go in make some graphs. and THEN at runtime weave them together and stick some crap on top. Then yes. Again with Caveats

    this is an interesting read from MapMagic1 wiki https://gitlab.com/denispahunov/mapmagic/-/wikis/MM1/Scripting_faq
    But I don't know if that still applies.
     
    Last edited: Jul 19, 2021
    WhipJr likes this.
  24. WhipJr

    WhipJr

    Joined:
    Aug 3, 2011
    Posts:
    125
    @twobob thank you for your reply!

    If only the magic way worked xD but setting things up in unity such as initialization and graph properties all the way through to the terrain generation/texturing. I'm working on allowing people to create their own small instanced worlds, and ive got a good start on morphing the terrain at runtime, though it would just be excessively more convenient to the end-user to be able to custom generate things using something like MM2, then modify it with the terrain tools I'm working on.

    Thank you for the link, ill definitely check it out and see how it fares in this version!
     
  25. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    To be honest your question smelled like a "how can I weave this into my internal tools" question.
    It occurred to me afterwards that @Wright must perform unit tests so YES large parts of this will work. BUT all the caveats still apply and if he doesn't test for things like node creation that that might not be instatiatable in code. you'll have to ask @Wright . or buy it and read the code.

    That said: I still don't see why you just can't GO IN create functions that allow for certain changes on a limited feature set and then weave THOSE together. that seems like something manageable without any extra coding. Although I am spitballing. this seems like a possible route of less resistance. Or - put another way. perhaps there is a different solution or perhaps you can refactor your problem.
     
    Last edited: Jul 19, 2021
  26. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Hello - Is it possible to use the Mapmagic 2 Brush module with Microsplat. If so, can you point me to the documentation? I created a Brush, then assigned the "Texture" preset.. I'm able to change terrain layers for this, but not sure how to use Microsplat.
     
  27. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Welp Ive never done it but just looking

    What happens if you change the layer in the preset to one of these ones...
    upload_2021-7-19_1-53-58.png
     
    Last edited: Jul 19, 2021
  28. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    26
    Yeah I saw that too.. a folder in mapmagic demo folder has some terrain layers that start with "microsplat_"..but I don't see how to create a terrain layer with microsplat textures... these terrain layers that start with "microsplat_" just contain a diffuse and normal image... no texture array info.
     
  29. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    @Wright Is there a "Combine" for splines?

    Aside: I provided a Lazy Concurrent Dictionary implementation. That should be okay for in the Generate to ref right?
    (seems ok so far?)
     
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    ah sorry. My bad, I guess you could take a look in the various implementations.

    I eyeballed

    \Assets\MapMagic\Generators\Matrix\Runtime\TexturesOut.cs:479 (line 479) and noted
    Code (CSharp):
    1.     public string[] altTextureNames= null; //to let MicroSplat work with _Control0 and _CustomControl0
    so looked in \Assets\MapMagic\Compatibility\MicroSplat\MicroSplatOutput.cs and found
    Code (CSharp):
    1. out MicroSplatLayer[] layers,
    in the Generate method. so maybe you need a new brush that can handle those layer types?

    Total guess. Didn't look in Brush. perhaps an exercise best left to you anyway @Wright will know when he gets on.


    Code (CSharp):
    1.      public class MicroSplatLayer : BaseTextureLayer
    2.         {
    3.             [NonSerialized] public TerrainLayer prototype = null; //used in case 'add std' enabled
    4.         }
    Would seem to imply that is should "just work?" but I dunno

    The default MicroSplat material references the stuff in this screenshot.
    Which would seem to imply those layers? which is why I said the original thing

    upload_2021-7-19_3-45-55.png

    Um. Do the textures get like added at runtime? I dunno. Sorry
     
    Last edited: Jul 19, 2021
  31. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    If you have a list of positions, and each position should become a town - then maybe it's better to stamp the land here to prevent the town go underwater?

    If you are using Trees output objects are placed in scene like standard Unity terrain trees. In most cases Unity treats them as billboard/impostor trees (unless they have no LOD in prefab). This kind of objects has some limitations: they could not be rotated and scaled (scale is applied to billboards only, not objects themselves). This is Unity limitation, not MM one. You can use Objects output to place your trees as standard objects, but in this case do not expect Unity tree optimizations (batching and billboarding) and thus performance will be reduced.

    I guess the easiest way would be selecting the tile terrain object and use Unity's built-in Export Raw feature.

    Well, these manipulations are not restricted, but I really do not recommend changing graph in build. This can lead to some threading problems, and terrain can become a mutant of previous graph and a new one.

    However, you can still experiment with it. Try looking template graphs on how to create graph from scratch, link nodes and change values. See GraphTemplates.cs, CreateTemplate() and CreateBig()

    You can paint MicroSplat terrain with the Brush in the same way you paint it with the standard tool. Each time you apply the Brush MicroSplat textures are updated based on changed splatmap information.
    The only thing to mention: make sure you are painting with MicroSplat prototypes - MS creates it's own prototypes for some reason. In terrain inspector, paint tool, Terrain Layers, select splat, click Edit Terrain Layers -> Replace layer. You will see the used layer in an asset list, and it is the one that should be used to paint with Brush.

    Could you please clarify how the splines should be combined? Just added to one from several inputs?
     
    Last edited: Jul 19, 2021
  32. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Eh it's fine -I'll just build one then. if it doesn't exist.
    Thanks

    But yeah. even just TWO INTO ONE allows /n/ into one eventually. With no way to combine splines and as far as I can see no easy way to just create seg splines from "scratch" it's clear we will want to expand the toolset in that area anyway. Faster to just write a few than to tie you up in writing some.

    EDIT: but if you waaaaant to provide some kind of ninja fast implementation.. Hell go for it.
    (I think i saw some Den.Tools about arrays that looked likely to use for splicing, I would've just used them based on examples from extant code that does merging, think I saw some of them too)


    It's clear you are already busy
     
    Last edited: Jul 19, 2021
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    plumbing a blend back into a microsplat node eventually bombs the editor.

    upload_2021-7-20_12-37-36.png

    Unity will eventually die. Usually when you wiggle the pipe near the connector a bit too much. Hope this helps.
     
    Last edited: Jul 22, 2021
  34. monoRAIL

    monoRAIL

    Joined:
    May 22, 2010
    Posts:
    9
    Is there any support for custom terrain shaders in Map Magic 2? Currently, adding a custom terrain shader breaks the terrain (vertices move to random positions, using Unity 2021 and URP). Adding the shader to a non Map Magic generated terrain works fine. There's no documentation for the Custom node in the Wiki, and the Custom node appears broken (it's not possible to change the number of Textures to anything other than 12).
     
  35. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    Hi,
    I have this error with a new project and the demo.
    Unity 2021.1.11f.
     
  36. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Is any graph assigned to MapMagic object graph slot?

    It depends on what your custom terrain shader is. It should work if it does not require any per-terrain component - i.e. only the material, with no additional components. If it works together with the scripts - like Microsplat, Megasplat, CTS, etc then it require additional MM-compatible code.
    If you email me the shader I can have a look what went wrong.

    Thanks for the finding! MM has a check that prevents connecting nodes in loops and displays the connection in red. But seems that with MicroSplat it failed. I will appreciate if you could mention this on ideainformer.
     
  37. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I give up
    ten hours

    upload_2021-7-23_3-44-20.png

    No idea what this is. @Wright is it yours? any clues? my
    project is currently dead
     
    Last edited: Jul 23, 2021
  38. monoRAIL

    monoRAIL

    Joined:
    May 22, 2010
    Posts:
    9
    Hi Denis, thanks for the quick reply. I was attempting to follow this tutorial to make a terrain shader for URP using Shader Graph:


    Creating a new shader-graph lit shader with just a color node linked to the albedo works for a normal Unity terrain. It changes color and draws correctly. (There is a warning about missing tangents, but otherwise it works fine).

    However when I apply the same material to a Map Magic 2 generated terrain the vertices are randomized, breaking the mesh. Perhaps there is a setting in Map Magic I'm missing to generate the terrain correctly?

    Also, I just wanted to let you know that I used Map Magic 1 to make this game:

    I imported a RAW heightmap of the location on mars and used Map Magic to generate procedural textures and rock scattering. It was a real life saver, as there were 35 square kilometers of landscape to texture and populate.
     
    rillani and blacksun666 like this.
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    This error could be caused by a hundred of reasons. I need to break on this exception to see what is null and why. And to do this I've got to reproduce it.

    If you want more or less swift feedback - find me in discord, I will try to dedicate some time tomorrow to look through these issues.

    This sounds line you are trying to use instancing on non-instanced shader. Try disabling Draw Instanced in Terrain Properties in MM object.
     
    twobob likes this.
  40. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yes. If only the errors that bubbled up were a bit more meaningful. seems like the original meaning of the error has been lost there.

    Thanks. I was asking about a discord. Appreciate the tip. I didn't tie up your personal time Dennis. I took the time and fixed the issue on my side (I just rolled back and did the work again, it's okay now). All the outstanding bugs will be reported to IdeaInformer.
     
    Last edited: Jul 24, 2021
  41. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    With version 2020.3.14f1 I no longer have this problem.
     
  42. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    in game mode I have this error (Unity 2020.3.14f1)
    Exception: MapMagic: Graph data is not assigned
     
    twobob likes this.
  43. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Well I use the LTS, so that for sure works.



    if you look in the Map Magic graph. is there a Graph missing from the default graph that is loaded.
    I understand you didn't change anything but this is unity (heck any complex software delivery un-bundling mechanism ), odd things can happen.
     
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Is any graph assigned to MapMagic object graph slot?
     
    twobob likes this.
  45. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    ok it's good now
     
    twobob likes this.
  46. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    It dimly dawns on me that your serialiser200 must have a
    where TValue : new() somewhere in it... that was the generic constraint that was enforced on my Bundle class?

    I'm not sure, that feels like maybe it should make it into a wiki somewhere one day.
    This is not a complaint - simply an aide-memoir or maybe a "phew I'm glad he posted that" for someone else.
     
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Do you mean Serializer or GraphSerializer200Beta? Are you talking about generic custom node?
     
    twobob likes this.
  48. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hiya mate. I simply implemented a custom graph node. And within it's generate method it ends up creating yet another custom (struct really) Class (AotaBundle). The serialiser (I guess the default one?) required that the AotaBundle have a default parameterless constructor. This confused me at the time but I since recall that you can enforce the generic new() constraint on consumed types. So was wondering if that was the case. If it is, then it would be nice documented.

    certainly not a complaint, just a developers observation.
     
  49. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    By the way. I can confirm that LazyConcurrentDictionaries do indeed solve the problem of 9 threads trying to read one piece of data (that doesn't exist yet but will really soon). Another thing I would be very happy to put in a wiki for the next developer. So it doesn't take them a week to run the tests ;)
     
    Last edited: Jul 26, 2021
  50. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    upload_2021-7-28_14-15-9.png would be okay. A layered one would be fancier but we don't need that. I reckon people would want it, if only to tidy up their graphs.