Search Unity

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

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    Yes, I've seen those videos and they are very exciting. Are you the author? You didn't answer my question. If you know anything more, please tell us.
     
  2. Nihilus0

    Nihilus0

    Joined:
    Jan 25, 2017
    Posts:
    52
    I'm not author, and I'm one of the audiences. and That's all the information I got.
     
    Last edited: Jun 2, 2019
  3. Mysterius

    Mysterius

    Joined:
    Aug 24, 2015
    Posts:
    12
    Hello,

    Is there any way to have a dense forest with mapmagic? I'm using very low poly trees (no more than 8 tris per tree when in the distance!) but as soon as I have a few hundreds of them in view the CPU gets eaten up (i'm actually at 14ms of CPU time for like 200 or 300 trees).
    Is there something i'm missing ?
     
    Last edited: Jun 2, 2019
  4. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Gpu instancer works magic
    Here's a video of the map magic integration
     
    LouskRad and ftejada like this.
  5. Mysterius

    Mysterius

    Joined:
    Aug 24, 2015
    Posts:
    12
    I've seen GPU Instancer. It seems awesome but is also completely over my budget for now x).
     
  6. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    In the tree shader check to see if the "Enable GPU Instancing" option is enabled.
     
  7. Mysterius

    Mysterius

    Joined:
    Aug 24, 2015
    Posts:
    12
  8. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    192
    @Wright Any idea why this could be happening? It's all over the terrain. Using 2019.1.4, HDRP 5.16.1 and MM 1.10.4.
     

    Attached Files:

  9. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    I had similar issues with HDRP terrain (without using MM), I think it was contact shadows or micro shadows from memory.
     
  10. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    192
    We don't have either contact or micro shadows enabled, so it must be something else.
     
    Last edited: Jun 3, 2019
  11. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    I still wish I could feed information like this into Map Magic for realistic biome distribution
     
  12. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
  13. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
  14. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    I've actually done something like that. It's pretty easy.

    https://slipstreambrendan.com/2018/07/08/world-building/

    cubestream_worldgen_atmos_probes.png

    From a heightmap, start with the basics, and generate the two masks (temp and rainfall).

    Temp is easy. Areas near the poles are colder than the equator. So you use a gradient on the Y axis, with a sine wave looking function. High mountains are cold, so you take your heightmap, and adjust it with a curve so the high bits are now near 0, the medium bits are near 1, and you multiply that over temp. That's a real basic version.

    Rainfall, you can start with something simple like random noise for now.

    And that's your start, you have 2 variables needed for a Whitaker biome map.
    If you're a beginner, you should have these 5 biomes: Snow/Ice for EVERYTHING under a certain temp, Desert, for everything over a certain temp and low rainfall, Tropical Rainforest for high temp and high rainfall, and woodland, for medium temp and high rainfall, and Badlands for medium temp and low rainfall.

    That'll get you something that looks reasonable, and is easy to debug.

    From there you build on your temp/rainfall maps, and add in biomes as needed.

    Temp, for instance, is lower at the coasts. So you mask off the heightmap at sea level, blur it a bit and that's the influence of the sea as a heat sink near the coast. You can then subtract that mask from the temp (after multiplying it by 0.1 or your choice of effect multiplier).

    Same thing for rainfall; it's higher at the coast, so you can probably get away with that same mask, or you can adjust the blur amount or effect multiplier.


    From there the sky's the limit.


    Literally. Also, remember you can spawn objects that take temp/rain as variables in their transform - check out the nodes above. Their rotation and height is a function of rainfall and temp. So I can access those in realtime by sampling the nearest probes! Then plug that into Enviro for rain/snow/etc


    So much more you can do with the temp/rainfall maps. You can add as many biomes as you like; just assign them places in the 'UV'-like space those maps make up.
     
    jwvanderbeck, StarFluke and Wright like this.
  15. Oryor

    Oryor

    Joined:
    Sep 21, 2016
    Posts:
    8
  16. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I'm finding that the Adjust node is not working with the Trees node when using any prefabs except the ones included in NatureManufacture assets.

    Are there specific requirements for the prefabs before they can be used?

     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    First of all I'd like to draw attention to this post since it's a perfect instructions on how to create various biomes:
    Thanks... oh yeah, thank's Jesus for this post :)

    I'm thinking of making a Whittaker's diagram node for automatic biomes distribution, but still it's more of an idea rather than a plan.

    Note that the standard impostor (billboard) trees could not be rotated. There was an issue with the scale too - don't know if it's fixed by Unity - main tree model was not scaled, only it's billboard changed the size. So the adjust node provide all of the necessary data, it just could not be displayed.

    Are you using the terrain instancing? Is there any error in the console?

    Does this issue happen when using the same graph in non-hd project? If so could you please email me the graph?

    Unity might or might not switch your trees to billboards depending on the tree prefab itself. In first case the trees are rendered fast and, more important, they turn into impostors at the distance. As far as I remember your tree should have only one object and one material, but it's better to check manual for details.
     
  18. Oryor

    Oryor

    Joined:
    Sep 21, 2016
    Posts:
    8
    @Wright there are no errors, and by instancing do you what do you mean? i looked through the settings on the terrain/map magic generator and didnt find anything called instancing.
     
  19. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    You'll probably find it will only work properly for tree prefabs that are using LODs, like the NatureManufacture trees and SpeedTrees etc. It's a Unity terrain issue, but tree prefabs with LOD groups work fine.

    In the MapMagic Terrain Settings it's called 'Draw Instanced'.
     
    JohnnyFactor likes this.
  20. Oryor

    Oryor

    Joined:
    Sep 21, 2016
    Posts:
    8
    camta005 likes this.
  21. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    Yes, I'm seeing LODs are the key difference in the prefabs I'm trying. I've ended up using Object nodes for everything and they seem much better for my needs (I'm doing a top-down, zoomed-in view). Memory usage stays pretty much the same, 90% of the objects are outside frustum, and I'm not doing any biome blending.
     
    camta005 likes this.
  22. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    Speaking of Object nodes, is this a bug? When I toggle 'Regard Prefab Rotation', 'Regard Prefab Scale', or 'Instantiate Clones' it changes the toggle state on all Object nodes.
     
  23. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    75
    Hi Mr Wright.

    Not sure if this is feasible / doable. Is it possible to add @RunTime Navmesh generation to your future features to work with infinite none pinned terrains - major key feature of your asset. I think this would enhance your asset significantly for someone like me who is not a coder. I watched some videos which may be of help to you < 20m covers all 3 vids and it may give you some ideas. Probably a navmesh generator and an object generator which caters for auto adding navmesh related components to the objects etc. Of course I know you are already aware of this area, I note Apex Path has been deprecated and A* is expensive and requires additional integration. However Navmesh is used by most controllers Invector, GKC, Third Person Cover etc. which come with their own AI's and, further assets such as emerald AI as default - I have these. I prefer to try using MapMagic in my first game as I like the procedural generators and large word I can create.

    Please advise if this is something in your near plans?



    https://learn.unity.com/tutorial/5c515372edbc2a002069505f#5c7f8528edbc2a002053b491

    Regards

    Morpheus
     
    Last edited: Jun 6, 2019
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    The dynamic NavMesh might be really looking promising, but have you tried using it on the terrain - any detailed terrain, not necessarily the one made with MM? Last time I did it it took several seconds to update, which makes it nearly unusable in real time. However, things might have changed for the better, at least I hope so.

    Unfortunately these toggles are the properties of the global objects pool, not the Object Output. I will think of a way to indicate such global values with the icon or something to prevent the confusion.

    Any custom shader? If not - could you please email me your scene + graph?
     
  25. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I use async navmesh in runtime, but it's lacking in a number of features and hasn't been updated in a long time despite a number of long standing threads on the issues. Basically it's built for flat platforms. When you bring it into a terrain based world with dynamic height there is no way to connect the meshes, and you cannot constantly regenerate anything of moderate size enough to rule out the need for multiple tiles, unless you want to confine agent use to ~50m around the player. If there was that one thing: a way to connect multiple navmesh "tiles" nicely, it would be a great system for open-world infinite terrains, but without that it's a very incomplete package.
     
  26. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    75
    I have not tried it. Would it not be possible to initiate map+Navmesh generation in a thread(s) before you hit the area so delays are no impact to your character, so time is not an issue. And as you leave an area it's not unloaded until you #defined-distance away, I'm sure I read something similar for this already for current map generator settings. Obviously this takes more resources but it's the tradeoff for using Navmesh. Another performance option would be to save the Navmesh data as it's generated in RAM (apparently it's not that big), and as you leave/return to an area Navmesh does not need recalculating? + you can have 1-4 x pinned tiles with pre baked navmesh for initial character start on one of those tiles.
     
    Last edited: Jun 7, 2019
  27. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    75
    In the #3 video I linked it shows connecting 2 x areas using a link which you can size as required, (so you'd select the full width of the tile). I did just check asyn navmesh, but as you say if you can't link areas/tiles then it's a no go.
     
  28. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    You might be able to create thousands of off-mesh links every with some sort of procedural method, but they have to be flat, so it'd be really hard to get it to look nice with terrain. I use a method where the two navmesh "sections" overlap slightly, and if an agent gets to an edge I bump them onto the next section, turn them off and turn them on again so they reconnect to the new mesh. It's sloppy, and they tend to run diagonal towards the edge instead of straight towards it, but it kind of works.
     
  29. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    Dude, you're my hero.
     
  30. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    Please do because that would be even more awesome although if I cant insert my fantasy biomes into it then it wouldn't be as much use for my projects. At medium rainfall I put in a strip of mushroom forest, at the highest temperature I have volcano lakes, at absolute zero rainfall I have giant crystals etc.
     
  31. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    Fresh project on Unity 2019.3.0a3 gets pink terrain with MapMagic.Please fix it.
     
  32. Bloo_Void

    Bloo_Void

    Joined:
    Sep 29, 2014
    Posts:
    1
    Does MapMagic have CTS 2019 support yet? I get some weird issues like not being able to paint on my terrain. Everything else works fine, but I just can't paint manually on my terrain. (Ex. Paths, walkways, etc..)
     
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Have not tested it with the Unity alpha version, but with currently released Unity version it works fine. Please note that if you are using HDRP or LWRP you've got to assign the material with the proper shader in Terrain Settings (you can use the terrain created the usual way as the material reference).

    Note that CTS and CTS 2019 are two different assets. Maybe they have much in common, but it doesn't mean that MM automatically works with CTS 2019 when it supports the usual CTS.
     
  34. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    Encountering a fairly serious issue with mapmagic. When I start to walk to a new area that is being generated I start to receive hundreds of warnings about the JobTempAlloc leaking:

    https://i.gyazo.com/f2fb664907aa28cee5351c9fd780942f.png

    It leads to the game freezing completely within a minute and the editor/game requiring the task manager to kill it.

    I've been able to confirm it is MapMagic by disabling the MapMagic gameobject when I start to notice the warnings. Which promptly stops the issue.

    Using Unity 2019.1.4f1, latest MapMagic, Vegetation Studio Pro, Enviro.
     
  35. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    Hi . Im ussing unity 2019.1.5!
    when i use CTS Node i get all terain black...I cant find any way to fix it...so its work in 2019.1 or its not working?all terrain just turn black...I importedd dall last updates from MapMagic and CTS ...and not working..some times i get texture but wrong one...like its should be grass but its shows clifs...thee is no way to change anything even if i test like set show me grass in slope to see that textures work its just turn back all in black...
     
  36. bezo0

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    29
    Good afternoon. And as you can d to generate a paved road in MM,endless, with some interchanges, and so on?
    I found this asset: Spline Tools for MapMagic [Beta]. Has anyone used it?
     
  37. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    Black textures even when ussing 2018.3 ...Every Unity with new Layer system turn MapMagic + CTS black textures..
     
  38. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    I've been able to get real time navigation working with Map Magic using the "A*" pathfinding toolkit, which has specific examples for procedural terrains. It works great; the A* toolkit is a tour-de-force of pretty much every cutting edge pathfinding technique and you can use different
     
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I guess it might be related with VS Pro, Enviro or any other custom script using jobs. MapMagic doesn't use them, but it could create an object that starts a job. Obviously, if you disable the parent (MM) game object this will disable all of it's children, so there's no wonder the warning stops logging. You can ensure that it's not the MapMagic by simply running an empty scene or any of the demo scenes. Try disabling third party components and enable one by one to find out what exactly causes the issue.

    Unfortunately, it's not clear what are your CTS and MM setups to say anything specific, especially I wonder what the "CTS Node" is - it might be the legacy node that is outdated to the moment. If so try using the Custom Shader Output and follow these instructions.
     
  40. maniak_001

    maniak_001

    Joined:
    Jun 13, 2016
    Posts:
    31
    hi @mmaclaurin, which pathfinding asset are you using?
     
  41. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    I'm using microsplat not cts. And, standard 3D, not lw/hdrp.

    I've tracked the problem down. Apparently on Unity 2019.1 with the Jobs package installed, if you have a light with shadows enabled and place a lot of trees on a terrrain you will receive leaks. I've contacted Unity to see if they can assist in fixing this.

    Disabling shadows on the Enviro light and any other light in the scene eliminated the problem.

    This issue seems related:
    https://issuetracker.unity3d.com/is...ne-build-output-log-if-trees-are-in-the-scene

    A number of the commenters note it has reappeared in Unity 2019.
     
    Last edited: Jun 15, 2019
  42. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    I do have a problem specific to MapMagic that you might be able to help me out unrelated to the previous issue, though.

    I just upgraded to Unity 2019.1.6f1 from Unity 2019.1.4f1. The terrain and trees are all still there, but then I noticed that MapMagic was indicating it was unable to load the generator assets. Which of course means my mapmagic terrain graph is gone.

    I checked and sure enough it wasn't set. I looked for the Data.asset file that I had previously exported from MapMagic via the "To Asset" in the inspector of the Map Magic gameobject. However, the file was missing and had somehow deleted itself?

    Luckily, I had kept a backup copy so I restored that file from backup and asked MapMagic to set it as the GeneratorsAsset Data. However, it proceeded to cause an ArgumentException instead and failed to load. I will append the full stacktrace.

    If I load the IslandData instead, it loads.

    Any thoughts? I'm using Microsplat, Mapmagic, Vegetation Studio Pro.
    Not doing anything unusual, I verbatim followed the Mapmagic youtube video made by Denis for Microsplat integration and VS integration.

    Everything was working great up until merely upgrading the project to 2019.1.6f1.

    I have to admit this isn't instilling great confidence in me to continue using MM.

    Edit: Turns out I was trying to restore a Data.asset that was from a build where I had experimented with HDRP. I was able to find the correct file and restore that instead and the graph came back. It is still really disturbing the file decided to remove itself. Continued in the next post.

    Code (CSharp):
    1. [Exception] ArgumentException: Object of type 'UnityEngine.Object' cannot be converted to type 'UnityEngine.Texture2D'.
    2. RuntimeType.CheckValue()    <1f0c1ef1ad524c38bbc5536809c46b48>:0
    3.  
    4. MonoMethod.ConvertValues()    <1f0c1ef1ad524c38bbc5536809c46b48>:0
    5.  
    6. MonoMethod.Invoke()    <1f0c1ef1ad524c38bbc5536809c46b48>:0
    7.  
    8. MonoProperty.SetValue()    <1f0c1ef1ad524c38bbc5536809c46b48>:0
    9.  
    10. PropertyInfo.SetValue()    <1f0c1ef1ad524c38bbc5536809c46b48>:0
    11.  
    12. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:544
    13.  
    14. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    15.  
    16. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    17.  
    18. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    19.  
    20. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    21.  
    22. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    23.  
    24. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    25.  
    26. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    27.  
    28. CustomSerialization.ReadClass()    Assets/MapMagic/Main/CustomSerialization.cs:416
    29.  
    30. GeneratorsAsset.OnAfterDeserialize()    Assets/MapMagic/Main/GeneratorsAsset.cs:1154
    31.  
    32. Layout.ScriptableAssetField[T]()    Assets/MapMagic/Main/Layout.cs:1260
    33.  
    34. MapMagicEditor.OnInspectorGUI()    Assets/MapMagic/Editor/MapMagicEditor.cs:489
    35.  
    36. InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0()    C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:462
    37.  
    38. GUIUtility.ProcessEvent()
     
    Last edited: Jun 15, 2019
  43. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    Okay, apparently the problem isn't gone. Even with the Data.asset being loaded I'm receiving the an argument exception when pressing Generate Changed. And, during runtime when I walk to the next terrain node it does not generate.

    Edit: The microsplat material wasn't provided to the splat node. I've now supplied it and the exception is no longer occurring when regenerating. However, now the terrain is black.

    I saved the scene and everything magically appeared. But, then at runtime the ground completely disappeared. Now it is no longer visible in the editor as well.

    I decided to try closing Unity and opening it again but it did not correct the problem. There are no exceptions now but no results either.

    I decided to hit Unpin All in the mapmagic inspector and the terrain0,0 deleted itself. The scene is empty now (no trees, terrain, debris, plants, etc. I clicked Generate Changed and Force Generate All and nothing happens.

    I attempted to delete the mapmagic game object. Then add a fresh one. And, generate new terrain from the default graph. This worked. So, I then told it to load my Data.asset instead and regenerate the terrain. Only the trees and grass appear but the terrain itself is gone.

    It seems permanently broken now.

    Pretty depressing to see all that work literally flushed down the toilet.
     
    Last edited: Jun 15, 2019
    camta005 likes this.
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    So, is there anything I can do to help you with that, or this issue isn't related with MM?

    Let me clarify: you were upgrading to 2019.1.6f1 from Unity 2019.1.4f1, and the data asset file was gone? That's rather odd because MM has no functionality to remove files. Are you sure it wasn't removed by other means?

    As long as the graph opens all of your work haven't gone. It's just MicroSplat material or CSO node isn't working - maybe because of some issue, maybe not. I can try finding that out if you email me that graph along with material and textures (you can scale them down if you like to).
     
  45. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    Ok I make some screenshots : one is all complete black and other i can see textures but grass texture becomes black ...its by clicking tick box in MM Custom shader node "Optimize Empty Map" <---that makes some textures become visible and some black
     

    Attached Files:

    Wright likes this.
  46. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    75
    Thanks, have you got a link to asset store or other URL? I'm not sure if your talking about "A* Pathfinding Project Pro" or some other A* pathfinding asset.
     
  47. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    "A* Pathfinding Project Pro" is the one. You can use the free version to test and then the pro version will let you use multiple cores on mobile to accelerate pathfinding.
     
    MorpheusXI likes this.
  48. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    67
    The shadow issue is something wrong in 2019.1 and not MM specific. For example if I just put a lot of standard asset speedtrees on a terrain and turn on a light with a soft shadow the leaks will start occurring right away. So, nope no worries on that one. It is something Unity labs has to deal with.

    I'm not sure at what point the file went missing or why. It is possible it vanished long before I did the upgrade and somehow MM kept working.

    I just solved it! I set up a whole new microsplat material (material... not node... node is the same, I just swapped out the material) and everything is working now. I have no idea why the original is broken.
     
    Wright likes this.
  49. Lumos

    Lumos

    Joined:
    Feb 11, 2013
    Posts:
    49
    Greetings friends and fellow MapMagicians(?)! I am pleased to announce that my plugin for MapMagic (that was briefly mentioned here a while back) is now live. If you're interested, you can find details here. I'm also currently taking suggestions for more generators, so if you've got any ideas about what stuff could be useful, you might want to share them in the thread. :)
     
    mmaclaurin, camta005 and Wright like this.
  50. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Thanks for the sreenshots, I will take a look into this issue and check if the latest CTS is stil working with MM.

    Glad you could sort that out!

    Congratulations with the release!