Search Unity

MapMagic 2 - infinite procedural land generator

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

  1. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Yes, it's applied during generation, as the final stage of it. Do you have it each and every frame after all tiles are generated (and camera not moving to start new)?

    Do you mean a sharp ridge? Yes, voronoi in different apply types might be a solution, especially when modified by curve.

    I guess Objects output node -> Rotation -> take Terrain Normal is what you are looking for.

    Yes, it would be great if you could find a way to reproduce it! It will help a lot, and I will appreciate if you could narrow it to reproducible issue.

    The thing is that these are the additional margins. They are combined with the standard margins, the one that is set in MM Objects -> Tile Settings.

    When using the Add.Margins value 0 all of the scattered objects actually are on the generated map. The generated map is bigger than the one that is applied to terrain tile, and bigger then the one displayed in preview. Additional margins is supposed to be equal to flatten radius - this way all of the objects will make a proper stamp on a map.

    When using value 0 it's generating the same way it was implemented before:
    The old version:
    Code (CSharp):
    1.         public override void Generate (TileData data, StopToken stop)
    2.         {
    3.             if (!enabled) return;
    4.             if (density==0) { data.StoreProduct(this, new TransitionsList()); return; }
    5.  
    6.             Noise random = new Noise(data.random, seed);
    7.             TransitionsList trns = Scatter((Vector3)data.area.full.worldPos, (Vector3)data.area.full.worldSize, random);
    8.  
    9.             data.StoreProduct(this, trns);
    10.         }
    The new one:
    Code (CSharp):
    1.         public override void Generate (TileData data, StopToken stop)
    2.         {
    3.             if (!enabled) return;
    4.             if (density==0) { data.StoreProduct(this, new TransitionsList()); return; }
    5.  
    6.             Noise random = new Noise(data.random, seed);
    7.             TransitionsList trns = Scatter(
    8.                 (Vector3)data.area.full.worldPos - new Vector3(additionalMargins, 0, additionalMargins),
    9.                 (Vector3)data.area.full.worldSize + new Vector3(additionalMargins*2, 0, additionalMargins*2),
    10.                 random);
    11.  
    12.             data.StoreProduct(this, trns);
    13.         }
    Note that the standard margins are measured in map pixels, while additional margins are in world units. Not sure why you want to clamp objects with tile size, not generated map, but here is a formula to find out the standard margins value in world units:
    `(tileSize / tileResolution) * standardMargins`

    Hmm, it was i/4, and I've made it i as you suggested. So now this line 84 looks like
    Code (CSharp):
    1. maskGroupNums[i] = output.maskGroup; //TODO: removed /4, test this! (http://mm2.idea.informer.com/proj/?ia=134562)
    Maybe I've really missed the tests :) I will appreciate if you could clarify what exactly it should be: i or i/4?

    Oh, my bad, thanks for notifying me about it!

    And thanks for your feedback and bug reports, they really help a lot!
     
  2. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    192
    Thanks for the reply!
    1) Yeah, I get that those margins are supposed to work together with the main map margins. But let's say I have flatten radius 200, and then I'd expect to set Add margins to -200 to prevent tile seams. But that's not the case. I have to input some high number, like -500 or -600 to prevent the seams.

    2) If you look at the bottom of the ideainformer issue message, it shows the fix:
    maskGroupNums[output.maskGroup] = output.maskGroup;

    Because you use the same indexing for the Color[][] array. :)

    3) Thanks!
     
  3. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    How do i see this? The profiler has it in every frame i think.

    What do you mean by different apply types?
    Thanks for answering all the questions! This asset should be unity's default.
     
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    The problem with Flatten node is that you need to know the object height to perform a flatten. And to know height you need to have the object on the map. Objects placed in additional space out of the map get the height of the closest map pixel, which most probably won't correspond to the height of this object in neighbor tile.

    Add.Margins feature suits more for Stamp or Stroke. However here I've commended out Flatten's boundary check, so you can try how it works. It will create a flatten stamp, however it will be on different heights on different tiles.

    Can't remember why on earth I've used `i` here - I'm afraid it's not for nothing, will check twice tomorrow :)
    Thanks for letting me know, and much obliged for the code suggestion!

    Try selecting the other random frame in the profiler (or several frames) a dozen of seconds after all of the tiles are generated. If it will take more than 1 ms in each frame - then it's definitely something wrong.

    Blend Type parameter in Voronoi node:


    Any time, and glad to hear that! However I'm not sure that even terrain should be Unity default - lots of projects, especially 2D don't use it at all. But this way we can slip into the statement that Unity don't need 3D :)
     
    Liminal-Ridges likes this.
  5. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    192
    Thanks for the reply!
    Yeah, that modified version doesn't really help much. So what is the intended workflow here? Should I just bruteforce the add margins (like -800 seems to prevent the seams with 200 flatten) until I get results I like? That just doesn't feel right.

    Glad to help. :) I can assure you my fix works 100% of the time, we've used that fix for months. The "i" indexing is wrong, once you use more than 1 texture map, it generates ArgumentOutOfRange, because your Color[][] array is also indexed by the mask group number.
     
  6. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    Awesome, thank you! that helps with alot of stuff, just kept overlooking it
     
  7. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    It was created by the post process stack @Wright all good

    EDIT: i noticed a clearing problem that i think existed in MM1 too. There are leftover trees from removed nodes or maybe leftover settings. I changed the adjust size but some trees are still small. I spawn them with the object node cause i want to interact with them. 'Use scale' is checked.
     
    Last edited: Mar 4, 2021
  8. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    I’ve only been playing with MM2 for a few hours today, but I noticed the grass output doesn’t work in HDRP. is this likely to be fixed sometime, or should I look into purchasing VS Pro for vegetation?

    I’m looking to purchase while the sale is on.

    Thanks.
     
  9. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    146
    @OldManJim76 yeah, grass is not working in default HDRP terrains, therefore also not via MM2. VS Pro is one of the possible solutions, they just fixed that in the last Update..
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Yes, grass is not working in HDRP at all.
    Here is the thread that I use to watch if the situation is updated.

    BTW just tried scattering 1 million of small trees as a workaround. FPS is okay - while you not moving. But it takes too long to apply them, and Unity lags for several seconds each time you move about 10 meters (must be cache or something).
     
  11. bdae

    bdae

    Joined:
    Dec 24, 2017
    Posts:
    23
    Is it possible to modify the terrain with the terrain brush tools and then regenerate the textures and everything over it? If so, how?
     
  12. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Hi Denis,

    Something has gone wrong with the Lock feature: This is the result I get from the FREE download of MapMagic 2 - I was gonna buy the bundle because this Lock feature is awesome, but I have tried it many different times and it does not seem to work sadly! :(

    Im using Unity 2019.4.17f1 with URP 7.5.3 incase that helps track down this naughty little bug!

    upload_2021-3-4_21-50-15.png
     
    Last edited: Mar 4, 2021
  13. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    @ElevenGame & @Wright thank you for the replies. It's very disappointing to see that grass in Unity 2019.x HDRP doesn't look like it'll ever happen.

    I'm downloading the latest 2021 Beta to have a play, but I can't update my project as it'll break just about everything else.

    Update: Looks like 2021.1.0b8.1993 doesn't support grass either. In the grass painting tab, it says "The current render pipeline does not support Detail shaders".
     
  14. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    Hey ..

    I don't have a 2019 project with MM2 in it anymore, but I did locks on a project and it worked nicely ..
    sorry don't have any screenshots ..
    .. but did you follow along with the tutorial here??

     
  15. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    Ok..

    just did a test scene ..
    followed the video linked above ..
    flattened area with terrain tool ..
    dropped some cubes on the floor ..
    created lock ..
    clicked generate ..
    changed some parameters (noise) ..
    scene refreshed and cubes were in place as expected..

    (built in render, Unity 2020.1.7, MM2v2.1.1)



     
  16. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Glad that it's working now, but if you reproduce this issue I will appreciate if you could let me know how to do that. Thanks!

    Not yet. But I'm working on a new module that will let you literally paint terrain with MapMagic effect. It would be called the Brush. Can't sure the exact ETA, but if everything goes well hope it will be released in two weeks (but probably it will take more).
     
  17. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    71
    RTP output node doesn't work, terrain always has rtp 1layer texture and can't be textured using nodes.
    There is no mistake. RTP is marked as installed, using 8 textures
    u 2019.4.21f1
    rtp 3.3r
     
  18. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Unfortunately RTP is not officially supported by MM2. There is a legacy node from MM1 that some might find useful, but I can't guarantee it's functionality. I guess it won't work with 8 textures.

    I'd really like to recommend you using the newer terrain material asset like MicroSplat instead. It's more performance friendly, more feature rich and main thing - it has a better code to work with.
     
  19. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    any updates on the tree size error @Wright ?
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Could you please clarify what the error is? Isn't it the one that Unity terrain trees could not be rotated and scaled (even if they are placed with no MM used)?
     
  21. bdae

    bdae

    Joined:
    Dec 24, 2017
    Posts:
    23
    @Wright Will I have to pay for that terrain brush? Also, I'm having the same issue with the lock feature that Swyfft was having. I followed your video guide and when I clicked 'Generate' the locked terrain formed a tall tower like it did in his photo. I'm on unity 2020.2.3f1

    I don't know if its worth mentioning that if I click the Relative Height check box and click generate it gives me the following error:

    Thread failed: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at Den.Tools.Matrices.Matrix.GetInterpolated (System.Single fx, System.Single fz, System.Boolean roundToShort) [0x0015e]
    in C:\...\Assets\MapMagic\Tools\Matrix\Matrix.cs:121
     
    Last edited: Mar 5, 2021
  22. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    Its not a console error but i think i fixed it. Im using this graph for the trees:


    and while most are big some remained pretty small
     
  23. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    Hi.. sorry.. I didn’t have the issue, I was replying to DigitalIPete2 a few posts above..

    just testing it on my version and showing the results with my unity / MM2 versions and the steps to see if there was something different.

    Can try a unity 2019 test this weekend and see if I can reproduce it...
     
  24. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Hi everyone,

    Thanks for the quick replies everyone!

    The mystery continues. Yes I have watched all the videos including the 1.5 hour one for the original MM. Yesterday I watched the Lock video and thought wow! thats worth buying I will try the free version first!

    I must be doing something wrong but I thought I had followed the instructions to the letter. Anyways it still does not work in my setup.

    I'm using one of the example demo scenes that comes with the free version, the island.but I also tried in on another tiling map too, same results...

    Here is a video to show you what I did and the result I get. Any help much appreciated! :)




    Thanks,

    P.
     
    Last edited: Mar 5, 2021
  25. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    I've been following the YouTube videos to use Vegetation Studio Pro with MM2, however I'm having problems with the newer versions. How do I link a Scatter node with the Textures node? The Scatter node does not have an input marker, so I cannot get trees to spawn only on the base grass texture.
    MM2-VSP.png
     
  26. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    71
    I have the same problem with MicroSplat as with RTP, terrain always has MS 1layer texture and can't be textured using nodes. Integration with MS is active i put ms material in to Material Template

    u 2019.4.21f1
    mm2 v2.1.0
     
  27. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    You use a mask, like this upload_2021-3-5_21-46-23.png
     
  28. OldManJim76

    OldManJim76

    Joined:
    Sep 21, 2015
    Posts:
    9
    Thanks Mick. I'm new to this, so I'm relying on out of date videos.
     
    mick129 likes this.
  29. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    Aliens!!

    that's the only logical answer .. Aliens!!

    (watched this on my big screen tv, and was looking closely to see what you were doing.. and when that pillar jumped up at me, made me almost fall backwards!!)

    i'll make you a deal ..

    you try this with Unity v 2020.1.17 built-in .. (not that URP should affect this..) and I'll try with Unity v 2019.4.17f1 (built in and URP)
     
  30. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    ok .. so on 2019.4.x this happens...
    ..
    upload_2021-3-5_21-55-7.png
     
  31. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    ok..
    spent the last hour messing with this..
    created several new projects 2019.4.x and 2020.1.x
    imported MM2 only,
    did lock test.. showed same as above.
    imported rest of modules one by one..
    same results as above.
    imported all modules..
    then did test..
    same results.

    side by side test .. new project fresh MM2 import .. and existing MM2 2020.1 project..
    same minute island demo scene ..same steps..
    different results.
    (left side .. new project with lock glitch .. right side .. existing project .. lock works OK)
    upload_2021-3-5_23-12-52.png

    there is definately something going on here..

    i always set up projects with same basic sequence..
    build settings .. x86_64
    player settnigs .. linear

    for these tests..
    import MM2 + other modules
    select terrain..
    paint terrain..
    set height..
    select MapMagic..
    create lock..
    (lock lock)
    click generate..
    this result.

    Very strange.

    @Wright .. can make video of whole operation if you wish .. but .. yeah .. something isn't working consistently here.
     
    Last edited: Mar 6, 2021
  32. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I've reproduced the lock issue and currently trying to find out why this happens. When fixed I will publish a patch if available (and surely it will come with next update that I plan next week).Thanks everyone for reporting it!
     
  33. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    192
  34. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Wow thanks for taking the time Swyfft I’ve been asleep and I woke to this, I really appreciate it. Thought it must be me but then I saw Bdae reported it too, and you were able to reproduce it.

    I’m glad Dennis has said he will fix it ASAP, in the meantime I’m enjoying learning what I can do. I am looking forwards to buying as soon as this is fixed, i want to take advantage of the sale so actually I may Just go andbuy the bundle now.

    Thanks again for taking the time, I really appreciate it.

    IPete2
     
  35. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Lock issue patch.
    Fixes the "high cube" issue and lock removing when going too far from it.

    I can propose two solutions here. The obvious one - is using the higher terrain margins and lower flatten range. However this will result in higher generate time. And as alternative - using the height of all locks that is not related with the actual height. The simplest way to do this - is to combine height and Constant using the mask generated with the Stamp node:
    StampFlatten.jpg
    Probably instead of the Constant there could be something more complicated - depending on what exactly fits best
     
    Last edited: Mar 6, 2021
    Swyfft likes this.
  36. Byberg

    Byberg

    Joined:
    May 20, 2013
    Posts:
    74
    Not sure if this has allready come up yet. But im having issues with the navmesh agents. I can create a navmesh BUT as soon as i start playing it goes away due to the terrain being generated again. Is there a fix to this?
     
  37. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Woot so fast thanks Wright,
     
  38. bdae

    bdae

    Joined:
    Dec 24, 2017
    Posts:
    23
    @Wright The lock issue is still happening for me on 2020.2.3f1
    After using your patch files I get this error:
    Assets\MapMagic\Tools\Matrix\MatrixSet.cs(241,12): error CS7036: There is no argument given that corresponds to the required formal parameter 'dstRectSize' of 'Matrix.CopyResized(Matrix, Matrix, Vector2D, Vector2D, Coord, Coord)'
     
  39. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I don't know if it is intentional or a bug.

    I'm building a tool and would like to set the water level one time. Could it be possible to use an exposed value for the selector?

    upload_2021-3-6_11-55-9.png
     
  40. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44

    I get the same once the patch is installed the console has tha message above. :(

    I am in Unity 2019.4.17f1

    Thanks,

    IPete2.
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I've added some information on MicroSplat node. Feel free to ask questions and I will append this document with answers.

    I've updated the patch file. If it won't work here is full files difference winmerge can see.

    Well, Min/Max range is just an editor extension, these are not real values. You've got to switch to Transition to make values exposed. It's not obvious, I see, will think of the way to do it better.
     
    Swyfft and mick129 like this.
  42. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Oh no problem then, I will try and figure out something.
    I wasn't sure if it was just a bug / forgotten or intentional :)
     
  43. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Thanks Wright that's done it ! :) Woot!

    IPete2.
     
    Swyfft likes this.
  44. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    yup .. works nicely ..

    hope you bought the bundle .. and don't forget to join the Discord server too..

    as for taking the time to test, well.. i'm kinda picky about things..
    like if someone has a problem and I show a solution or try to help, and it doesn't work, then I need to know why.

    glad we confrmed the issue .. and really glad that the patch was ready so fast :)

    thanks @Wright !!!
     
    mick129 likes this.
  45. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44

    Thanks for the assist, it was very much appreciated.

    Yes, bundle bought and paid for! :)

    Really looking forwards to getting to grips with everything. I'm wondering if microsplats would be a good addition - what do people think? I have Vegetation Studio Pro too so I'm not sure which is the best way to combine forces to get the best results.

    Again thanks for the help esp Wright and Swyfft.

    IPete2.
     
    Last edited: Mar 7, 2021
  46. tgamorris76

    tgamorris76

    Joined:
    Apr 24, 2013
    Posts:
    292
    Hi, quick question. with the minute island infinite graph how do i increase the space between the islands. I'm using minute island infinite, with 6 pinned 4000m tiles, and a cell size for the islands at 2000
     
  47. bdae

    bdae

    Joined:
    Dec 24, 2017
    Posts:
    23
    @Wright The tall terrain box from the lock issue is gone but the generator doesn't seem to be responding to the locked area properly. Trees will still generate on elevated terrain that is no longer there after I flattened. I also notice the lock preview (the orange and red rings) show that its laying on elevated terrain that isn't there anymore.



    The trees will spawn on top of that invisible terrain
     
  48. Mr_Darkness

    Mr_Darkness

    Joined:
    Apr 6, 2020
    Posts:
    8
    hello how to change seed on play mode. Every time I launch my game, the terrain is the same.
     
  49. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    I'm having an issue when I lock a terrain, and i make a new seed the surrounding object outputs outside the locked terrain from previous seeds are not always being removed; i made a video here showing my issue



    Edit:

    I've figured out this only occurs with nature manufacture assets, the trees, maple bushes. grey willow bushes, and prefab flowers

    speed trees as object outputs outside of locked areas do fine and rock outputs are properly removed as well with new seeds; looks like just nature manufacture trees, bushes, and flowers

    I downloaded map magic 2 and nature manufacture only to a separate project and have the same problem; i exported that project and can send it to you

    I sent it to your email
     
    Last edited: Mar 7, 2021
  50. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    About the exposing value, I managed a solution by using another beach node with the same water exposed value plus an offset.