Search Unity

  1. New Unity Live Help updates. Check them out here!

    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. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,121
    I have had nothing but problem using Unity's grass out of the box. I use Vegetation Studio (non-pro) specifically for grass. If you deep profile it, the performance spike from turning on of new terrains with grass added to them is ridiculous, and it's caused by the grass, not the terrains, though that's not something everyone does. I also had problems where grass would not show up in builds back when I was trying to use it through Unity terrains, or show up whitewashed, or pink, etc. That was a long time ago though, I'm not sure if I ever solved it without going 3rd party.
     
    mmaclaurin and Wright like this.
  2. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    You can try to find out whether it's MapMagic or not by pinning a large area of the terrains in editor, and disabling (or removing) MM component. If you will get grass in editor, but not in build then it's definitely something's wrong with Unity.
     
    protopop likes this.
  3. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,478
    Just tried the beta package of Map Magic 2 and it's already very good. It's a lot faster and the previews are cool. Where is the best place to report bugs?

    Also, I guess an inverted Curve is a replacement for the Invert node that isn't in this version?
     
    mmaclaurin likes this.
  4. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,242
    That is a great idea - I will try that

    I also notice I get this error message
    Assertion failed on expression: 'triangleCount == totalTriangleCount'

    when the gras is too dense. Maybe its related to that, maybe unity combines grass Into meshes and there is some kind of vertex count limit to this?

    I also noticed if I include the missing grass type I another layer then it shows up in my other one. Maybe using Normalize with Layers obscures or somehow relies on other layers before it to determine what to show? I don't really understand exactly how Normalize mode with layered biomes decides what to show.
     
  5. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    Testing MM2 at the moment and I can't find a way to mask primitives, unless I'm missing something.
    My use case is pretty much what is done in the long MM1 tutorial - add a low res height map and further detail it with voronoi and noise, using masks to add it to certain areas only. The are now no inputs, mask or otherwise, on those nodes.
    I wondered if it was possible to have a Mask node, similar to the object Mask node but for Map data.
    At the moment that is functionality that is available in MM1 but not MM2, again, unless I'm missing something.
     
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    Thanks! You can find bug report description on the instructions page.

    Yes, you can use inverted curve, or Contrast node with contrast of -1. However, guess should add the Invert generator, just forgot about it since I'm not using it myself.

    Yes, unity grass combines several bushes in one mesh, so it might be the triangle limitation issue. The mesh size is determined with Detail Resolution per Patch in terrain. However, this parameter is not exposed in MM2 (marking it as a bug for myself).

    It's not clear what's happening with the grass and what actions do you take. Could you please describe the steps to reproduce (and if it's MM2 issue report it to IdeaInformer)?

    RAW Import and Texture Import nodes were replaced with the only Import node. You've got to create MM Imported Map Asset first (Asset Create - MapMagic - Imported Map), select it and load raw or texture, and then assign this asset to the Import node.

    I guess by masking you mean multiplying one map with the other. If so you can use the Blend node with Multiply algorithm.
     
  7. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    New MM2 Beta version is available. In addition to some bug fixes it has compatibility with MicroSplat, MegaSplat, CTS 2019 and Vegetation Studio Pro.
     
  8. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    Does anyone know if MM2 will support 2 MapMagic objects in a scene?
     
  9. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    Hi All, Has anyone had any success using the Microsplat Proceedural Texturing Module with Map Magic? I'm still working through it and it's a little frustrating.
    I assumed that because it's all done in Microsplat's shader that all I would have to do was use the MS material -- and it does reproduce on the generated terrains but the texturing doesn't appear. I'll work through this some more but just wondered if anyone else had tried.
    I know I can use the MM integration but this needs Custom Splat Maps enabled and the result is not as smooth.
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    Theoretically you can, but I have not tested this yet.

    Custom Shader Output node will work even if custom splat maps are not enabled. It will give you a warning, but still will apply the proper material.
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    He's actually talking about my procedural texturing stuff being used instead of Map Magics. (Mine works entirely in the pixel shader, so no splat maps at all). Right now the Custom Shader Output node doesn't set up all of MicroSplat's data, so the material doesn't have some textures which are generated in the MicroSplatTerrain.Sync() call. In MicroSplat's case, it might make more sense if the output node could copy the MicroSplatTerrain component onto the generated terrain and use the Sync function rather than just the material, as the material doesn't contain enough information to support all of MicroSplat's features. Doing so would enable procedural texturing, terrain blending, and other features which require the backing component to work.
     
    mmaclaurin, Wright and protopop like this.
  12. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,121
    For MicroSplat I do this after the terrain is generated callback from MM:
    Code (CSharp):
    1.             MicroSplatTerrain mst = gameObject.GetComponent<MicroSplatTerrain>();
    2.             if (mst == null) { mst = gameObject.AddComponent<MicroSplatTerrain>(); }
    3.             mst.templateMaterial = TerrainsData.microsplatLargeMaterial;
    4.             mst.propData = TerrainsData.microsplatLargePropData;
    5.             mst.keywordSO = TerrainsData.microsplatLargeKeywords;
    TerrainsData is my static reference holder for the necessary objects.
    MicroSplatTerrain is a script written by Jason (above) (author of MicroSplat) (maybe a year or two old by now) that you can find via google. I think it's even posted in this thread somewhere. Basically calls Sync() on Awake as Jason is suggesting should be done.
     
    Wright likes this.
  13. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    Just for your info, I tried two instances and found no problems, but I didn't test exhaustively.

    @jbooth, @malkere
    Thanks for the info, will give this a try.
     
    malkere likes this.
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    For procedural texturing you'd also need to copy the procedural texturing config.
     
    Wright likes this.
  15. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,242
    In my Xcode I get this message

    TerrainCollider: MeshCollider is not supported on terrain at the moment.
    MapMagic.MapMagic:Update()

    I think its just a non critical error because everything still works but I wanted to know if egress a way to get ri of it for cleanliness sake. I disabled the terrain collider on my initial pinned MapMagic terrain but then I just fall through it. So I guess just leave it as is? or does anyone know if there's some way to remove this?
     
  16. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    @Wright - Are the terrain loading callbacks in MM2 the same as MM1?
    Also I got Microsplat Procedural Texturing working with MM. It would be a use addition to MM1 and MM2 to have MM load the full Microsplat parameters to allow procedural texturing, per texture properties etc.
    Happy to discuss on Discord.
     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    Oddly enough since MapMagic doesn't use MeshColliders. I could not reproduce this on PC - the only warning I get is demo tree billboard shader message. Are there any steps to reproduce this issue?

    They will be completely different since the core has been changed.
    For all of the custom shaders I'm using the following approach for MM2: MapMagic assigns the same material to all of the terrains, but specifies the control map using terrain material property block. I have not looked into MS Proceedural Texturing Module, but if MS material doesn't require additional per-terrain data it might work out of the box. However I'm not sure that this module doesn't use cavity map or something.
     
  18. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    @Wright
    I use the following code, a mix of two sets of code I found in the forum to load the extra Microsplat properties required to run the per texture properties and the procedural texturing. This code sits on the MM object. For full compatibility MM would need to load these also through the Custom Shader node (I assume that's where you would do it):

    Can you tell me what the equivalent callbacks would be in MM2, I'd like to test them?

    using UnityEngine;
    public class MicrosplatEvents : MonoBehaviour
    {
    public Material MicrosplatMaterial;
    public MicroSplatPropData PropData;
    public MicroSplatKeywords Keywords;
    public MicroSplatProceduralTextureConfig ProceduralTextureConfig;
    public void Start()
    {
    MapMagic.MapMagic.OnGenerateFailed -= MapMagic_OnGenerateFailed;
    MapMagic.MapMagic.OnGenerateCompleted -= MapMagic_OnGenerateCompleted;
    MapMagic.MapMagic.OnGenerateFailed += MapMagic_OnGenerateFailed;
    MapMagic.MapMagic.OnGenerateCompleted += MapMagic_OnGenerateCompleted;
    }
    private void MapMagic_OnGenerateCompleted(Terrain terrain)
    {
    MicroSplatTerrain mst = terrain.GetComponent<MicroSplatTerrain>();
    if (mst == null)
    {
    mst = terrain.gameObject.AddComponent<MicroSplatTerrain>();
    }
    mst.templateMaterial = this.MicrosplatMaterial;
    mst.propData = this.PropData;
    mst.keywordSO = this.Keywords;
    mst.procTexCfg = this.ProceduralTextureConfig;
    }
    private void MapMagic_OnGenerateFailed(Terrain terrain)
    {
    Debug.Log("Generation failed for terrain: " + terrain.name);
    }
    public void OnDestroy()
    {
    MapMagic.MapMagic.OnGenerateFailed -= MapMagic_OnGenerateFailed;
    MapMagic.MapMagic.OnGenerateCompleted -= MapMagic_OnGenerateCompleted;
    }
    }
     
  19. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    134
    A bit more of an update on bit of an update on getting MS to work with MM2. There is an option to copy Components from the MM2 gameobject to both Draft and Main terrains. This seems to work fine.

    MS1.png

    And it keeps the references to the MS parameters. But...

    MS2.png

    in play mode the MS component is deactived? for some reason so the material on the generated terrain doesn't change. If I manually activate the MS component, everything is fine...

    MS3.png

    I wasn't sure if this is possibly something in the MM2 component or something being done by MS?

    Cheers.
     
  20. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    347
    Hello,
    I saw a post asking about this earlier, but no response.
    Is there a way to do a wrap around approach to building terrain?
    What I mean is have a limit to how far out terrains are built, then at the edge wrap around to the opposite side. For example, as a player continues to walk passed the edge they are transported to the other side seamlessly. I have several ideas on how to attempt this for example have the final terrain on one edge positioned around to the other edge on the opposite side while they're walking on it. Then I'd need to stitch the far edged so they are seamless.
    I don't want to try to reinvent the wheel so I figured I'd ask if this is already being done or for any advice on how to do it.

    Thanks in advance,
    Boysenberry
     
  21. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    19
    Hello there,

    I have been testing with the free demo and so far this asset seems really cool.
    I got a small question, if I generate a terrain at runtime with this asset, is it possible to save it afterwards in its current state and load it after relaunching?

    Best regards
     
  22. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,121
    MapMagic uses deterministic noise so, so long as your graph and the seed stays the same you will always get the same results. This lets you only have to save changes, like trees chopped, buildings placed, etc. Which you can of course save and load.
     
  23. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    211
    Seems like MM2 is just about ready for me to move over my game. Are we expecting more file format changes or is it okay to move production work here? It's just a weekend project so I'm okay with bugs but I'd rather not have to rebuild my terrain layers more than once or twice
     
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    You can use TerrainTile.OnTileApplied instead of MapMagic.OnGenerateCompleted. It's an Action<TerrainTile, TileData, StopToken> where you can get a terrain using terrainTile.ActiveTerrain property.

    Unfortunately there's no way to do this, at least out of the box.

    As malkere said MM will generate the same terrain in the next game session, so there is no need to serialize all the terrain data and all of the objects.

    I don't plan any file format changes, and if everything will go well the release version will load the graphs made in beta.
     
    boysenberry likes this.
  25. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,121
    You can certainly do that with a fair amount of code. By default MM would want things linear, but you can remove terrains from it's control or edit their data and reposition them and your world manually if there is a need to. For example when you get to an edge (say x5000) you could edit the current terrain (x5000) data to think it's x-11000, move everything -x11000, and then MM would try to generate x-10000 for you. You'd have to manage the heightmap on those parts pretty strictly and some things, but with a fair amount of work you could certainly do it.
     
    boysenberry likes this.
  26. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    347
    That's a good approach. I was thinking about pinning all of the edges then use something like Terrain Stitcher to stitch the open edges to each other then once a player was at a certain point in the edge terrain it would move the whole terrain to the opposite edge. I haven't even begun to attempt this part (it's next for me though).

    PS I checked out your Game Solace Crafting and loved the walk through you have for it. I will pick it up this Friday and give it a whirl. I love the level concept and your crafting system is tight. Great work!
     
    malkere likes this.
  27. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    134
    I´ve tried a perfromance test with the GPU instancer for MM last night. Worth every cent I´d say ! Might be intersting for some, so I´ll leave that here:

     
    LouskRad, protopop and Wright like this.
  28. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    103
    Hi !

    Just wanted to ask a few things to gauge whether map magic world would be fitting for my project.

    1) Would it be possible to create new maps while playing the game ? Like, can a player start a new game on a completely new map that is not statically saved beforehand but can be saved once they generate it ?

    2) Is it possible to mix biomes in that generation process ? Can you, for example have a river area, a snow area, or a volcano area and have those dynamically generated, again when the player opts to start a new game ?

    3) Is there a way to set rules for setting objects within the biomes ? Like rocks that can be picked up, or maybe scattered nails or any other objects ?

    Thanks !
     
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    secondsight_, gorgeous screens, as always!

    If you mean would new terrain tiles be generated in the playmode - then yes, and it's the main purpose of MapMagic. And yes, it supports biomes. Speaking of changeable/removable objects - there's no such feature out of the box, so you've got to do two things to implement this: make a custom script for picking stones on stone prefab, and a serialization script that tracks changed (picked) objects by their position, and removes these objects on tile being generated.
     
  30. bobAZ2019

    bobAZ2019

    Joined:
    Mar 28, 2019
    Posts:
    11
    hi,

    does Map Magic support Unity 2019.3.3f1 and URP?
     
    mmaclaurin likes this.
  31. FIllbiker

    FIllbiker

    Joined:
    Jun 9, 2010
    Posts:
    116
    Hi, I can't find out how to store splatmaps (custom-MicroSplat) to use it in other scene.
    I save chunks as terrains to be able to use it in other scenes and MapMagic gameObject as prefab. When I paste a prefab in next scene terrains / chunks are there ok but no texture splatmap in its MicroSplat material.
    So if I go back to original scene where splatmaps are assigned and click on each nothing happens...so I they are not physically stored so I can't use it in other scene. Is there some way to save them and physically assign them in prefab to work it properly in other scenes?
     
  32. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    211
    Using the latest public beta of MM2, the Microsplat node does not appear in the editor. I am on Mac targeting iOS using URP, and running on 2019.3.2f1 (about to test on 2019.3.3f1)

    Anything to check? Set backend to IL2CPP, .net = 4. maybe has something to do with native modules?
     
  33. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    211
    UPDATE: I got the microsplat node to show up by adding "MAPMAGIC" to player defines.....we'll see if it works...
     
  34. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    Could you try re-generating MapMagic in new scene (or unpinning and pinning terrains again)?
     
  35. FIllbiker

    FIllbiker

    Joined:
    Jun 9, 2010
    Posts:
    116
    Yes I could and it should solve it but I have manually tweaked some parts of terrain and regenerating it would clear my tweaks. :(
     
  36. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    98
    UVs of terrain not looking as I wish, after using terrain Import raw, Some parts look weird and stretched out.
     
  37. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    I guess the issue is caused by the fact that control maps are saved with the original scene, and thus could not be passed with the prefab. Probably they could be saved by the editor script, but since you are tuning those terrains manually anyways I guess it would be easier to use the standard Textures Output instead of the CSO, and then apply MicroSplat manually.

    If you could make a screen of that weird stretched out look (and the graph btw) it will help a lot.
     
  38. FIllbiker

    FIllbiker

    Joined:
    Jun 9, 2010
    Posts:
    116
    Do you have some simple video on how to do it step by step?
     
  39. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,242
    Inside a biome I can have noise hills and voronoi mountains.

    Can I use the noise to have hills in the green area and mountains in the white?

    I tried using blend but it just seems to mix them all up across both colors. Screen Shot 2020-03-05 at 6.45.22 PM.png Screen Shot 2020-03-05 at 6.45.14 PM.png Screen Shot 2020-03-05 at 6.45.00 PM.png
     
  40. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,478
    You need to use the Custom Shader output node of the mountain texture, and plug it into the Mask of your noise (try plugging into Voronoi).

    Put the Noise/Voronoi into a Blend (with Noise/hills as base layer), and plug the Blend into Height.

    I usually always have a final Blend node that plugs into Height.
     
    mmaclaurin and protopop like this.
  41. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    90
    First of all great that there is already a clean working beta!

    but now i'm a bit confused. there is always only one output node. for example, with erosion we used to have the sediment output. how do you get these nodes?
     
    protopop likes this.
  42. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    712
    I'm interested in MapMagic, but just discovered that MM2 seems to be on the way with something i'd be really keen on working with (Editor tool mode) and now i'm hesitant to consider MM1 just for it to become obsolete soon. Is there a rough estimate for the release of V2?
     
  43. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    What I mean is using MicroSplat the usual way, as if there was no MM. Don't know about the video for that except MS standard tutorial. Here Jason created the terrain with MapMagic and is showing how to apply MS to it.

    Sorry for using MM2, it was just at hand, however I've used only the nodes that have their analogues in MM1:
    Blend.png

    Well, in the big picture it's only the erosion node that changed. Many nodes, like Textures Output, Normalize, Split - still have multiple outputs. Erosion's Sediment output mainly confused users. It is nothing but a positive difference between source map and eroded one, so it could be replaced with Blend node with subtract overlay.

    Unfortunately the editor tool is the only feature that is going to be delayed. As you can see on a beta page there's a checkbox next to all major features, except only this one. It's still planned, but won't be included in the release version.
     
    protopop likes this.
  44. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,242
    Thank you:) I will try this out.

    BTW for erosion I like the sediment output. Its analogous to how its done in world machine and other terrain builders. Its a simple way to get a good mountain - just erode and then plugin the snow into the sediment output. To replace it in MM2 I guess you mean we would attach the source noise map into a blend base layer, then attach the erosion output to a new layer in the blend node? and then choose subtract and that would be equal to the old sediment value?
     
    mmaclaurin likes this.
  45. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    71
    Hey @Wright, I would also like to know what's your ETA for the final release - I would be OK with rough estimate - weeks, months, etc. Thanks!
     
  46. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,675
    Some news on the upcoming MapMagic 2: after long consideration I've decided to make the core MapMagic 2 asset free, so any Unity user could create spectacular terrain with it. The core version will include all of the map generators and could be used with no limitations.

    In addition to the free version, MapMagic will have three addons:
    - Object generators
    - Spline generators
    - Biomes and functions
    I plan to create some new addons over the time.

    Each of the addons will cost $45. All MapMagic 1 users will able to get these addons for the half price. And as a small gift if you bought MM1 since January 1, 2020 - you will get all of the addons absolutely for free.

    I plan to release MM2 core together with 3 addons on March 30, 2020. The splines addon will still be in beta at this date for at least a month, and will be sold with 50% discount.

    I'll think of returning the output - technically, it could be made, nodes still support multi-outputs and could return the old erosion algorithm - or at least update it and store for download separately.
     
    Ne0mega, malkere, boysenberry and 4 others like this.
  47. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,464
    Same model as Micro splat, I think it will work well to get a lot of new users on board.
    As a current map magic user I will play 67.50 for all modules correct?
     
  48. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,478
    What are the spline generators and functions?
     
  49. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    367
    I have few questions about this asset, before i buy it.
    Can you add physics material to automatically generated Terrains?
    Can you add NavMesh on the fly, is it via code or how easy is it done?
    Can i have the newly generated terrains somehow of around the same first terrain high land points and low land points, for example, first terrain, i have hight to say 300 and low points to say 0, i want newly generated terrains to have the same thing, because i have water plane and would like water to show in the newly generated terrains.

    thanks in advance
     
  50. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,478
    You just use NavMeshComponents to generate a navmesh when a new terrain is generated. It takes about a second or less to generate on a 1km terrain for me.

    The code would be something like this, triggered by a MapMagic event, assuming you have one NavMeshSurface component looking at children.
    Code (csharp):
    1. var surface = GameObject.FindObjectOfType<NavMeshSurface>();
    2. surface.BuildNavMesh();
    Newly generated terrains use the same rules as the first one, so the generated terrains would be similar.
     
    Wright likes this.
unityunity