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

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Hi All,

    I'm new to Unity and Map Magic (long time GIS programmer) and will probably be asking a lot of simple questions for the next few weeks :)

    First question is I have quite a detailed height map from SRTM data in 16bit raw. I was wondering if any masks (eg biomes) need to cover the exactly the same area and be the same pixel depth, or can I use a smaller (h x w) 8bit raw and offset it to the terrain tiles required?

    Love the dunes in the past few posts, I have a similar requirement for an ice field and am thinking of using flat voronoi. Any advice appreciated.





    Cheers

    Chris
     
  2. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Hey Chris and thanks,

    I guess the trick is to break up the visible patterns from the voronoi with soft erosion or blur.
    For the ice sheets you should end up with something like this... but I have no clue yet how to do that :)



    So because I was bored today I tried around a little bit with the flat voronoi you suggested. Didn´t worked out like I wanted to, but the nodegraph could help you anyways (see below). On the left side I mixed some voronoi in different sizes and moved them to different heights.

    So yeah... I quit in the middle and instead ended up doing this. Not exactly what you need, but I like it:





    ...of course, some more !
     
  3. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    38
    Exquisite, @secondsight_ -> super exciting work, thanks for sharing
     
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Consider MapMagic as one more generator for Voxeland - all you can do with the built-in generators could be done with MapMagic. You can change the generated terrain (however changes will not be kept if you force re-generate this area).

    And since vanilla MapMagic uses the standard Unity terrains you can lock them from generate and edit the way you want using the standard tools.

    secondsight_ is the real magician!
     
    JLO likes this.
  5. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Thanks all ! Was fun do test it. Still wrapping my lazy head around ice shelfs.

    I´ve been asked to upload the nodes. So I also packed the light informations, post effect profile and textures and uploaded it:

    Download

    Can someone put that (or just the nodes) on github,if wanted ?
    A short readme is also included. Since this was just a testscene, it works quite good low on ground but needs additional tweaking when viewed from top.

    Oh, and one question:
    Is there some way scale ALL noise at once ? Something like a global scale ? Or could that be a feature for the future: A scale node with one value (default 1) that you can connect noise nodes to ? Would help quite a bit with more complex scenes.
     
  6. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Thanks secondsight_ for the time you put in. Not quite what I'm after but cool none the less :) I'll play around on the weekend and if I come up with anything worthwhile, I'll post it here.
     
  7. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    44
    Is there a way to address something at a certain height level? For instance if I wanted the snow texture to appear only on the highest surfaces of my terrain can I do that? Or if I wanted to have underwater plants that only grow below sea level.
     
  8. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Of course ! Curves are your friend (until we get a propper height selector in 2.0 :) )

    1.) Snow on Top


    2.) Only ocean floor


    3.) Bonus: Beach area. Combined the two above and inverted them. Example: Only grow Palms at the beach.


    Cheers!
     
    camta005 and tapawafo like this.
  9. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    44
    @SecondSight: You rock! Thank you so much for your help - you just saved me tons of experimenting work.
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    You mean all of the noise nodes should use the same size? Don't know how why it could be useful, but you can do this with MM2 by using a function graph (kinda biome) with a single noise node - changing it's values will change all function nodes in all graphs.
    However I guess you mean scale that will multiply the output size all of the nodes output, not only noise. Don't know, that sounds feasible, I'll see what I can do.

    Oh, but this sounds complicated.

    I'll add this to community graphs page if you don't mind.
     
    RobsonFMaciel likes this.
  11. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    I would like to be able to scale mutliple noise sizes at once. They could then be connected to a single node with one mutliply factor in it.
    Example in this shot: 3 noises with different sizes. If I want to double the size all at once, I´d add a x2 factor in the node.


    The usage of this is to make it easier group noises for different terrain types and then scale them to each other. In the example above, all dunes could be grouped and scaled easily.

    But this is "just" a luxus feature I thought about a few times. The function graph for 2.0 sounds great, though !
     
  12. rayflex

    rayflex

    Joined:
    Nov 18, 2013
    Posts:
    6
    Thanks secondsight_ for the sand dunes download. Wow, from sand to ice! It is amazing to see what an artist can do with MM.
     
  13. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I think this should be made with the Function (and value expose) rather then a node. Such node doesn't fit in MM system well. But I'll think about the way to wire the exposed values with different ratio - maybe not in an 2.0 version, but in next releases.
     
    secondsight_ likes this.
  14. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Hi All,

    A question if I can. Perhaps I'm missing something. I'm moving ahead with the ice shelf project and am pretty happy with basic terrain. There will eventually be an ice shelf between the 2 land masses.



    My areas is 3x3 at 2km per terrain. Using the player setup from the demo scene.
    The distance between A and B is approx. 2km. When I stand at point A and look towards C, I can see B in my peripheral vision.



    But when I look towards B, everything is removed.



    I have generate infinite terrain on, and have set the generate range settings to anything from 2000 to 8000.
    Am I missing something or am I pushing the boundaries with the distances.

    Any help appreciated.

    Cheers

    Chris
     
  15. JLO

    JLO

    Joined:
    Nov 11, 2012
    Posts:
    46
    @Wright Just bought Map Magic! I'm looking forward to using it along side Voxeland. :D
     
  16. Thiole

    Thiole

    Joined:
    Jul 7, 2018
    Posts:
    4
    Sorry if I am brand new, and i saw your tutorial for how to Gradient blend biomes.

    I am trying to generate a large swath of land, and after i make varying degrees of biomes, how would I then generate the land with distributed gradients (so it doesnt change from desert to arctic)
     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Could this be related with the fact that the far plane is actually... a plane? It's just the way camera renders the world, not related with MM. Far plane corners are further than it's center, especially when the FOV is high. The camera view distance at the sides is higher than the distance at the center. Just like when you look into the monitor the distance from your eye to it's center is less then the distance to it's side.

    Just try increasing the camera view range.

    So you are trying to make several stripes with gradient? Try adjusting each stripe contrast with the Curve, and then blend them all with the Normalize:
    CurvesNormalize.gif
    Edit: oops, I'm using Noise in this setup. Pretend it's a Simple Form node instead of it.
     
  18. Thiole

    Thiole

    Joined:
    Jul 7, 2018
    Posts:
    4
    idk about gradients always, is there a way to random distribute biomes, but exclude certain ones from being next to each other?
     
  19. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Thanks for your reply. Increased the camera view range and it worked. Now making some progress on the ice field. :)

    Is it possible for MM to have the option to use 8bit raw files? I know that in my current project I don't need a height range over 256, so 16bit seems like overkill, especially if I can trade pixel depth for areal extent. Or is that a Unity limitation?

    Cheers

    Chris
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Only in some particular cases - like making "stripped" biomes setup with gradients. Otherwise the algorithm is too complicated and could lead to four color problem. The best way to make it is using manually painted raw map (or maps).

    You can use a simple texture instead with a Texture input. Textures use 8bpc that seems to be exactly what you need.
     
  21. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    In the absolute pcg sense, not sure about map magic (I haven't tried it with it). You would do an equivalent "Whitaker diagram" (basically it decide which biomes are next to each other following noise input), ie you use two gradient noise and use them as coordinate, to sample a diagram custom made for your design, but instead of directly selecting biomes, you select a group of possible biomes to select in a bucket. By strategically placing biomes bucket in the custom diagram, you make sure some biomes are never next to each other. For example biomes at the extremity of the diagram would never be placed next to each other if they are biomes between them in the diagram, unless you have very sharp noise.
     
  22. Thiole

    Thiole

    Joined:
    Jul 7, 2018
    Posts:
    4

    yeah, IK about whittiker diagram, If i could Id create 2 additive noise diagrams, one for precip, one for temp, and just select on the table that way. But i have no idea how to do that in mapmagic

    edit 1:maybe instead of using biomes, do 1 controls textures from sand to dirt to snow, one controls amount of grass or "tundra" dirt, and precip noise map controls grass /trees + snow of cold?

    edit2: then the hills would be uniform, unless I made every biome rule based on temperature with their textures
     
    Last edited: Jul 12, 2018
  23. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    Thanks @Artaani That did the trick for me too.

    @Wright This is still a problem, even with the updated CustomShaderOutput.cs on dropbox

    Had to create a material from the CTS shader and add to the node as the Material Template. Only then would the 'Fix' button not throw an error.

    For anyone also doing this, don't panic if your textures disappear after applying that fix. I clicked on Update Now (on the Custom Shader node) and all came back as expected.
     
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I've submitted the new version that should fix the CTS mode "Fix" button. And will bring some fixes for Unity 2018.2 too. Expect it in Asset Store in a couple of days.
     
    Artaani and camta005 like this.
  25. Thiole

    Thiole

    Joined:
    Jul 7, 2018
    Posts:
    4
    is there a way for you to make it so itll do a voronoi distribution of biomes? so it doesnt do the 4 color problem?
     
  26. Pequisto

    Pequisto

    Joined:
    Apr 21, 2015
    Posts:
    66
    How exactly did you accomplish this? I'm messing around with an evaluation version of MM and have yet to figure this out. I didn't see Denis do this anywhere in his tutorial.
     
  27. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Mask the stones scatter with the height adjusted by curve, like this:
    TutorialMaskStones.jpg
    This curve inverts the height map and makes it more contrast. It's preview is shown in the scene view. The red areas of the scatter's probability mask show that no stones will be spawned here.

    Sure, here is the voronoi biomes distribution:
    BiomesByVoronoi.png
    EDIT: You might want to add some blur with 4 blur nodes before linking normalize to biome nodes to make biome blends a bit softer.
     
    camta005 likes this.
  28. Pequisto

    Pequisto

    Joined:
    Apr 21, 2015
    Posts:
    66
    EDIT: My bad, accidentally turned off a generator. Thanks!
     
  29. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    New user, absolutely loving this asset.

    A few ideas/wishes
    • would it be possible to add a 'notes' node - just to annotate parts of the graph as I'm finding it can be difficult to remember what I was trying to do when coming back to improve parts of a complex graph. Maybe showing the title as a label then click on it to open full notes?
    • on a similar tip, could nodes be tinted? I realise types of inputs/outputs are colour coded but it would be great to be able to tint groups of nodes that function together - visually organise things better.
    • also could multiple nodes be selected at together - to move in one go (and as per above tint in one go) Ideally this would be by dragging a selection box with Cntrl Click to add to selection and something like ShiftCntrl Click to remove from selection.
    • in the Vegetation Studio node, could clicking on asset open that asset in the Project window?
    • ditto with the Custom Shader node's layers. Click on texture would open it in the project window.

    A few questions
    • is it possible to switch from Map output to Object output and vice versa? Possible usecase: having defined a patch of grass, I'd like to take that map output invert it and then use that area to scatter a few objects over.
    • I've posted a few Vegetation Studio integration bugs on the GitLab site and I see that it is generally recognised as being a bit flaky. Is there an ETA on an update?
    • and can I ask whether the complexity of a graph has an impact on runtime performance? MapMagic seems to be incredibly efficient at loading and unloading terrain tiles, and it appears that the hardwork of generating everything is done on scene load. Can you confirm?
    Thanks!
     
  30. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    I´m currently doing a basic setup for a spooky / magical / autum forest.
    I want to generate as much as possible without the use of bitmap masks. But I need two generate two different shapes that will mark special zones on one map. I´ve tried the whole day to achive this somehow but no real luck. Maybe you guys have some ideas how to tackle this ?

    1. These areas will mark "healthy" zones in the forest with different vegetation. A minumum of one but maximum of three areas of this kind shall be present on one map.


    2. This shape will mark the borders of the level, that is blocked by crystals or such. The shape should vary but still be closed. Of course this could easily be done with a mask and maybe nobody will notice, but maybe it´s possible ?



    Other then that... it´s coming along quite well I think:





    I hope someone has a tip ? :)
     
    Last edited: Jul 18, 2018
  31. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    38
    @secondsight_, I am not sure why you are reluctant to use bitmap masks, but if you concern is that they are static, then these kind of shapes can be acheived with procedural techniques. For example, you could use an algorithm that picks 2-4 points on the map, but makes sure that they are no closer than x from one another. Then, you draw a series of random sized circles at a random distance from each chosen point to make the blobs. This drawing occurs in a texture that you can then feed into your generator. If you are not a developer, I can show some code for it, but not right now, .....because I am lazy and lying in bed!:D

    Also, those scenes look amazing, as is to be expected from the mighty secondsight_.

    I'll try to work some examples up tomorrow.
     
    Dwight_Everhart likes this.
  32. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    38
    There is probably a way to get pretty close with existing MM nodes, too.
     
  33. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Thanks ajaxlex !
    I pretty much approached with the same logic as you´ve described it, but with nodes (somehow). Yes, I´m no coder and so any help would be appreciated ! Will be bussy with other stuff the next week, though so no need to hurry :)

    What would be a niifty feature to have: a random mask selector !
    So, you feed MM an array of mask textures(or raw heightmaps) and then it randomly chooses one on generation based on some probability factors. Would that be possible to have ?
     
  34. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    83
    Hi there,

    What terrain shader are you using, how is that i see no tiling?
     
  35. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    These are just the basic unity shaders, specular setup (I think even legacy). I have used only two textures on three layers. Of course you want to have seamless sand textures first. But I guess the whole trick is that I mixed two of the same textures with different scaling and normal map intensities. This way they mix up quite nice. The rest is a simple light setup that unifies the whole scene with some primary colors.
     
    zoltanBorbas and AthrunVLokiz like this.
  36. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    It could be done with the groups. You can add a note to the group as well as actually group nodes to move them simultaneously. Color groups will be available too in MM2.

    Actually, clicking on the asset (both VS package or texture) once will select it in the Project window. Isn't it working for you?

    These node setups will give something more or less similar to the maps you've posted:
    HealthySpots.png

    HealthySpotsOutline.png

    They differ mainly in a last curve node form, so all of the other nodes could be re-used by linking these different curve to blend.
     
    ajaxlex likes this.
  37. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Yeah... I always forget about the blob node !!
    Fantastic...will work that in. Thanks Wright ! There goes my weekend...
     
  38. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    Thanks @Wright
    I'll look into Groups for organising things.
    and looks like Blob does the Object to Map conversion I was looking for :)

    Re. node click to assets in Project. No not working for me (unless I'm doing something wrong?)
    - I see the thumbnail and 'select' for Textures node, but not Custom Shader and Vegetation Studio:
    https://drive.google.com/open?id=1pKOla_KLoeXqVsBAAe29oVMxjLgw6RDy (5MB)
     
  39. kain_vinosec

    kain_vinosec

    Joined:
    Jan 25, 2016
    Posts:
    9
    So, newbie question. Just bought this, opened it up by itself in 5.6.6f2 and immediately get:
    Assets/MapMagic/Generators/VegetationStudioOutput.cs(121,10): error CS0246: The type or namespace name `VegetationSystem' could not be found. Are you missing an assembly reference?
    Can someone help?
     
  40. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    @kain_vinosec Do you own Vegetation Studio? The obvious answer is, if you do, import it.

    Not sure what's best to do if you don't own VS. Maybe try moving VegetationStudioOutput.cs out of your Project folder and see if the console grumbles about that. (i.e. throws up any additional errors)?

    Or go into the script and comment out most of what's there.
     
  41. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    @Wright Any advice on whether the complexity of a graph has an impact on runtime performance? Am I right in thinking that the impact happens only once (on scene load) but not as each terrain tile is loaded?

    Also any ETA on a Vegetation Studio integration update?
     
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I meant the package asset. All of the CTS and VS icons and names are part of the CTS and VS scripts. MM has no data about the sources, so the only way to select, add or change them is through CTS or VS only.

    My bad, it's an issue - already fixed but yet not reviewed by Unity. As a quick fix just remove VegetationStudioOutput.cs file.

    Each node linked to one of the outputs increases the generate time of each terrain tile - from dozen of milliseconds up to seconds in case of erosion in editor (note that generate in build usually 2-3 times faster). If the node or node chain is not connected to the output node they are not generated thus does not affect generate time.
    However node complexity is hardly related with a scene load time.

    If you are talking about "The type or namespace name `VegetationSystem' could not be found." in 1.9.2 - it's already fixed and will be available on AS soon. If not - could you please remind me the issue ticket number?
     
  43. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    Thanks @Wright
    - so just so I'm clear... each time a terrain tile is loaded (the player comes close enough) then the calculations take place. It's not all done on the initial scene load?
    So the complexity of the node graph has an impact on how smooth things feel as you explore the environment?
    - is there the possibility of caching this 'generate time' or, better still, caching the state of the terrain and spawned prefabs. I think it's something that MadMaps does, in the way that it creates stamps - all that data (height/splat and prefab placement) are saved as an asset.
    Could this be in any way possible? Would it not greatly hepl performance or am I misunderstanding the way things work?

    Re. Vegetation Studio integration issue. I'm thinking about ticket #243 which I posted a few days ago and #208 which lists a few issues I have too but didn't want to replicate by posting again.

    Would you like me to create a ticket for the 'click on asset doesn't open in Project issue I wrote about above?
    https://forum.unity.com/threads/map...ite-game-map-tool.390920/page-64#post-3569161
     
  44. shedworksdigital

    shedworksdigital

    Joined:
    Nov 7, 2016
    Posts:
    40
    Just chiming in to say that the first point in ticket 208 is a super important one that severely limits the usefulness of the VS integration.
     
  45. RobsonFMaciel

    RobsonFMaciel

    Joined:
    Jan 12, 2013
    Posts:
    187
    Can someone help me?
    I'm using 2018.2.0f2 and I do not have Vegetation Studio. I have "ONLY" Map Magic in my project and I have this problem:

    In all are almost 20 equal to this:
    Assets/MapMagic/Generators/VegetationStudioOutput.cs(148,117): error CS0246: The type or namespace name 'PersistentVegetationStoragePackage' could not be found (are you missing a using directive or an assembly reference?)

    Version before version 1.9.2 of MM did not give this problem :(
     
  46. RobsonFMaciel

    RobsonFMaciel

    Joined:
    Jan 12, 2013
    Posts:
    187
    I fixed the errors. I just added the #if VEGETATION_STUDIO clauses in all the missing places. It worked :D
     
  47. kain_vinosec

    kain_vinosec

    Joined:
    Jan 25, 2016
    Posts:
    9
    I tried deleting that file but it just pops up with a ton of new errors immediately after.
     
  48. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    This is true. I put #if VEGETATION_STUDIO on line 120 and #endif on line 156 and it's fine now.
     
    RobsonFMaciel likes this.
  49. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Here is the fixed file. I've submitted it yesterday but guess it will not be available in AS until Monday.
     
    RobsonFMaciel likes this.
  50. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Hi All, I've been playing around with Map Magic trying to create a large world (60k x 60k) based on real world SRTM data. The raw file is large (16000px) and the problem is I can create the tiled terrain but Unity crashes trying to save the raw file (even at 8000px). I have cut the raw file up into 4k chunks and am using an offset with the blend node to recombine them.



    And the result is this, I can generate my 2km tiles AND it saves.



    My question, is this a legitimate use of the blend node? Is there a better way to do this? Are there any advantages or disadvantages when it comes to further textures or biomes etc? The final plan is to use something like World Streamer or SECTR to bring the tiles in at runtime.

    Any thoughts or advice welcome.

    Cheers

    Chris
     
    camta005 likes this.