Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Map Magic World Generator - a node based procedural and infinite game map tool

Discussion in 'Assets and Asset Store' started by Wright, Mar 10, 2016.

  1. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Some more RTP notes -

    Seems that one current problem with using MM and RTP together is the way MM layers its textures/splat map. The top texture layer in MM always appears on top of the one underneath, and the bottom layer in MM = the first RTP texture layer, while the top MM layer = the last RTP layer. If I could just re-order RTP's terrain textures this would not be a problem. If you start out and make, say, a sand layer on the bottom and a cliff layer on top, then later decide you want grass then sand then cliffs, you'd have to go into RTP and delete all your layer settings and reimport your textures and settings so they match up with the order of MM's layers.

    Another approach is to not let MM's splat layers overlap too much. I think for RTP though, worst case scenario here would be that if you did overlap (set two texture inputs full white to test), it would use its fancy height blending anyway, so you'd get sand in the cracks of cliffs etc. An easy way to use this is to use a few slope nodes, one from 10-20, another from 20-40, another from 40-90. 0-10 will be your background MM layer.

    So the workflow I have going now is - set up RTP on MM (copy components set to On and mesh renderer added but off, ty again @Sir-Spunky ), then run the game, wait for terrains to generate, then pause, select a piece of terrain that's visible, then on the RTP component for that terrain piece, adjust a whole bunch of settings, then when happy > copy component > stop editor > paste component values to the RTP component on MM.

    Keen to know any other hints and tips if anyone else is trying this.
     
    Sir-Spunky likes this.
  2. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    By the looks of it, they been all free.... Most tools don't charge for updates...
     
  3. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    @Wright, would I would be able to use World Streamer with this tool, and not use this tools ?? I know you do it differently...

    But I would like to be able to make my terrains, then be able to export them out as multi tile terrains and use in another program like World Streamer, is that possible?
     
  4. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I've just tried (using RTP) to use 4 biomes, each with a Texture Output that has 2 layers. On running the game, however, I'm going over the shaders 4 layer limit (I believe you're generally restricted to 4?). Are the biomes creating or doubling up on texture/splat layers?

    Obviously you usually do want different textures for different biomes, but on the other hand, if I'm wanting to optimize and reuse textures/layers, it would be good to somehow be able to. I don't know, maybe it's just the fact that RTP isn't supported yet that's causing this issue? Any terrain shaders probably get affected the same way though, it would be unfortunate if every biome meant you had to use more texture layers.

    I wonder if we could get a height output from each biome, and set up all textures in the top level node graph? If I could read in height from all the biomes that would allow some control over cliff/ground textures without 'wasting' texture layers. It'd still lack a bit, as we couldn't access portals or anything. Maybe that's also possible? Create a 'portal, out' output node on the biome node and we can choose from them? Or something similar.
     
  5. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,266
    ArturoSR, what is a "splat node"? Do you mean Output -> Textures Output?

    Jiraiyah
    ,
    That's a right approach, but what makes you think it's not used in MM?

    Do you mean that the terrains should be generated within some Generate Range, but they should not be visible (enabled) until they are pinned or player comes to them within some other distance, let's call it Enable Distance?

    Actually it's a subject for a whole new plugin, like this one: Terrain To Mesh.

    FrozenEmpire, all the future updates are free for MMWG owners. Maybe in a distant future I'll release something like MMWG2 that will have an upgrade price, but this will not happen in the next couple of years for sure - at least that had not happened with any of my assets yet. The next big updates I plan - RTP, Voxeland, splines support - will be released for free.

    recon0303, yes, you can generate a bunch of pinned terrains, and them stream them using the World Streamer. As far as I remember there is a user at forums who already uses this approach.

    Sir-Spunky, Exbleative, the next thing I'm going to do is a full-scale integration with RTP as I see a great demand for that. I think it will be released in a form of a plugin to both MMWG and RTP, it will include "RTP Output Generator" - the analog of the Textures Output, but it will read the assigned RTP component and use it's layers instead.

    It would be wery helpful if you could record a video of what exactly settings you adjust - I'll try to make them be adjusted automatically or any other way simplify this.
     
  6. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I'm new to this thread and so scouring through the posts to see if I can find answers to my questions myself; will update if I do. I've been waiting around for other assets to become able to do what I need for almost two years now and am still pulling my hair out on some problems... So here I am. Some things I need I can do myself but it'd be great if they are built in so I'd love to inquire about MapMagic:

    1. Is there a recentering function built in for when infinite terrains are generated beyond the general bounds of Untiy math (around 20km).

    2. Is it possible to use more than one system in the same scene. In otherwords, there is a generation system generating real-time terrains as the player moves with biomes, trees, etc. and a second completely separate system doing the same thing with different biomes, trees, etc.

    3. how does biome control work? noise based? can biome noises be layered the same as other nodes? (watched the biome video, looks great! I'm sure I'll learn my answers playing around with it firsthand)

    downloading the sample now to play with!
     
  7. Hellhound_01

    Hellhound_01

    Joined:
    Mar 5, 2016
    Posts:
    102
    At the weekend I've played a little bit with Aron Granberg's pathfinding project (free version). Using Grid-Graphs works fine with MapMagic if you follow the procedural example where you only follow the player.

    But I want to create an RTS game, with large procedural terrains (until they are locked) so I will have long distances to travel and a large area to view, also I will have many units to move. I think this is overhead for a grid based graph. I think I've read that Aron's Recast Graphs could be the solution, but this requires the full version. I will not by a pig in a poke ... 100 bucks is not a little for a hobby developer ...

    Has anyone experience with pathfinding in MM? Is Aron's project the right one?
     
    Last edited: Sep 12, 2016
  8. jjsonick

    jjsonick

    Joined:
    Sep 11, 2013
    Posts:
    18
    Really enjoying getting to know Map Magic. I have three questions:

    1. I don't see anything in the documentation (included pdf or online version) about how to create biomes. Is the beta video the only source of info on using them, and has anything changed since the video and release?

    2. Would it be possible to add an optional "Map Edge" feature? It would allow a field in which you set how far (in # of terrains) the map extends in all directions from the origin 0,0 terrain. Say you set this number to 3. Then, in runtime, when the player reaches a generation edge of say, 1,3, instead of 1,4 being placed next, the same terrain that would be generated at 1,-3 would be placed next. Likewise, instead of 1,-4 being generated and placed next to 1,-3, the terrain of 1,3 would be placed. And doing this for all directions from the origin. So that if the player travels far enough in any one direction, they'll end up back where they started - a wraparound effect.

    3. I can't get objects to obey the height settings in Split when using the Layered match mode - I have an example set up just like the screenshot of Bushes and Stones in the manual, with the top Split layer set at 0.2 to 1 height and the bottom layer set at 0 to 1 height -- but when set this way, the top layer objects don't get placed at all, only the bottom layer objects. The top layer objects will only appear if I set their height at 0 to 1.
     
  9. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    146
    @jjsonick
    I don't know the answer to your other questions, but at least 2. can be done, if you use a (tilable!) raw input height map as your base. The raw input node wrap mode should be set to tile and you would have to scale it accordingly. (I guess for your example, a scaling of 6) This way you can get an infinite wraparound world like you describe.

    @Wright
    And I also have a question of my own: Is there a way to use Voronoi nodes to get even larger scale detail than using cell count 1? It seems one cannot enter 0.5, 0.25, etc. as a cell count, but that's what i am looking for, a Voronoi noise that spreads over a couple of cells! Or is there maybe an equivalent way of doing that?

    Map Magic is great, by the way, I am really impressed by the overall system and the support with new updates is outstanding! Keep up the good work! :)
     
  10. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Thanks!
     
  11. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    last question has anyone used this with InfiniGrass, or Unature?? Yes I know that is in beta.

    Thanks for any info from anyone...
     
  12. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    With regards to InfiniGrass I've used the current system and it can be a little rough trying to get everything to work with the multiple terrains, but it does work. In the next version Nasos is implementing both convert Unity Grass to InifiGrass (so you can use MM to place everything and then get the batching and performance of InifiniGrass) along with procedural tools if you're going the infinite terrain route.
     
    recon0303 likes this.
  13. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    The demo is locked, but the full version scripts are fully editable?

    I have confirmed with the basic version, there is no recentering and multiple systems cannot be included into one scene. I can fix those if I can edit the code for my own needs, is the full version plugin locked from direct alteration? Can I sign an NDA to get the code after buying a license?

    I really like the terrain generation features in this tool, but I have special needs that won't work without some additions either from me or @Wright . Thoughts?
     
    Last edited: Sep 13, 2016
  14. cowtrix

    cowtrix

    Joined:
    Oct 23, 2012
    Posts:
    322
    Copy pasting here as this seems to be the more active thread, linking from here.

    What do you mean by this? How is a GeneratorsAsset ScriptableObject not enough information to be used as a biome - what information isn't there?

    This makes me very sad. MapMagic appears to be going down a much more restrictive path with its architecture than I originally thought it would, and I do not really understand why. Why can we not make shared assets for node trees? Why do they live inside the level? If I define somewhere in my project what a "desert" is, it seems under this architecture that I can only do this in a single scene, and if I then change what a desert is I must manually apply these changes to every level where a desert occurs. This makes MM pretty much unusable out of the box for games that don't take place in one big level.

    Also, could you please elaborate why you moved to this different serialization? What will break if I move it back to the old one? As it now seems I now must rewrite a lot of this code.
     
    Last edited: Sep 13, 2016
  15. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I'd like some way of doing this as well, plus some way to re-center the player in the world (I suppose the two are interlinked requirements). I'm particularly interested in the re-centering. @Wright If this isn't something you plan to implement shortly, could you perhaps outline how you would do this with MM? Or is it non-trivial?

    The settings I was adjusting were all RTP settings, which I was adjusting in the RTP component on an individual terrain piece during run time. The reason I had to copy/paste the settings was because (as with most/all? Unity scripts), the changes during run time don't stick. Even if they did, I'd still need to copy paste the settings from the single terrain segment back onto the RTP component on the base MM object, so they can be copied onto all the newly generated terrains at run-time. If this still doesn't make sense I'm happy to shoot a quick video. I actually think it works pretty much fine as-is, except for hitting that layer limit, and requiring an empty mesh renderer component. I'm sure your RTP output thing will fix that. Put me down on the beta testers list :)

    So it still doesn't work with infinitely generated terrains? Also what kind of performance increase do you see? I'm kinda hoping that his system might somehow ease the current, rather large performance hiccups I see during real-time detail mesh creation. Currently I try and run about 2x my target frame rate to compensate for the inevitable spikes.
     
  16. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,266
    MMWG has no built-in floating origin feature, but there are plenty solutions on the Internet, and there are free ones among them. You can take a look at this script. Shortly it moves camera and all of the objects to world origin when camera is out of some threshold distance (while most of the code deals with particles and collision to avoid related bugs). Map Magic object could be moved to any position at any time, no matter if the terrains are generating or not. I've even experimented with static camera, moving terrain instead in demo scene - and it is still works.

    I don't think re-centering feature is in the scope of the procedural generator, but it seems that there is a demand for that. Do you really think that it should be implemented to work out of the box?

    I don't get it quite clear - isn't it what the biomes feature do? It mixes separate graphs with their own trees, objects and textures in one.

    Biomes are using masks - you can assign any node or series of nodes here. It could be a noise, raw or texture input with a large scale or something more complex.

    Biome support is a very recent feature. I have not build a free version with it yet, so do not expect to find them here.

    Yes, the full version comes with the full source code. You can ensure in that by looking at the files list in MMWG Asset Store page.

    I plan to move the documentation to wiki and update it. Yet the video is the only example of using biomes, but it would be great if you could ask the questions about the most unclear parts to guide me writing docs.

    I cannot advise you anything rather than using a tiled raw input as a height map and using MMWG to color it and place grass, trees and objects. MapMagic does not support repeating terrain. It's not event that it does not support repeating terrain, but in a way to weld a seam between the repeating tiles.

    Why not? You can! You can do that by pressing "Save" button in a biome node, and this will create an asset data for your desert. This data could be assigned to any other biome, and if you make changes in it - all of the biomes nodes using it will be changed. Actually, once the data is saved it is stored in an .asset file, not the scene.

    The save button for non-biome (top level) graph is located in General Settings in inspector.

    It was not very reliable - if you look through this topic you can see that some users complain that their whole graphs accidentally disappear.

    Nothing will break if you will return to the old one - actually, it is still in here to load the old scenes format. You can try using this GeneratorAsset.cs serialize functions:
    Code (CSharp):
    1.             public void OnBeforeSerialize ()
    2.             {
    3.                 serializer.Clear();
    4.                 listNum = serializer.Store(list);
    5.                 serializer.ClearLinks();
    6.             }
    7.  
    8.             public void OnAfterDeserialize ()
    9.             {
    10.                 serializer.ClearLinks();
    11.                 list = (Generator[])serializer.Retrieve(listNum);
    12.                 serializer.ClearLinks(); //links should be cleared both before and after deserialization
    13.             }
    And that's what the MapMagicWindow.cs save/load functions should be:
    Code (CSharp):
    1.             private GeneratorsAsset SmartCopyGenerator (Generator gen)
    2.             {
    3.                 GeneratorsAsset copyGens = ScriptableObject.CreateInstance<GeneratorsAsset>();
    4.  
    5.                 //saving all gens if clicked to background
    6.                 if (gen == null)
    7.                 {
    8.                     copyGens.list = (Generator[])Serializer.DeepCopy(MapMagic.instance.gens.list);
    9.                 }
    10.  
    11.                 //saving group
    12.                 else if (gen is Group)
    13.                 {
    14.                     Group copyGroup = (Group)Serializer.DeepCopy(gen);
    15.                     copyGens.UnlinkGenerator(copyGroup, unlinkGroup: true);
    16.                     Generator[] copyAllGens= (Generator[])Serializer.DeepCopy(MapMagic.instance.gens.list);
    17.                     copyGens.list = new Generator[] { copyGroup };
    18.  
    19.                     for (int i=0; i<copyAllGens.Length; i++)
    20.                     {
    21.                         if (!copyGroup.guiRect.Contains(copyAllGens[i].guiRect)) continue;
    22.                        
    23.                         //un-linking copy gens
    24.                         foreach (Generator.Input input in copyAllGens[i].Inputs())
    25.                         {
    26.                             if (input.link == null) continue;
    27.                             if (!copyGroup.guiRect.Contains(input.linkGen.guiRect)) input.Unlink();
    28.                         }
    29.                        
    30.                         ArrayUtility.Add(ref copyGens.list, copyAllGens[i]);
    31.                     }
    32.                 }
    33.  
    34.                 //saving single generator
    35.                 else
    36.                 {
    37.                     Generator copyGen = (Generator)Serializer.DeepCopy(gen);
    38.                     copyGens.UnlinkGenerator(copyGen);
    39.                     copyGens.list = new Generator[] { copyGen };
    40.                 }
    41.  
    42.                 return copyGens;
    43.             }
    44.  
    45.             void SaveGenerator (Generator gen, Vector2 pos)
    46.             {
    47.                 string path= UnityEditor.EditorUtility.SaveFilePanel(
    48.                         "Save Node as Unity Asset",
    49.                         "Assets",
    50.                         "MapMagicNode.asset",
    51.                         "asset");
    52.                 if (path==null || path.Length==0) return;
    53.                 path = path.Replace(Application.dataPath, "Assets");
    54.  
    55.                 GeneratorsAsset saveGens = SmartCopyGenerator(gen);
    56.                 if (gen != null) for (int i=0; i<saveGens.list.Length; i++) saveGens.list[i].guiRect.position -= gen.guiRect.position;
    57.  
    58.                 AssetDatabase.CreateAsset(saveGens, path);
    59.                 AssetDatabase.SaveAssets();
    60.             }
    61.  
    62.             void LoadGenerator (Vector2 pos)
    63.             {
    64.                 string path= UnityEditor.EditorUtility.OpenFilePanel(
    65.                         "Load Node",
    66.                         "Assets",
    67.                         "asset");
    68.                 if (path==null || path.Length==0) return;
    69.                 path = path.Replace(Application.dataPath, "Assets");
    70.  
    71.                 GeneratorsAsset loadedGens = (GeneratorsAsset)AssetDatabase.LoadAssetAtPath(path, typeof(GeneratorsAsset));
    72.  
    73.                 for (int i=loadedGens.list.Length-1; i>=0; i--)
    74.                 {
    75.                     //cloning
    76.                     //loadedGens.list[i] = loadedGens.list[i].ReflectionCopy();
    77.                     Generator gen = loadedGens.list[i];
    78.  
    79.                     //offset
    80.                     gen.guiRect.position += pos;
    81.                    
    82.                     //ignoring already existing outputs
    83.                     if (gen is IOutput && MapMagic.instance.gens.GetGenerator(gen.GetType())!=null)
    84.                     {
    85.                         Debug.Log ("MapMagic: tried to load Output which already exists (" + gen + "). Skipping.");
    86.                         loadedGens.UnlinkGenerator(gen);
    87.                         ArrayUtility.RemoveAt(ref loadedGens.list, i);
    88.                     }
    89.  
    90.                 }
    91.  
    92.                 ArrayUtility.AddRange(ref MapMagic.instance.gens.list, loadedGens.list);
    93.                 MapMagic.instance.gens.ChangeGenerator(null);
    94.                 repaint=true; Repaint();
    95.             }
    These are the copy-paste fragments from an older version, I have not tested them so some other minor changes could be required to make them work.

    I'm afraid that a particularity this one - a required render component - cannot be fixed. This is an RTP requirement, and I should not change it's code to make a plugin. Maybe I've got to use a script that derives from renderer, but that's an ugly hack.

    And this one I actually don't understand. Shouldn't it be using 4 biomes with 2 layers result in 8 layers?
     
    malkere likes this.
  17. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    First, the reason i think it's not being used is the slow generation of terrain i saw in your videos, i may be wrong, but if you are using compute shaders, then i wonder what takes so long for some examples (specially more complex maps without foliage or object scattering, just terrain heights) to be produced at run times? I followed a video tutorial on 3d buzz and let me tell you this, a massive terrain would generate much faster compared to your terrains, although in those videos, the terrain calculation is all in code and there is no graph to tweak it but still, those videos are 4 years old now, yet their terrain generate much faster than what i saw in your videos. i wonder why? i can't tell the reason unless i had a chance to dissect your plugin and take a look into code, and that is something i won't do.
    and yes, i mean to generate the terrains in one single generator for a patch of let's say 10*10 grid but then make them not visible and disabled until the enable distance is reached. and about terrain to mesh, i know about it and i mentioned that you can take a look at it yourself, but, the point is to have another end of chain generator (like your height generator) that will convert all unity terrains and it's related stuff to mesh and then bundle them to asset bundles (one bundle per terrain) so that users can load bundles on run time and when for example a user tweaks something in graph, the final assets reproduce automatically, but this part is up to you and optional.
     
  18. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Thank you for the replies. I will pick this up in a bit here =]

    As for multiple systems what I mean is two map magic instance in the same scene. I'm sure I can get that working if I can look at the code. Used for different layers of terrain systems, for example floating isles, and other applications.

    For recentering moving the mapmagic gameobject around I think would still break it as the parent when it goes out of bounds, but if I could change the offset it should work fine. =D

    btw: I got fake biomes working with the sample anyway *_* I was portalling a global noise to create masks for blending. much more tedious than the new system though which I'll try to get into with the full version.
     
    Last edited: Sep 13, 2016
  19. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Is there an upgrade guide? I just downloaded v1.5 and my custom generators have all broken :(

    Some changes are obvious - for example, it seems the namespaces have been reorganised so that Chunk is defined within MapMagic rather than nested within MapMagic.MapMagic. However, it seems that the function signatures such as Generate() have also all changed but the manual at http://www.denispahunov.ru/MapMagic/Manual.html doesn't reflect this yet.
     
  20. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Ok, so actually it wasn't as bad as I first thought (the hundreds of error messages and blank Editor window did scare me though :) - the Generate() method signature now expects a second biome parameter. Although this has a null default parameter, to override the method in a custom method you've got to match the signature exactly. Would be good to update the docs!
     
  21. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Yep, 4 biomes, 2 textures per biome = 8, which is 4 over the max :) I think I can have another 'add pass' for 4 more layers, but then (I think, maybe, I'm unsure) we are effectively rendering terrain twice(?). Don't quote me on that, though! Sorry, I find it hard keeping all this stuff in my head! Regardless, I'm sure your RTP integration will work fine :)

    Also if we have to add a mesh renderer and turn it off, who cares, it's not hard :)

    I don't think it would be odd to include something like this, as you're generating infinite terrain, which leads to floating point issues :) It probably depends on how easy it is to use other solutions. It is almost another product, you'd probably be asking for a boatload of new "how come my particles didn't shift properly" support questions, etc :)

    I have seen a few things in the asset store(but they're designed for their own terrain systems), and now the one you've linked to, which I'll check out. I suppose I just thought that we would have to offset the root MM object some distance in the opposite direction (to keep all the terrain segments in order), eventually causing floating point precision errors for that object instead of the player? I might have the basic logic wrong, though!

    This feature is already in.
     
  22. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    If you just offset the root MM object to say -50,000. -50,000 then it itself will throw errors... I haven't actually tried it, but anything going beyond 20k seems to upset Unity, and rightly so. If we create a global variable that all the MM math checks before it goes into motion we should be able to add properly offset the noises and any other base inputs so that it feels like we're 50k away. Most stuff, in my game anyway, can do without knowing where it is in world space, it just checks for proximal collisions, etc. Player placed objects and stuff will need to know that offset variable though.
     
  23. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I got two Map Magics in one scene more or less working. I just disabled the duplicate check so it let me put it in. The node editor will accept one at a time if you disable the other one. The threading/real-time generation isn't working, but I'm not going to get into that today.
     
  24. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    yup, thanks alot for this info.
     
  25. Chris_Payne_QS

    Chris_Payne_QS

    Joined:
    Jul 16, 2016
    Posts:
    84
    Just started tinkering with MM - great tool, very powerful. However I'm getting a runtime-only crash (works fine in the editor) when generating a TextureInput map:

    System.NullReferenceException: Object reference not set to an instance of an object
    at MapMagic.TextureInput.Generate (MapMagic.Chunk chunk, MapMagic.Biome biome) [0x00087] in \Assets\MapMagic\Generators\MatrixGenerators.cs:679

    It's because the textureMatrix array is being dumped as soon as I hit Play - with the MM debug enabled, I can see the output from the TextureInput node go from a 9-digit number to null. It remains null after I stop the game - I have to reload the texture to fix it. The texture itself is still valid, otherwise it would return at line 670. If I add a null check for textureMatrix on line 670 as well as texture, it fails gracefully and I just get a flat terrain dotted with trees.

    Any idea what would cause this? It's a pretty big source texture (was 4096, but I've reduced it to 2048 and it still happens).
     
  26. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    How is it the water in the demo video looks so good? I bought the Aquas shader and put it in, but it flickers very badly against my terrain. ? Is there some project setting that changes that?
    wow.. I've fought with this a number of times, though randomly I scrolled back (zoom out) and the problem fixed... I don't yet understand why... scrolling up seems to destroy the far distance rendering and mess up the z buffer.... I better get some sleep...
     
  27. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,266
    Hm, that's a point. Actually I've tried to offset MapMagic object much further, up to -5 000 000 units. The Transform component displays a warning helpbox, but everything seems to work okay. But I admit that re-positioning scene can move MapMagic object unpredictably far. I think about some sort of the internal offset, to make it's transform stay within a sane range.

    I don't know what have you done with that, but it should not work at all. MMWG uses a singleton pattern, it was not designed to work that way.
    Btw it's already an infinite terrain, what is the reason to have two infinite terrains?
    Yeah, just checked it and I must admit that Texture Input matrix is not serialized properly. Thanks for the report.

    Pity I have overwritten the water material with the standard one that is included with demo. But I had no difficulties in setting up the water - I've used one-sided double-textured shader, dark water color and large foam values. Deferred lighting. Never experienced flickering. Oh, and I've used AQUAS-Lite, maybe that is the reason.
     
  28. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I use multiple layers of terrains, it's a must for my project.... unless i was running two scenes async or something... it's working all right fornow, im running them in static pinned mode, not real-tie generation.


    I do stuff at really long distance and this was a problem for me many times in the past. Scrolling the mousewheel down in scene view (zoom out) completely fixed it... I don't know what functions the mouse wheel is supposed to incorporate entirely, but it looks great now... I use shift+wasd to move around in scene, some setting gets changed with the mouse wheel though....? Im using lite too, and it's working fine now.
     
  29. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I'm getting an error:

    NullReferenceException: Object reference not set to an instance of an object
    MapMagic.Layout.DragDrop (Rect initialRect, Int32 id, System.Action`2 onDrag, System.Action`2 onPress, System.Action`2 onRelease) (at I:/Solace Crafting/Assets/MapMagic/Scripts/Layout.cs:965)
    MapMagic.MapMagicWindow.DrawWindow () (at I:/Solace Crafting/Assets/MapMagic/Editor/MapMagicWindow.cs:585)
    MapMagic.MapMagicWindow.OnGUI () (at I:/Solace Crafting/Assets/MapMagic/Editor/MapMagicWindow.cs:322)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    UnityEditor.EyeDropper:OnGUI()


    when i click on the eye dropper for grass. not that important though. It works if you open the color picker and then use the eye dropped in there.
    I'm running 5.3.5f1
     
  30. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Hi, i'm trying to develop a basic generator that all it does is scales and reorients the matrix, however, Im also pretty green when it comes to coding with matrixes. I noticed that in the matrix class, there are already things there for resizing and stuff, could i have some advice on this please?
     
  31. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    How can we go about controlling things based on height? For example I'm trying to block trees from going past a certain height. So I add(blend) a curve to my cliff texture input, and use grass (a lower layer) for the soil of my forest...

    is it because of the scatter maybe? The forest node isn't picking it up, but the scatter is putting it there isn't it... hmm...

     
  32. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    You can use a flattened curve node fed from the terrain height. Or inverted sand a shoreline node as a mask for that
     
    malkere likes this.
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,266
    Yeah, I could reproduce it and fix, thanks!

    Well, there are some resize functions that you can find useful:

    Code (CSharp):
    1. Matrix Resize (CoordRect newRect, Matrix result=null)
    Scales the matrix so that it will fit the newRect size. For example, to scale matrix (0,0,128,128) twice you can call Resize(new CoordRect(0,0,256,256)); The optional "result" parameter it the matrix that will be returned in case you already have a matrix of the needed size that should be rewritten to facilitate GC.

    Code (CSharp):
    1. Matrix Downscale (int factor, Matrix result=null)
    2. Matrix Upscale (int factor, Matrix result=null)
    Will scale the matrix up or down using some integer factor. This is just a wrapper for resize function that simplify it, avoiding dealing with rects.

    Code (CSharp):
    1. Matrix BlurredUpscale (int factor)
    Scale matrix up using integer factor, and then blurs it.

    Code (CSharp):
    1. GetInterpolated (float x, float z, WrapMode wrap=WrapMode.Once)
    Probably this one is the most useful one if you want to make matrix rotation. This returns matrix value that lays between some coordinates - for example, GetInterpolated (2.5f, 7.5f) will get interpolated result right in between x: 2 and 3 and z:7 and 8.
    Wrap mode defines the function behavior when trying to get value that is out of matrix rect. For example, when trying to get (200,100) of a matrix (0,0,128,128):
    • Once will return 0;
    • Clamp will return the matrix edge value - (128,100)
    • Tile - will repeat the matrix like the texture
    • PingPong - will mirror the matrix
     
  34. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    got trouble in 1.5 to put object on the floor
    i set relative height don't foud solution
     
  35. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Hi,
    There are many great looking screenshots and videos with results from MapMagic
    However one thing that I'm quite particular about is that way that terrain pops into view, or doesn't blend well with the horizon and sky
    See attached snip from one of the videos which highlights what I'm talking about
    Is there any preferred method/approach to avoid this kind of artefacts ?

    Artefacts.jpg
     
  36. HsinChien

    HsinChien

    Joined:
    Nov 19, 2012
    Posts:
    22
    I also have trouble of finding the Floor Generator...It seems to disappear from the menu
    upload_2016-9-17_21-56-37.png
     
  37. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    You now just check the relative height tickbox in the object output node.
     
  38. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    First I bought GAIA - I was not happy.
    Later I bought Terrain Composer 2 - much better but still without enthusiasm.
    And now I saw MapMagic and fall in love. I must once again raise money ...
     
    malkere likes this.
  39. Bengals007

    Bengals007

    Joined:
    Sep 11, 2016
    Posts:
    11
    Quick question here!

    I have read somewhere to MapMagic is compatible with World Streamer, but WS is listing the assets that are compatible with it and MapMagic is not there (https://www.assetstore.unity3d.com/en/#!/content/36486).

    Could you please let me know if indeed MM and WS are compatible?

    If so, do you have any tutorials about it?
     
  40. Bengals007

    Bengals007

    Joined:
    Sep 11, 2016
    Posts:
    11
    I have two more questions before buying. :)

    I am looking for an "infinite procedural world" solution. Basically let the user creating their own world in which they are going to build their city (which is why MM and WS together would be awesome).

    1)
    In your manual, it says the following about procedural creation:

    Procedural terrains - These are automatically created in Play mode when the camera gets within a customisable distance to them and are destroyed when camera is farther than that distance away. Procedural terrains appear only when the “Infinite land” feature is turned on. They are not visible outside of Playmode."

    Is there a way to keep this in memory and let the user build multiple cities in different location on the infinite map?

    Basically, I need to be able to save that gigantic map somewhere even though the player will only see a tiny part of it (2km x 2km).

    2)
    Can we use it runtime?
     
  41. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    You can customise the distance around the camera at which MapMagic will create terrains, so increasing this value will obviously reduce "pop" of entire terrain sections. Otherwise, you'd use the same techniques as you would to reduce popping of any meshes - reduce the camera far clip plane and use distance-based global fog, for example.
     
  42. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    403
    What are the chances for adding features to create rivers flowing down the land?
     
  43. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    I'm not familiar with World Streamer but, from the description, I'm not sure you'd need it if you were using MapMagic. The whole point of a procedural world generator like MapMagic is that there *isn't* a lot of data that can't fit in memory and needs to be streamed from disk instead - if you're using MM's infinite function, terrains are generated in runtime around the camera based on procedural rules, and disposed of again when they are no longer needed. The data required is tiny, so I can't imagine what you could possibly need to stream.
     
  44. Bengals007

    Bengals007

    Joined:
    Sep 11, 2016
    Posts:
    11
    I am looking to use MM to create all the terrains at the start of the game (pinned terrains and those in between).

    I can easily keep the pinned terrain from being modified with the lock feature, but how can I prevent the terrains generated in runtime of being disposed?
     
  45. reocwolf

    reocwolf

    Joined:
    Aug 1, 2013
    Posts:
    182
    How do I create rivers and how do I stamp stuff in specific places? MM is great for random procedural stuff but sometimes some precise positioning is needed.

    Are there any plans for a water bodies generator? Something that based on slopes erosion and height would create rivers and waterfalls from the mountains that lead to lakes or the coast.

    Also the beach generator should have 2 outputs for sand, one for dry sand at the beach and one wet just at the water level and below. That would also simplify making a mask for an underwater biome.

    Thanks.
     
    Last edited: Sep 18, 2016
  46. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    hmm... might take a little code. I assume you suggesting to generate a procedural world, ie: different every -first- time, say 10x10(100) or something, then have it stay and any changes made to it.
    There are some problems with that, the main one being that saving a complete terrain isn't the easiest thing to do. You have to cycle through the heightmap, the splatmap, the grassmap, the treemap, and all objects individually and save them one by one, which is certainly doable though. If you don't do that you will be recreating them when the game starts everytime. Or if you want infinite, you can setup a flag to note if you have terrain x-27,z5 already saved or not, usually only saving terrains that have had some sort of change made to them.

    What I'm planning on doing it to only save grass/object/tree changes, and not let the player mess with heightmap/splatmap. It's a sacrifice, but it lets met run the generator fully runtime and only apply objects changes that need to be made after regeneration.
    same boat here Sluta, I'm happy with it so far.

    @Wright one thing I have noticed is that RTP bugs when not all the terrains have the same textures. MM seems to be only adding textures in use, so sometimes sand is not attached, or in a different slot, etc. RTP wants them to all be the same globally though and ends up looking weird.
    I just added a constant 0.01 blended into my sand layer and now it is applying to all terrains equally.
     
    Last edited: Sep 18, 2016
  47. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I've got the four corners of four terrains all drawing their grass different colors. Anyone seen this?
     
  48. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I've added:
    terrain.gameObject.AddComponent<ReliefTerrain>();
    to line 308 in chunk.cs and am getting realtime generated terrains to properly accept RTP as they come in. (with a single terrain already pinned with settings) If there were no pinned terrains yet I'm sure you could import saved RTP settings the line after that and Refresh().

    It seems that while playing with RTP in the editor changing any of the MM settings will ruin RTP for some reason... I don't really get it, but deleting all the terrains, removing the _RTP_LODmanager, re-pinning the terrains you need and then re-adding the ReliefTerrain script to your terrains makes it all work again. In other words, you can't pin/unpin AFTER you add RTP. If you save your RTP settings you can reset everything without problems though. As long as the above code is added it will add RTP immediately to newly pinned terrains as well so.......... kinda fussy

     
    Last edited: Sep 18, 2016
  49. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Thanks for the hints.

    The issue I always found with using distance based fog to blend terrain or other meshes with the skybox was the fog colour was uniform against a skybox which had variable colour and perhaps clouds. This would work fine for a uniform skybox background, but when dynamic skyboxes are in use as well, to achieve a good blend is a bit trickier. To get a true blend between terrain/mesh and skybox always seemed to need more than fog alone, perhaps also some method of alpha blending the terrain/mesh with the skybox too to get a better blend... Was just interested what methods you guys use to achieve a good blend, or whether you just accept the inaccuracies at the far plane.
     
  50. Szaruga

    Szaruga

    Joined:
    Jan 29, 2016
    Posts:
    403
    I am impressed by the features that have MapMagic, but i have some newbie questions:

    1. What are the possibilities of creating intertwining different terrains, such as mountains, swamps, valleys, desert, etc ...
    2. Streaming capabilities and the creation of new areas on the fly - are impressive. However, i needs a constant area of particular places and objects. In view of this, MapMagic is a potential for me?
    3. And the river ... Will it be possible to create rivers flowing from the mountains to lakes and seas?

    I send greetings Slavic ;)