Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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,145
    Try searching for "contact shadows". It might be a post-processing asset or possibly already integrated in HDRP (not sure about that though).

    Unfortunately Unity allows only one mesh per grass layer. To use 5 different meshes you will have to use 5 layers - that is what you are doing. That might be inconvenient, but that's the way things work now in Unity.
     
  2. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    I am in URP. I wanted to use HDRP but it only supports mesh grass. Is there any way to use the classic grass in HDRP or use shadows on the grass in URP somehow?
     
  3. andrew_unity628

    andrew_unity628

    Joined:
    Apr 1, 2020
    Posts:
    5
    @Wright

    I'm struggling with my tile seams blending smoothly. I found this video which addresses it, but the options shown in the video aren't in my inspector


    I only have "Main Margins" available in my inspector and after experimenting with many different values, none seem to significantly reduce the tile border artifacts.

    It's possible that this is related specifically to Splines.

    Appreciate any advice you or the community has to give. Thank you!
     

    Attached Files:

    Last edited: Nov 13, 2022
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    I'm afraid I can't help you with that since I've never used grass shadows. I've just named tech that is usually used for that - it's contact shadows, and it might worth looking for the asset that allows it at the Asset Store.

    MapMagic can mask small seams at cost of bit longer generate time by generating a part of a neighbor tile. Splines go deep into the other tiles, so it could not be fixed with margins. I'm working on a system called "clusters" that will generate a base big low-res tile to be used by main tiles. It's already working but got to finalize stuff. Probably I will release it next month.

    Btw this video is a pre-prelease showcase of MM2. Additional Margins are now called Main Margins (for main tiles) and Draft Margins (for drafts).
     
    Swyfft and Liminal-Ridges like this.
  5. andrew_unity628

    andrew_unity628

    Joined:
    Apr 1, 2020
    Posts:
    5
    Fantastic, thank you. I'll proceed with my game as-is and plan on upgrading it once your cluster enhancement is live. It's not a blocker until we enter beta, which is a couple months out.
     
    Wright likes this.
  6. onionman77

    onionman77

    Joined:
    Nov 3, 2013
    Posts:
    8
    Is there a way to detect specific colors from a texture map? I need to pull specific colors to create a biome mask. Thank you!
     
  7. aldoromao

    aldoromao

    Joined:
    May 25, 2013
    Posts:
    5
    Hello!

    Maybe this is a dumb question, but I'm new to MM2, and just can't found how to set the terrain size, keeping the tiles size!

    Example: I would like to have a 1024x1024 terrain, composed by 256x256 tiles.

    How to do that?

    Thanks a lot.
     
  8. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    Hooray, new version is out! Here is what it brings:

    2.1.12

    New Nodes:
    - Terrain Holes Output generator
    Holes.jpg
    - Splines module: Scatter node (places objects along spline)
    ScatterEffect.jpg

    Other Features:
    - Open generator codes with right click
    image.png
    - Graph.GetGeneratorById method that simplifies changing nodes parameters with scripts

    Bug fixes:
    - New node update system designed to work with Clusters
    - All Spline nodes: fixed incorrect line length calculation when tangents and points form a single line
    - Clearing terrain on node disconnect fix
    - Warning dialog on switching grass instancing with improper grass type
    - Fix Objects Preview showed a bit incorrect height because margins were not taken into account
    - Checking render pipeline name when assigning preview shader

    MM uses a heightmap to import map - grayscale images only. It's better to use a dedicated texture editing tool to extract grayscale images based on some specific colors.

    I might not understand a question clearly, but in MM tile is a terrain. Tile resolution you set determines the resolution of terrains - in pixels. Tile size sets the size of this terrain - in world units.
     
    Last edited: Nov 18, 2022
    Liminal-Ridges likes this.
  9. onionman77

    onionman77

    Joined:
    Nov 3, 2013
    Posts:
    8
    Thank you so much for all your help Wright! You have been so kind.
    I did get the importing and exporting of heightmaps working ok, thank you!

    I am trying to write a custom node now, and I'd really like to be able to pass in and out basic variable types like a float or a double, and am having trouble figuring that out. Do you know where I might be able to look for this?

    Also, unfortunately I need to use these color values at runtime, so unfortunately modifying a heightmap outside of runtime with an image editor wouldn't work for me :/

    Thank you!
     
    Last edited: Nov 18, 2022
  10. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    I have the same question. I have a terrain heightmap as a node, I do not want the result to be a 4k terrain, but split into 4 terrains, each terrain being 1024 in size. How do I achieve this?
     
  11. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    90
    Latest update crash on mac with me, anyone else noticed this issue?
     
  12. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    When does the crash happens, what were you doing before it? Did it happen with a previous version? Will it still happen if you disable Native Code in Window -> MapMagic -> Settings?

    If you are using Import node you can set the Size of your heightmap in node, in tiles. Setting it to 4 will scale heightmap to 4*4 grid.

    Are you using colors or channels? If your colors are red, green, blue you can use Import node with Import Asset set to read some specific channel. If it's colors - you will have to use script to decode this information depending on how it's been encoded, so custom script will be needed here anyways.
     
  13. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    @Wright can you please integrate a stochastic texture generator in the textures node? Im looking the terrain from above the and the repeating-ness is so ugly
     
    Last edited: Nov 20, 2022
  14. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    How do you stop the import heightmap clamp option from bleeding onto the other terrain tiles (aka zero border)?
     
  15. mailfromthewilds

    mailfromthewilds

    Joined:
    Jan 31, 2020
    Posts:
    193
    seems all the demo scenes have their terrain invisible with URP. anyone else has this issue?
     
  16. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    I create a Matrix asset, set to texture and channel red, add image. I close and reopen my project and my settings have been wiped.
     
    Last edited: Nov 21, 2022
  17. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    90
    If i disable Native code would it slow mapmagic performance?
     
  18. Draganovaaa

    Draganovaaa

    Joined:
    Nov 18, 2021
    Posts:
    3
    Hello, I am part of a small team that is currently developing a game. For the past few days I have been trying to figure out how to use the grass output node as nothing appears in the scene viewer or the game. I am using HDRP, Unity 2020.1.14f1 and given that it does not support billboard grass I have been testing it with a simple prefab with a LOD group. Is there anything special that the prefab needs for me to be able to use it for the grass output or no? I feel like I am missing something obvious since I had no issue setting up the trees with the tree ouput within the graph. Thanks for the help!
    https://drive.google.com/drive/folders/1GiJ9i6TVFZq9TnCxSLMR_BKwGspDPqMb?usp=share_link
     
  19. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    You can not use LODs with Unity terrain details.
     
    Draganovaaa likes this.
  20. Draganovaaa

    Draganovaaa

    Joined:
    Nov 18, 2021
    Posts:
    3
    Thank you for the quick reply, I have tried your suggestion but had no luck getting it to work (I used a prefab with just a mesh and a material for it, nothing else). I tried both the mesh vertex lit and the mesh unlit options, with and without instancing and have set the density to 1 but still no change. Finally I tested it with a simple plane mesh insted of the grass mesh I previously had and I could see them spawn but as white squares. Is it possible that my previous mesh had too complex geometry and that is why it could not be displayed? I assume it would be very performance heavy usin the tree spawn node for things like more detailed grass with a complex geometry?
    Thanks again for the reply!
     
    Last edited: Nov 22, 2022
  21. aldoromao

    aldoromao

    Joined:
    May 25, 2013
    Posts:
    5
    Hello!

    How to set this 4*4 grid?

    I changed the Size to 4, but still getting only 1 terrain.

    I need that the terrain is splited in 16 smaller terrains.
     
    Last edited: Nov 22, 2022
  22. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    Do you mean stochastic tiling on terrain or you don't like repeating look of heightmaps from Import node?

    In first case I'm afraid it's a bit out of scope of MM. You need a special terrain shader for this. I remember Jason Booth's article on this topic, but not sure whether this feature implemented in MegaSplat or MicroSplat.

    But if you mean reducing tiling from Import node - I like the idea. There's no way to do it now, but I will really think of implementing it. This will make Import node work in infinite tiling, I see great potential in it!

    Could you please make a screenshot of what is bleeding?

    There is a special demo scene for URP called TutorialURP. Isn't it working too?

    BTW if you want to see terrain in scene created in other render pipeline (including other demo scenes) you can change terrain material to TerrainURP in Terrain Properties -> Material Template and pin new tile.

    Have you saved your project with File -> Save Project? Matrix asset is no different from any other asset, and will be saved on saving scene or project.

    Yes. A lot - in editor, and somewhat in release build.

    As far as I know billboard grass do not work in HDRP in Unity 2020:
    https://forum.unity.com/threads/is-terrain-grass-working-on-hdrp-yet.628963

    I guess you are talking about pinning additional tiles. This tutorial might help if you have not seen it: Quick Start
     
  23. aldoromao

    aldoromao

    Joined:
    May 25, 2013
    Posts:
    5
    Hello!

    I've just updated to 2.1.12 version from the Asset Store, but the new features aren't there!

    I deleted the old version before importing the new one.
     
  24. aldoromao

    aldoromao

    Joined:
    May 25, 2013
    Posts:
    5
    Exactly what I need!

    Thanks
     
    Wright likes this.
  25. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    The first one, so you dont see the same thing repeating all over the terrain. Its actually done in BLS maybe you can copy the code or ask the creator how he did it. Its gonna improve the terrain massively
     
  26. Draganovaaa

    Draganovaaa

    Joined:
    Nov 18, 2021
    Posts:
    3
    I am using HDRP and I am not able to change the dry and healthy color within the grass ouput in the graph (height and width work fine tho). Could it be a material problem, HDRP problem or something else? Additionaly are the values for wind located within the main MM2 script meant to work with HDRP, if so how and what do they affect (just trees,grass or else)?
     
    Last edited: Nov 23, 2022
  27. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    Yes I have tried this many times now. Can you confirm that you have tested it with 8k png files?
     
    Last edited: Nov 22, 2022
  28. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    I also get the enclosed error.
     

    Attached Files:

  29. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    I have enclosed the image as requested.
     

    Attached Files:

  30. NestorVG

    NestorVG

    Joined:
    Feb 12, 2019
    Posts:
    12
    Hi, I'm a noob that has been playing around with the asset for a few days and recently got all the modules I didn't have before with the 70% off deal. I was trying to get a low poly look on a world as big as possible (tall and wide hills separated from each other) so I played around with the graph and made the colors of the terrain flat. I was playing around with how small or big should I make each map tile to avoid having a whole tile suddenly load dozens of objects all at once, when I noticed an artifact in the seam between the tiles.

    It's not that the seam has bad geometry or a physical seam itself like when you apply erosion (which I removed for now) the issue is only related to the texturing

    I think reading a lot of messages from this forum, this is because each "map section" is calculated individually, what can I change to avoid this from happening?



    upload_2022-11-23_4-49-51.png
    upload_2022-11-23_4-58-21.png
    upload_2022-11-23_5-0-0.png
     
  31. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    What version do you see in Window -> MapMagic -> About?
    Are you looking for some particular feature?

    Actually it's a bit out of the scope of MM. It's a terrain generator, it has nothing to do with terrain shaders. It just uses built-in or third party shaders instead.

    Grass look depends on a grass shader you are using. MM just allows to set all detail prototype values, no matter if they are used or not. Definition of those values does not depend on render pipeline - they are always the same. So if some of the values are not used - they are just not supported by render pipeline in Unity.

    I'm afraid no. Maximum resolution for terrain (as well as imported map) is 4K, and it's Unity limitation.

    Make zero edges on import map? Multiply it with Pyramid Simple Form (with large intensity)?
    upload_2022-11-23_20-1-24.png
    I wonder what is your use case for this. It will surely create very noticeable seams, do you really need it?

    The thing is that tiles do not get any information from other tiles (they might not even be generated yet). This way each tile generates part of the other one. The size of this "other one" part is called Margins, and they could be set up in Tile Settings. By default they are 16, but could be increased (at some cost of increasing generate time). More info here: Seams when using Blur/Stamp/Flatten/Stroke nodes
     
  32. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    This is not the issue. I have an 8k imported image spanning over multiple 1024 terrains, as shown working in the bleed image. My issue is that the Matrix asset does not save.
     
  33. aldoromao

    aldoromao

    Joined:
    May 25, 2013
    Posts:
    5
    Hi, version 2.1.11 is allways shown , even if I delete the package and download it again.

    Looks like the 2.1.12 wasn't uploaded.

    I looked at the files listing on Asset Store, and there isn't any file with 'Hole' in its name.
     
    Last edited: Nov 23, 2022
  34. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    125
    The point is to have a zero border to prevent the clamping from bleeding across and not completely erase the small rocks and sand pattern from the ground (multiple tiles).
     
  35. NestorVG

    NestorVG

    Joined:
    Feb 12, 2019
    Posts:
    12
    I don't think increasing that value is fixing my problem, or at least I'm not understanding your answer. I have tried these settings in (size 64, main resolution 33 and main margins 64 and the issue is still there. I have been trying all kinds of values with a lot of resolutions and sizes as well as increasing the margins, but nothing makes any difference. Even setting the margins to 129 with the current size and resolution makes artifacts appear. I would like to have the tiles as small as possible but fixing this is a priority.


    upload_2022-11-23_22-4-42.png

    I have been playing around with a clean install of the asset in a new project and this seems to be normal among small tiles but also happens in big ones as well upload_2022-11-24_3-38-38.png
     
  36. simast

    simast

    Joined:
    Jan 5, 2020
    Posts:
    4
    After upgrading from 2.1.11 to 2.1.12 getting the following errors in console. The grass details are not longer rendering:


    Detail index out of bounds in DetailDatabase.SetLayers
    UnityEngine.TerrainData:SetDetailLayer (int,int,int,int[,])
    MapMagic.Nodes.MatrixGenerators.GrassOutput200/ApplyData:Apply (UnityEngine.Terrain) (at Assets/ThirdParty/MapMagic/Generators/Matrix/Runtime/GrassOut.cs:161)
    MapMagic.Terrains.TerrainTile/<ApplyRoutine>d__53:MoveNext () (at Assets/ThirdParty/MapMagic/Terrains/TerrainTile.cs:808)
    Den.Tools.Tasks.CoroutineManager:Update () (at Assets/ThirdParty/MapMagic/Tools/ThreadManager/CoroutineManager.cs:147)
    MapMagic.Core.MapMagicObject:Update () (at Assets/ThirdParty/MapMagic/Core/MapMagicObject.cs:142)
     
  37. NestorVG

    NestorVG

    Joined:
    Feb 12, 2019
    Posts:
    12
    Hey that's the exact same error I was having, hummmm
     
  38. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    well the texture is part of the terrain init. maybe not now but highly suggested to be implemented at some point
     
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    When do you get this error? How can I reproduce it?
    Are you using Blur, Stamp, Flatten or Stroke nodes? If so look through this to find out why this happens: Seams when using Blur/Stamp/Flatten/Stroke nodes. TL;DR: lower blur amount, stamp radius and other parameters that can affect neighbor tiles.

    I got your idea, but you are talking about terrain shaders. MM is not about shaders, even if they are applied to terrain. Try looking into MicroSplat, it seem to be having this feature.
     
    Last edited: Nov 25, 2022
  40. simast

    simast

    Joined:
    Jan 5, 2020
    Posts:
    4
    When I hit Play. Looking at the diffs I can see that in 2.1.12 version you made a change in GrassOut.cs where this line was moved after a for loop:


    terrain.terrainData.detailPrototypes = detailPrototypes;


    If I restore this line before the for loop - the issue is fixed for me.
     
  41. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    Last edited: Nov 26, 2022
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    Thanks for letting me know! Fixed and already at the Asset Store.

    Slope is not a right generator to show it, but I got what you mean. Slope if it is applied to another slope will generate completely different result since it get different height - in first case a real one, in second - a slope mask instead.

    Textures Output returns the map of how textures are actually applied. Textures are applied per-layer. If you use background and 2 layers with 50% opacity final opacity for layers will be:
    - background with 1st layer are mixed 50% and 50%
    - then 2nd layer adds it's 50% to all layers underneath: so background will be 25%, 1st layer 25%, and 2nd layer 50%.

    If you apply some layer with 100% mask it will make all underlaying layers have 0% no matter of what were their previous masks. Textures Output returns these modified values.
     
  43. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    Thanks what about the scatter?
     
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    Sorry, forgot to mention it - I cannot see any image on clicking the link
     
  45. SoDynamic_

    SoDynamic_

    Joined:
    Mar 5, 2014
    Posts:
    3
    I've been running into an issue where grass (terrain details) doesn't appear correctly in build. I'm running Map Magic 2.1.12 on Unity 2020.3.1.15f2, using the Microsplat integration for triplanar texture mapping. In editor, grass appears correctly, as depicted below. The left, lighter green grass is using the billboard setting, and the left, darker grass is using the grass setting.

    In builds though, it appears like this:

    The billboard grass is invisible, and the "grass" grass appears as white planes. One important caveat is that this is only the case for tiles which are generated at build time. For tiles that are pinned in the editor before the build, both types of grass appear as they should.

    I've made sure that Shader Stripping is set to Keep All to ensure that the proper shaders are included. In case it's relevant, I'm using both the Microsplat Textures node and the regular Textures node, connected to each other so they should both have the same output. I've used a tool I created to check the detail maps on the terrains at runtime and have confirmed that the grass should be appearing, it just doesn't seem to be rendering (or rendering as a white square).

    Thanks for any information you can provide that might point me towards a solution to this problem!
     
  46. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    sorry reup https://imgur.com/a/TJLm0VF
     
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,145
    Unfortunately it's Unity issue - grass is not displayed in build if it was created with script. I have created a ticket, and as far as I know in latest alpha it works fine. You can find ticket description here: Grass is not displayed (or white) in build

    Makes sense, adding to my to-do list.
     
    Liminal-Ridges likes this.
  48. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    224
    @Wright thanks also please do the same for the Move node. It currently moves stuff globally. It would be nice to move them based on local space
     
  49. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    149
    @Wright

    Any plan to support multiple size of drafts with different resolutions?
    The current draft system is a good evolution compared to MapMagic 1, but maybe not the most efficient and scalable when it come to show a distant horizon.

    To explain what I have in mind I did a quick drawing:

    upload_2022-12-2_20-33-4.png

    So the idea is to increase tile size and lower it's resolution depending on camera distance, instead of always showing the same small draft tile that would probably take more time to generate (I assume a lower resolution 2000 tile is going to be faster / more performant than 4 x 1000 tile).
    With this technique, for a tile of 1000, the closest draft will be 2000 in size, then the further one 6000, then 18000, then 54000 etc... It would increase the view distance and may improve performance too :)

    One issue I could see however is moving will cause tile regeneration to change size, but with the gain from the biggest tile it may be not that bad.

    Let me know what you think!
     
    Last edited: Dec 2, 2022 at 8:00 PM
  50. MatthiasEgi

    MatthiasEgi

    Joined:
    Mar 19, 2018
    Posts:
    5
    Hello,

    i have a question according MicroSplat and Setting terrain alphas for the texture. Without MicroSplat material i can change the heightmap, and with that, the texture shown, by changing the alpha of all textures. But with MicroSplat, i can change the heightmap, event prevent depending on Texture alpha to change heightmap, but i cannot change the alpha as it seems.

    using Unity 2021.3.14f, tried all combinations with Texture, with splat, custom splat on/off on MapMagis or MicroSplat, but to no avail!

    Has someone an idea what that might be?

    Thanks a lot!