Search Unity

MapMagic 2 - infinite procedural land generator

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

  1. Tomcat9

    Tomcat9

    Joined:
    Dec 10, 2020
    Posts:
    6
    Hey,

    Does anyone know how to reduce the amount of grass that appears from other biomes? Say for example using the demo biomes, badlands, plains, and snow plains: all the grass from the plains appears heavily over the badlands and thus it no longer looks like a badlands as it is coated in grass. I tried messing around with contrast etc since I saw that mentioned here but the issue still persists. How do I reduce the amount of grass that is appearing from other biomes? Appreciate any help in advance!
     
  2. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Good point. I can go even further and assume that we only need spline entrance and exit coordinates to the tile and their direction - and we can have a road made with Pathfinding using tile relief. However, we still need to be aware of town positions - at least one tile beforehand. It is good if we can have them before actually generating the tile, but it's more of exception.

    I will appreciate if you could report it on ideainformer.
    Could you please mention build platform here? Does it happen any time you perform a build, or in some particular cases?
    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.
    - And for me it's way more convenient to track issues in tickets, and discuss them per-ticket rather than use email or forum
    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 didn't get what went wrong, but glad you could sort that out. Or do you need my help with that?

    The thing is that this height - 55+ - is the internal height of mountains biome, not the resulting map. If you apply seas here it won't change, since mountains biome is not aware of the mask it is applied. So your assumption is correct.

    However, you can remove trees where sea biome is used completely by changing Biome Blend in Trees Output (in Properties).

    These margins are made to extend the tile (for better welding), not reduce it. I have never thought of a negative value here, but you are right, I should limit it to zero to avoid misunderstandings. Limiting scatter area to some particular size will make Scatter node tile-size dependent, and I'm trying to follow independency from tile size principle.

    I guess I should make a similar biome blend value, similar to Object and Trees outputs (see link above). Will plan it for the next version.
     
  3. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Okay, you can see what I was driving, that's the main thing.

    Yeah. The sad thing is I think a lot of people are using that to stop things going near the border to fix things like "When you flatten in a circle too near the edge you mess up the whole border." removing functionality might not have the reaction you expect on that. Just saying that, kindly.


    As for the other things I sorted myself out.
     
    Last edited: Sep 19, 2021
  4. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Although setting a node's tangent is still a mystery

    upload_2021-9-20_0-35-34.png

    Genuinely struggling to get expected results. But getting results nevertheless.
    and no - I am not asking how "direction" works,

    What I mean is UpdateTangent and Update and Update Postion all seem very mysterious and when excluded or included in various combinations give very odd results. One would imagine that UpdateTangent() then Update() on a start and end node of a segment in a Line /might result/ in that line being updated with a new less bendy segment... Not entirely sure still why it doesn't...

    we just do some setup which is snipped here
    Code (CSharp):
    1. foreach (var item in dst.lines)
    2.             {
    3.             for (int i = 1; i < item.NodesCount - 1; i++)
    4. var cur = item.GetNodePos(i);
    5.                     var nv = Vector3.zero;
    6.                     var newFull_I_Value = new Vector3(Full_I_Value.x, 0, Full_I_Value.y);
    7.                     var loc = new Vector3(cur.x, 0, cur.y);
    8.                     Vector3 place = Vector3.zero;
    9.                 {
    And then some very obviously named methods are called. Their return values have been checked
    upload_2021-9-20_0-42-33.png

    However updating the bendiness values does not result in less bendy lines (which it probably should)


    I see very clearly in your code

    upload_2021-9-20_1-2-22.png

    But, this goes not seem to be true; for the preview at least

    upload_2021-9-20_1-3-34.png
    Unless I pump the UpdateTangent myself I get the wrong results.

    And if I do update it I get very odd results. I am probably doing it wrong. But in the absence of docs trial and error is what we have...
     
    Last edited: Sep 20, 2021
  5. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    it's ridiculously annoying that I had this working as expected before the copy pasta
    Calling UpdateTangent on a node that is followed by a line.Update seems just stupid.

    If I call line update I get out that includes updated tangents but amending the rotations as I am doing seems to then have no effect. I am pretty confused. Seems like is should be easy to set a DIRECTION!!!!!!! and a position on a node. and it isn't.

    upload_2021-9-20_1-18-54.png

    For what it's worth I did try looking at a matrix operation for Matrix2D on the rotations but did not get the gist of what you were doing there.
     
    Last edited: Sep 22, 2021
  6. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Hi, I'm looking to paint sharp rifts in the terrain with MapMagic brush, but I'm unable to get the brush to appear. I've added it to the terrain object as shown in the documentation, but all I get with my cursor is the select tool. Can anyone see what I'm doing wrong? Also, I tried to do this with import bitmap -> blend : subtract but kept end up losing the shape after it got small enough.
    upload_2021-9-20_3-5-47.png
     
  7. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I can see your Gizmos toggle in Scene View is turned off. Tile, pin frames and brush gizmo are actually gizmos, and like all the other gizmos they could be disabled to not interfere the scene view.

    I see what you mean. Yes, in some cases we really need to remove objects near the tile borders. Using Simple Form (pyramid) mask for that might be an overkill. Maybe it goes against MM concepts, but yeah, I will think about the node that does that.

    What rotations do you mean? In case you want to rotate spline nodes - they actually have no rotation, only a position. They are just points. The direction of the spline that is passing through them is determined by tangents. Actually each segment - is 4-point Beizer curve, where start and end are node positions, and 2 points in-between are tangents. It's the usual approach for most of the software that uses Beizer splines I've seen.

    Tangent coordinates are relative to segment start or end positions.

    UpdateTangents position these tangents that way that all of the segments end point tangents are continuated with the next segment start point tangent based on segments positions. In other words it makes the spline smooth, with no crisp edges. Do do so you've got to have positions already set, that's why it calls UpdatePositions first.

    Sorry if I mention the obvious thing, I'm just not sure what exactly are you asking.
     
    twobob likes this.
  8. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058

    Opps. I meant to say Direction not rotation. Sorry. (it was the name I gave the parameter unthinkingly)

    Yeah. It's really simple:

    Please: How do I set a Direction and Position of node and have that then update in the editor.

    Just that. A single example that actually DEFINITELY updates a node's position and direction. I can extrapolate from there myself.

    I thought it was as simple as
    upload_2021-9-20_9-0-3.png

    (yes I called it rotation but it's a direction as you say, doesn't matter)

    however if I set the Position AND the direction of a node I do not get the expected values out.
    So please just a quick code demo of how to do that. I have spent hours trying various permutations now, with various odd results. it should be so simple right?

    Perhaps I should say "Why is there no Node.SetNodeDirection" method.
     
    Last edited: Sep 20, 2021
  9. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
     
    twobob likes this.
  10. AlexLuss

    AlexLuss

    Joined:
    Aug 5, 2021
    Posts:
    2
    Thanks, this does the job for trees. However, there doesn't seem to be an equivalent option for grass. Is it something you plan on adding, or is there another way to handle grass for biomes?

    Otherwise, I am having trouble handling biomes with different height levels and make the transitions look natural. For example, with 3 biomes being mountain, plains, and ocean, the transition between plains and ocean would be beaches. But unlike when generating beaches around an island, the plains biome cannot know at which height it is transitioning into ocean.

    Do you have any advice with this type of cases? I am starting to think it would actually be easier by handling all biomes into a single graph than relying on the biomes feature, until we get more options to handle transitions between biomes.

    I have an extra question: is there a way from code to know which biome a position is in?

    Thanks for your assistance!
     
    Last edited: Sep 21, 2021
    twobob likes this.
  11. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hi. http://mm2.idea.informer.com/proj/?ia=137214 he is aware of this "Shared Biome height" request. please consider voting on the issue so he can see we all want it.

    Regretfully using hdrp so can't help you on the grass. o/
     
    AlexLuss likes this.
  12. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I'm thinking of providing biomes some additional maps.

    First of all it will be biome mask, so you can use it to know where biome is applied, and with what intensity. This way you can remove grass if biome is not 1.

    Then probably it will be parent graph height. This way you can make biomes that do not generate height at all, and use parent height only, or just add some detail to it. Not sure yet if could be implemented though. Will require some deep biome changes, event if I will use functions input codes for that.

    Just a plan, I can't promise it won't change.

    Hmm, might it be that you have a MapMagicBrush checkbox disabled in Gizmos dropdown list?

    And you can use Functions to simplify this graph. I really recommend using them, it's a powerful tool that can not only simplify the graph, but can replace biomes in some aspects.

    You can output biome masks (in parent graph) to read them after the tile is generated using Direct Textures and Direct Matrices.
     
    AlexLuss likes this.
  13. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hi please can you just give me a one liner how to set a Node DIRECTION and Position please?
    I desperately need one so I can finish this "Wiggly" control and get it out the door.

    Just the most simple example.

    Also that "hang" issue is creeping back now the graph complexity got high again. Unity just becomes completely unresponsive forever - at the moment of loading the next tile.

    upload_2021-9-21_10-24-40.png

    This is the wait state. It's always the same. "User Request" feels like a lost id.
    Have to actually hard Kill unity using Tasks and then reload the project. It's non-recoverable.

    I have reported this on mm2 informer before. fwiw.
     
    Last edited: Sep 22, 2021
  14. WojciechWlodykaTakeItStudio

    WojciechWlodykaTakeItStudio

    Joined:
    Nov 20, 2020
    Posts:
    2
    Hello,

    Im using MapMagic 2 with MicroSplat integration, everything seems to be set properly, but node wtill returning "The assigned material is not MicroSplat".




    We have integration with microsplat enabled



    Have anyone came across this issue?
     
    twobob likes this.
  15. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058

    Try just sticking on the MicroSplatMaterial (Demo texture) in:
    upload_2021-9-21_11-16-2.png

    that should always "just work".
     
  16. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    There is no such thing as a node rotation. No, no, the nodes are not rotated. They have tangents, but these tangents are calculated automatically to smooth the spline. So it's better treat them as points.

    To make the spline wiggle you've got to add some points in between the previous points. This will insert a new point between the first (number 0) and the second (number 1) nodes in the first spline in a system:
    Code (CSharp):
    1. Line line = mySplineSystem.lines[0];
    2. Vector3 midPoint = (line.GetNodePos(0) + line.GetNodePos(1)) / 2;
    3. Vector3 wigglePos = midPoint + myWiggleVector;
    4. Node newNode = new Node() { pos = wigglePos };
    5. line.InsertNode(0, newNode); //this will add new node after node 0
    To insert more nodes note that the nodes count have increased, so next point should be added between no. 2 and no. 3.

    Yeah, I know, it would be more handy to use just the array of positions, not "nodes". That is why I'm going to switch the engine - you can find the new one in Segs folder if you are curious.

    Do not forget to update the spline after.
     
    twobob likes this.
  17. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yes - apologies. The TERMINOLOGY is not really important - The Direction.
    (It's not like I'm actually trying to pass it a Quaternion or anything I just call it the wrong thing)

    anyway
    Don't see you setting the DIRECTION at all there?
    isn't that just a "how to insert nodes, and then let the engine decide on the direction" example?

    I want to know about setting direction directly. please - what if I don't want them to be smooth? or I want to make the lines crazily wonky? you know ARTY stuff :)

    Failing to understand how this is hard to explain, sorry, perhaps I am being obtuse in some way :(
    I just want to set a direction myself and then see that in the preview.

    Currently, as shown in several screenshots above it seems to not "honour" my very direct requests to set the direction of a node, Is this not supported? It certainly looks supported all the code is there. I mean heck at this point I will just trace all the code though myself and figure it out then.


    I am also pissed because I had it working and copy pasta'd over it - ARGH
    Just hoped for a simple, working, example. Just can not get my head around how your example sets direction?
     
    Last edited: Sep 22, 2021
  18. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I wrote all of these using the seg engine in the beginning a couple of months ago.
    the only reason I switched back to spline is the seg tools are so under-developed that it made working with the other stuff like objects and whatnot pretty tough back then before I knew how to just join them all with new controls.

    I guess if you are going over to segs then I will just port it over there again. It's pretty doable changes. I recall the classes were vaguely similar - ish.
     
    Last edited: Sep 22, 2021
  19. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    One more thing. and I'm not even gonna report this as an "issue" - it's just not done yet.
    Functions don't handle the case of the new reduced worksize view. You probably knew that.
    upload_2021-9-22_11-50-28.png
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    The best thing that describes 'direction' and 'size' is tangent. Tangents are calculated automatically on each spline update. So there is no proper way to set them manually - except adding points. Direction depends on the positions of other nodes after update, not manual vectors. Yes, I know, there's no need to make Beizer in this case, it is kinda overkill, so I'm going to switch to new system here.

    Thanks for reporting this.
     
    twobob likes this.
  21. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    okay doh. I did have way of setting them reliably. that makes me even sadder that I lost it. hahaha

    EDIT: Eh.. Think I fixed it. nice one. Just needed to call the Update at the right moment it seems.

    I'll do it all again then for segs, seem to recall them having some operations methods that looked juicy for the task anyway. ? BeizerOps something. or is that the system you are moving away from?

    thanks for replying

    Eh looked it up upload_2021-9-22_22-11-5.png

    so. DO use those - right?
     
    Last edited: Sep 23, 2021
  22. Deleted User

    Deleted User

    Guest

    @Wright would it be possible to consider having native libraries for M1 (Apple Sillicon, arm64) in the future ? Thanks
     
    twobob likes this.
  23. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I seem to recall him including the source for them...
    Perhaps it is possible to compile them yourself? Maybe the question could be "Is it possible for me to just build these sources to work as native?"
     
    Deleted User likes this.
  24. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Last edited: Sep 23, 2021
    rillani likes this.
  25. Deleted User

    Deleted User

    Guest

    Absolutely ! Brilliant !
    @Wright Maybe the question could be "Is it possible for me to just build these sources to work as native ? :)
    It could benefit other users as well in the future.
     
    twobob likes this.
  26. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Fact is they may well have access to quite exotic compilers. Nothing to stop someone being all fancy with Console target. Those black boxes are out there that let " only A Class" developers debug on very special rigs that only they can get... end of the day I suppose you just need a c# compiler. to make the dll. and then the right code bits to link that in.

    Might be messy a bit. and need some love during updates. but versus /not/ having native support. no-brainer? (I roughly looked through the path of implementation for something that is supported it seems intertwined and has a few ["magic" class and type Defines / words] but far from impossible) Can't speak for Denis but certainly from an individual standpoint it seems achievable with a little knowledge and time
     
    Last edited: Sep 23, 2021
    Deleted User likes this.
  27. mrpotson92

    mrpotson92

    Joined:
    Jan 1, 2018
    Posts:
    2
    Any way you could demo lakes for MM2? Most of these nodes don't exist anymore
     
    Last edited: Sep 24, 2021
  28. Deleted User

    Deleted User

    Guest

    Sure, I've looked around but can't find any source. The only way would be to go and decompile/recompile - otherwise it 'works' without the native c++ checkbox but I just get a billion of :

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. 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)
    3. 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)
    4. Den.Tools.Serialization.Serializer.Serialize (System.Object val, UnityEngine.Object[]& unityObjs) (at Assets/MapMagic/Tools/Serializer/Serialize.cs:64)
    5. MapMagic.Expose.Override.OnBeforeSerialize () (at Assets/MapMagic/Expose/Override.cs:244)
    6. 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)
    7. 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)
    8. Den.Tools.Serializer.Serialize (System.Object obj, System.Action`2[T1,T2] onAfterSerialize) (at Assets/MapMagic/Tools/Serializer.cs:177)
    9. MapMagic.Nodes.GraphSerializer200Beta.Serialize (MapMagic.Nodes.Graph graph) (at Assets/MapMagic/Nodes/GraphSerializer.cs:53)
    10. MapMagic.Nodes.Graph.OnBeforeSerialize () (at Assets/MapMagic/Nodes/Graph.cs:1149)
     
  29. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Oh okay. There are different levels of access I assume to all his gear.
    Back in the day thought it was in the repo. Denis will know
     
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    someone asked for this, it does not respect spline orientation.


    it's pretty much a one-liner

    Code (CSharp):
    1.  foreach (var item in splinesys.GetAllPoints(resPerUnit: 1).SelectMany(list => list))
    2.             { objs.Add(new Transition { pos = item });  
    Sorta thing, if there was a more direct, better, or internal way I couldn't see it.
     
    Last edited: Sep 24, 2021
  31. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Seems that Unity package manager ignores C++ source files. However you can always get the latest sources on GitLab - you can download repository with the download button to the left of Clone button. For C++ sources see .NativeSources folder.

    Sure.
    Here is the way to place lakes made with object planes:
    Lakes.jpg
    It is randomly placing objects in lowlands with Random. Lowlands mask is determined with Curve node - it inverts the heightmap and makes it contrast. Rarefy removes several closely places objects, leaving only one. Stroke paints circles at objects locations, and then Blend subtracts these circles from heightmap - to actually make lake hollows. Adjust raises water planes above ground a bit.
    You can find the graph here.

    As far as I can say it is the common thing for all of the assets that come with asmdef files, no?
     
  32. Deleted User

    Deleted User

    Guest

    Thanks ! From there I can fetch both Xcode + C+1; but then ... I have no clue on where to go; I can build on Xcode but doesn't seem to 'output' anything, same for dll. I'd be grateful if you could point me to a starting point to get this to run. Also, any idea on the Serialization error (above). Thank you !

    EDIT: Actually found the exact same bug, it's a regression ? (Unity 2021.2.0b12)
    http://mm2.idea.informer.com/proj/?ia=136908
     
    Last edited by a moderator: Sep 26, 2021
    twobob likes this.
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Actually it's just a not yet supported thing for asset store Packages. (That appears to be the issue) You can't do anything about that. I have asked Unity very nicely and added my voice to the single thread on the subject.
    If Map Magic were also offered as a UPM package then it would not be an issue. Unity have said it's certainly not technically impossible and referring to a post dated from last year they mentioned it was "in the backlog". There is little more I can do until that is the case. And No: I didn't expect you to drop everything and do that. I simply created the relevant Package structures for when and if a) MapMagic ever became a UPM package, or b) Unity finally implement "regular Asset store packages" to have their dll's reffed by UPM Packages. Thanks for responding anyway, but that is the situation. It's fine. I was just trying to save people a few clicks and have upstream updates for them. Hardly matters. If you ever do consider adding some simple utilities in line with the stuff in the main package that would be great, however, I honestly don't think my programming is of a quality, style or direction that you want in the main branch or I might have gone down that road. Much of this stuff is just one day projects to solve a certain thing someone wanted in the most direct way possible.
     
    Last edited: Sep 27, 2021
  34. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I managed to get a much smaller project (basically empty) to hang on that "possibly lost thread" error - In this case I just kept adding a lot of nodes onto curve and then wiggling them around a lot. Eventually this causes the hang error.
    Does that help????
    upload_2021-9-27_0-8-5.png

    Here was it's final death message before the hang. (Which most likely has nothing to do with anything, but this is what it said)

    upload_2021-9-27_0-9-39.png

    As always the processor is churning at about 13%, as always, when this hang happens.
    So it's not DEAD it's just "lost" "doing something that never returns"

    As always I had to Force Quit Unity directly.

    Hope this helps.

    I could add these details the MM2.informer report but I don't think they add much. Just maybe give you a way to repro with a default project?
     
    Last edited: Sep 27, 2021
  35. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    @Wright This is sort of what I mean about how the internal engine already respects - and can cross - tile boundaries
    As you said before it really about the processing of some kind of "global positions" - and this is obviously not possible to do with values that don't even exist yet.

    I did try to think of an example that used just your stuff - this was as close as I got. I struggled to get interlink to accept the global positions - (possibly because of http://mm2.idea.informer.com/proj/?ia=137308 the lines were perfectly aligned and I didn't think to test with non orthogonal values but maybe I will ) however as you can see if I get those splines going in the first place (I just shoved on something that draws one spline between all the points) and then slice them up again into node based objects - that you pass back again into interlink. It will swallow that.

    My point is. All the built in stuff could do this anyway with just a bit of a rethink about how it honors those global position requests when converting with interlink. If interlink had worked as expected here (EXPECTATION BEING: It interlinks the values passed NO MATTER WHAT if the clamp is SET TO OFF ) then this could have all been done with the builtin? It doesn't even seem like a change really. Just making that one control operate in a certain way that is not "Out of typical expectations for the settings that exist now" if the conjunction of some pre-processed global positions existed.
    It feel like that "paths that traverse tile borders" is not a huge adjustment to the ways things work.

    upload_2021-9-27_1-45-37.png

    Hopefully that outlines my overall point about Tile Borders and the Global Issue. It's really a non-issue if it just approached correctly and doesn't seem to break determinant behaviour that I can see; Other than the POI style where objects positions simply don't even exist yet. and there is no obvious fix for that. Time-travel is out ;)
     
    Last edited: Sep 27, 2021
  36. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I guess it occurs once per broken graph on deserialization, and constantly when the broken graph is selected. I would appreciate if you could mention in a ticket what graph is broken - and after what operations it starts to be broken (i.e. what should I do to break it).
    Not sure that this is regression - it is a common serialization issue that could be caused by numerous reasons. It might be the reason I'm not aware of or way to a known reason occurs under unusual conditions.

    As far as I understand the point is in interlinking some fixed list of positions - that will make the similar world-sized spline system, and will generate it for all of the tiles. And then each tile uses only it's own part of this system, processes the central lines, but don't touch the borders.

    Yes, that will work, but the drawback is that you need a fixed list of positions you want to interlink. You cannot add new positions dynamically.

    I'm currently thinking of another approach - I call it Cluster Biome. It is a biome that is generated for several tiles - and then each tile takes a part of it, like tile reads only the part of the Import node. This way you can not only interlink POI within really large areas (like game continent), but also make some advanced stuff like rivers, etc. Require pretty much changes, but I hope it worth it. And it sounds good for maps, but got to solve the way to pass clusters of objects and splines.

    Could this be reproduced?
     
    rillani likes this.
  37. xTcHero

    xTcHero

    Joined:
    Mar 18, 2014
    Posts:
    8
    I'm sure this has been mentioned earlier, but I couldn't find anything.

    When importing the MapMagic 2 bundle, after creating an empty node, I get the following errors:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. 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)
    3. 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)
    4. Den.Tools.Serialization.Serializer.Serialize (System.Object val, UnityEngine.Object[]& unityObjs) (at Assets/MapMagic/Tools/Serializer/Serialize.cs:64)
    5. MapMagic.Expose.Override.OnBeforeSerialize () (at Assets/MapMagic/Expose/Override.cs:244)
    6. 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)
    7. 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)
    8. Den.Tools.Serializer.Serialize (System.Object obj, System.Action`2[T1,T2] onAfterSerialize) (at Assets/MapMagic/Tools/Serializer.cs:177)
    9. MapMagic.Nodes.GraphSerializer200Beta.Serialize (MapMagic.Nodes.Graph graph) (at Assets/MapMagic/Nodes/GraphSerializer.cs:53)
    10. MapMagic.Nodes.Graph.OnBeforeSerialize () (at Assets/MapMagic/Nodes/Graph.cs:1149)
    11. UnityEditor.HostView:OnInspectorUpdate()
    12.  
    and

    .

    Any suggestions?
     
  38. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    xTcHero, are you using Unity Beta version?
     
  39. xTcHero

    xTcHero

    Joined:
    Mar 18, 2014
    Posts:
    8
    @Wright Correct. Do I need to downgrade?
     
  40. Deleted User

    Deleted User

    Guest

    I have the exact same error; and same Beta version.
     
  41. xTcHero

    xTcHero

    Joined:
    Mar 18, 2014
    Posts:
    8
    Downgrading to Unity 2021.1.22f1 and using URP solved more or less all of my issues. Hopefully Unity can get HDRP working properly soon, lol.
     
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Yes, unfortunately I can't guarantee compatibility with non-released versions - it might be something broken in Unity, and it will take a lot of time to find it out.
     
  43. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    sounds good. Looking forward. I know a lot of people are waiting on that one to solve all manner of related height and masking issues.

    Alhough I would say just one town can be larger than 3x3, just a thought.
    upload_2021-9-29_15-14-32.png

    Honestly, that lost thread thing can be reproduced pretty reliably if you stack really silly amount of UI calls like shown. it's very likely something in one of the UI callbacks "wandering off never to return". But I don't know that code well enough to hazard a guess exactly where.
     
    Last edited: Sep 29, 2021
  44. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    upload_2021-9-29_3-44-50.png

    I put together that Town control and mocked up some whitebox fwiw.
    upload_2021-9-29_9-50-45.png

    Total complexity per tile 123.
    upload_2021-9-29_14-19-11.png
     

    Attached Files:

    Last edited: Sep 29, 2021
    Deleted User, rillani and maniak_001 like this.
  45. Deleted User

    Deleted User

    Guest

    Sadly I can't get any lower than 2021.2.x because there's no M1 Editor build ... It's insane that Unity broke such core thing as serialization ...
     
  46. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    @Wright how can I access to the SplatMap?
    I mean by passing which component, class etc..
    Would be nice if I could also read it in the editor :D
    I need to check it to spawn objects on a specific texture at runtime... I'm using MicroSplat!

    Just to be more specific...
    I try to access to splatMap from an external script, that gameObject get spawned by MM after the MicroSplatTexture nodes. So I suppose that the splatMap have to exists somewhere
    upload_2021-9-29_20-53-40.png
     
    Last edited: Sep 29, 2021
  47. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Terrain.activeTerrain.terrainData.alphamapTextures[0]
    "SplatAlpha 0 (UnityEngine.Texture2D)"
    base: "SplatAlpha 0 (UnityEngine.Texture2D)"
    alphaIsTransparency: false
    calculatedMipmapLevel: -1
    desiredMipmapLevel: -1
    format: RGBA32
    isReadable: true
    loadedMipmapLevel: 0
    loadingMipmapLevel: 0
    minimumMipmapLevel: -1
    requestedMipmapLevel: -1
    streamingMipmaps: false
    streamingMipmapsPriority: 0
    vtOnly: false

    upload_2021-9-30_18-34-42.png

    Set the Microsplat output to "Splats"

    Ensure that a) The numbers are CORRECT and DO NOT EXCEED THE MAXIMUM VALUE defined in the MicroSplatConfig layers list. So 0 1 2 3 for 4 layers defined (It's a bug, he will likely fix it.)

    then access it via the Terraindata splat data as outlined above
     
    Last edited: Sep 30, 2021
    MaximilianPs likes this.
  48. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Upon further investigation. So Denis, did you ever turn the SPLATS output on? with more than 8 Microsplat channels?

    You mentioned before to someone to do that to export the values to splats but as far as I can see doing that with more than 8 channels would make Unity crash.

    So, did you try it? I gave it a couple of goes and everything crashed. (maybe cos I was in hdrp? I am not sure. but 8 feels like a hard limit. that seems odd since obviously microsplat support 16, hmm maybe the terrains?)
    Cheers. Now I will set up a basic project with less than 8 and see how that plays out.
    EDIT:

    Okay so investigation time.. things that are bad a)
    If you switch to SPLATS but have MORE layers than you actually have splats then an error occurs

    upload_2021-9-30_15-22-28.png

    the presumption must be being made that the user will have the exact right amount of splats as compared to the materialDefinition, which whilst SENSIBLE is not guaranteed. (actually so far I have only ever seen 3 projects where people didn't abuse that setting since it "doesn't seem to matter" in the Textures workflow) even though the material is set to 8 in this example. Since only 4 have been defined in the MicroSplatConfig

    upload_2021-9-30_15-37-56.png

    upload_2021-9-30_15-38-19.png

    It seems likely that 'something' above this needs fixing with extra logic. or something - to simply return "the max" for anything above "the max"
    upload_2021-9-30_15-40-55.png

    The actual output does work however (we asked for texture 4 to be on Layer 5(6 cos 0 indexed))


    upload_2021-9-30_17-21-3.png

    Without diving deeper I would be guessing but in nutshell the results should return the "Highest Valid" array value (capped at the actual texture count) for any indexes higher. since this is what Microsplat does, this would result in the Higher values "automatically" giving us that "highest indexed texture" not just 'erroring'.

    http://mm2.idea.informer.com/proj/MM2?ia=137412

    Things that are bad b) - maybe I missed it but is there a piece of code that walks over multiple microsplats, figures out their actual texture (even though they might be in the wrong order) and then mixes them for multiple outputs? I didn't see it?
     
    Last edited: Sep 30, 2021
  49. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Setting AVOID to a high number makes tiles not render

    I didn't read the code of AVOID yet so I presumed (likely, in error) that it might need a pass for each object.

    And so set the number at 40. as you can see - the tile just fails to render with no warnings.
    Turning down the value does indeed eventually draw a tile when the value is "low enough."

    upload_2021-10-1_1-10-12.png

    Insistent testing will eventually eat all the memory

    upload_2021-10-1_1-14-49.png

    ouch. :)

    and if you keep trying this and set the AVOID to about 18 and press refresh "some times" then eventually our old friend the HANG BUG kicks in from time to time

    upload_2021-10-1_1-39-34.png

    Forcing a manual "Task end" requirement to continue.
     
    Last edited: Oct 1, 2021
  50. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    So like I read it.
    upload_2021-10-1_1-57-4.png

    And so does that mean that iterations in fact end up being the amount of additional segment that can be added?

    I see it calls upload_2021-10-1_1-58-57.png

    But don't really comprehend what is happening in there. It makes extra segments, via GetSplitted, does GetSplitted also introduce an offset to move it away from the "near" object that is detected? it's all a bit mysterious, doesn't look like it introduces an offset but.. ¯\_(ツ)_/¯

    And if that is the case then do I need to do just one iteration and that will add ONE SEGMENT split extra PER object??

    Or does it - as it seems to read - just do that once?

    The helpink points to helpLink ="https://gitlab.com/denispahunov/mapmagic/wikis/map_generators/constant which is obviously not correct. so I am reduced to reading or asking. and reading failed. thanks.

    (Next up. Iterative empirical testing to find out the answer )

    One more thing.. if Size factor is an int

    upload_2021-10-1_2-19-8.png
    Isn't this 1-sizefactor trick here in fact for getting floats back into a 0-1 range?

    upload_2021-10-1_2-20-11.png

    Meaning any value other than 1 would be.. well.. I am not even sure. maybe "Just appear to have some kind of huge distance scaling?" not what was intended; which I presume was: A linear scalar of some other value?
    Anyway it just read as "maybe wrong" since having an INT as a factor is pretty weird anyway when you are implementing fine scaling.

    And therefore as well should the Size factor Setting just be a a slider, limited 0 -> 1. That would seem to "make sense and implicitly describe a linear relationship"?

    moreover. would not a value greater than 1 result in multiplying a negative?

    Is that bug? I have no idea. Could be "user idiocy"

    I'll "Avoid" using it in any demos until I know.... heh.
     
    Last edited: Oct 1, 2021