Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

MapMagic 2 - infinite procedural land generator

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

  1. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    in the video i didn't edit any of the objects, i showed that i made a new tile and just moved a new seed and it still occurred?
     
  2. malditonuke

    malditonuke

    Joined:
    Apr 15, 2017
    Posts:
    18
    Did you delete the objects in the first tile before creating the second tile?

    I had the same problem as you before with objects floating. I can't remember what was causing the problem, but I realized that they weren't actually floating - they were actually still set at the previous height. It was only affecting some of the objects. I had done something to the objects that was causing them to be stuck at the original heightmap. Clearing all the objects in all the pinned tiles worked for me.
     
  3. Jshh

    Jshh

    Joined:
    Sep 14, 2019
    Posts:
    38
    Has anybody managed to get MM2 working as expected with MicroSplat?

    I'm seeing some strange behaviours- progress bar frozen, textures/lighting disappeared, like this:


    Custom SplatMaps are enabled, and I've tried everything else I can find in this forum and the MM1 videos, but have had no luck (other than the workaround of manually converting terrains textured in MM2 to use MicroSplat , which is suboptimal).

    Couple of errors in the console, wasn't sure if these were relevant. Any help or pointers for things to try would be much appreciated!

    Exception: Routine error: System.NullReferenceException: Object reference not set to an instance of an object
    at UnityEditor.AssetDatabase.Contains (UnityEngine.Object obj) [0x00001] in <bccb16a88ec4456dbf07978c418f407b>:0
    at MapMagic.Nodes.MatrixGenerators.CustomShaderOutput200+ApplyData.Apply (UnityEngine.Terrain terrain) [0x000d4] in X:\Unity\MapMagicTest\Assets\MapMagic\Generators\Matrix\Runtime\TexturesOut.cs:402
    at MapMagic.Nodes.MatrixGenerators.MicroSplatOutput200+ApplyData.Apply (UnityEngine.Terrain terrain) [0x00105] in X:\Unity\MapMagicTest\Assets\MapMagic\Compatibility\Runtime\MicroSplatOutput.cs:115
    at MapMagic.Terrains.TerrainTile.ApplyNow (MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x0003c] in X:\Unity\MapMagicTest\Assets\MapMagic\Terrains\TerrainTile.cs:735
    at MapMagic.Terrains.TerrainTile+<>c__DisplayClass39_0.<Generate>b__0 () [0x00000] in X:\Unity\MapMagicTest\Assets\MapMagic\Terrains\TerrainTile.cs:709
    at Den.Tools.Tasks.CoroutineManager.Update () [0x000f0] in X:\Unity\MapMagicTest\Assets\MapMagic\Tools\ThreadManager\CoroutineManager.cs:136
    Den.Tools.Tasks.CoroutineManager.Update () (at Assets/MapMagic/Tools/ThreadManager/CoroutineManager.cs:137)
    MapMagic.Core.MapMagicObject.Update () (at Assets/MapMagic/Core/MapMagicObject.cs:144)
    MapMagic.Core.MapMagicObject.EditorUpdate () (at Assets/MapMagic/Core/MapMagicObject.cs:136)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Delegate.DynamicInvoke (System.Object[] args) (at <fb001e01371b4adca20013e0ac763896>:0)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <bccb16a88ec4456dbf07978c418f407b>:0)

    and...
    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.AssetDatabase.Contains (UnityEngine.Object obj) (at <bccb16a88ec4456dbf07978c418f407b>:0)
    MapMagic.Nodes.MatrixGenerators.CustomShaderOutput200+ApplyData.Apply (UnityEngine.Terrain terrain) (at Assets/MapMagic/Generators/Matrix/Runtime/TexturesOut.cs:402)
    MapMagic.Nodes.MatrixGenerators.MicroSplatOutput200+ApplyData.Apply (UnityEngine.Terrain terrain) (at Assets/MapMagic/Compatibility/Runtime/MicroSplatOutput.cs:115)
    MapMagic.Terrains.TerrainTile+<ApplyRoutine>d__41.MoveNext () (at Assets/MapMagic/Terrains/TerrainTile.cs:787)
    Den.Tools.Tasks.CoroutineManager.Update () (at Assets/MapMagic/Tools/ThreadManager/CoroutineManager.cs:147)
    MapMagic.Core.MapMagicObject.Update () (at Assets/MapMagic/Core/MapMagicObject.cs:144)
    MapMagic.Core.MapMagicObject.EditorUpdate () (at Assets/MapMagic/Core/MapMagicObject.cs:136)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Delegate.DynamicInvoke (System.Object[] args) (at <fb001e01371b4adca20013e0ac763896>:0)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <bccb16a88ec4456dbf07978c418f407b>:0)

    ...Update...

    I got it working by adding checking 'Set Component' on the MicroSplat Node, adding the relevant PropData scriptable object, then manually adding the name
    _CustomControl0
    and an empty texture into the Material Property Serializer component on the terrain object (copying from the demo scene).



    Feels like a slightly circuitous workaround for a process that should have been automated (maybe my errors are caused me to need to do this?), but maybe it'll help somebody else out.

    Meanwhile if anybody has more experience with the integration, do please let me know if there are better ways to handle it.

    Thanks and hope @Wright is feeling better :)

    ...Update 2...

    My solution above doesn't scale. I start seeing missing textures and odd behaviour if I increase above 3 textures (adding further _CustomControl items into the terrain material property serializer doesn't help). Hopefully somebody has come across this before?
     
    Last edited: Aug 6, 2020
  4. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83

    Maybe the below post helps?
    I ran into some issues and managed to fix it via some code changes:
     
    Nunez-Torrijos and Jshh like this.
  5. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    109
    having a problems with splines on terrain edges, not quite matching up, just an fyi upload_2020-8-6_22-49-19.png
     
    Last edited: Aug 7, 2020
  6. PassivePicasso

    PassivePicasso

    Joined:
    Sep 17, 2012
    Posts:
    100
    First of all, I hope you're recovering well its certainly not a great time to be in a hospital or sick, so get your rest and get healthy!

    I'm really excited to see this splines update, what you have so far is pretty great, though it doesn't quite fulfill my needs.
    What I want to be able to do is use a spline to define a rough path and a kind of pseudo topology.

    For example, you start in the middle of the map space, move towards a corner, and then spirals up to a point.
    I'd like to be able to take a number of these pre-designed splines and have the map generation try to conform to the defined spline so you can use a spline on a randomized procedural landscape to roughly define features and paths for gameplay.

    I'm curious what will be coming in the update, I love the prospects you have concerning rivers and bridges but I'm curious about other options, I want a lot of control over the splines and to be able to use those splines to inform the heightmap more.

    I also added this to ideainformer
    http://mm2.idea.informer.com/proj/MM2?ia=134231
     
    Last edited: Aug 7, 2020
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This isn't actually true- I don't know if there is even a limit. As far as I know it will just keep adding splat maps with the assumption that the terrain is rendered once for each splat map (the way their shader works). I cap at 32 textures because a) 8 splat maps is a lot of uncompressed texture data and sampling, as well as sorting, and b) it seems like enough.
     
  8. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Yep ok thanks. I think you mentioned the number of terrain textures correction on page 6. And yea 32 is a lot. I think I use like 28 at the moment. The code fix I posted does fix the microsplat mapmagic integration issue though, regardless of any of this.
     
  9. FuriantMedia

    FuriantMedia

    Joined:
    May 8, 2013
    Posts:
    9
    I don't know what I'm doing wrong, but I can't add any nodes in the editor. When I right click the canvas, I get the little menu with Create, Generator, Group, etc. But moving the mouse cursor over that window causes it to disappear. I tried dragging the (+Add) icon onto the canvas; it puts a Map node there, but when I mouse over that, it too disappears. What am I missing here?

    I just installed the asset for the first time this evening, so bear with me.
     
  10. PassivePicasso

    PassivePicasso

    Joined:
    Sep 17, 2012
    Posts:
    100
    Go to Window > Map Magic > Settings
    then check Experimental Features

    This will enable a new version of the context menu that works in environments that the current one does not.
     
    Nunez-Torrijos and FuriantMedia like this.
  11. FuriantMedia

    FuriantMedia

    Joined:
    May 8, 2013
    Posts:
    9
    This worked. Thank you very much.
     
  12. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I tested the experimental feature but the +ADD button didn't work for me in 2020, does it work for you?
     
  13. PassivePicasso

    PassivePicasso

    Joined:
    Sep 17, 2012
    Posts:
    100
    Yeah, its been working for me, I've had some trouble with dragging nodes onto it to delete them however.

    Admittedly, I barely use the ADD button, I use the context menu primarily, so if issues come up sometimes I'm probably not likely to run into them.

    I'm using Unity 2020.1.1f1 btw
     
    mick129 likes this.
  14. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Thank you, I will try that version, maybe it was the problem
     
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Thanks for the videos! Could you please email me the graph (can't see the objects section in videos. Linking your post in email will help a lot)? Will try to reproduce this issue to fix it.

    Have you got any errors during import? The issue you've posted should happen only when the linked graph file is corrupted. Did you update your 2019 project or imported MapMagic to a new 2020 project using package manager?

    Set Component and assign propdata (should be created by MicroSplat) should be made if you are changing any of the MicroSplat's per-texture properties.
    It should work without any Material Property Serializer at all since it assigns MicroSplat component instead. Could you please email me your MicroSplat materials settings (or it's screen. Linking your post in email will help a lot)?

    Thanks! [Don't know where was the last word from. I saved this post as draft at this place and then restored it]

    Thanks for the videos! Could you please email me the graph (can't see the objects section in videos. Linking your post in email will help a lot)? Will try to reproduce this issue to fix it.

    Have you got any errors during import? The issue you've posted should happen only when the linked graph file is corrupted. Did you update your 2019 project or imported MapMagic to a new 2020 project using package manager?

    Set Component and assign propdata (should be created by MicroSplat) should be made if you are changing any of the MicroSplat's per-texture properties.
    It should work without any Material Property Serializer at all since it assigns MicroSplat component instead. Could you please email me your MicroSplat materials settings (or it's screen. Linking your post in email will help a lot)?

    Thanks!

    Could you please describe the issue with the +ADD button (sorry if I missed the post)? And what is your OS and screen resolution (it might be related)?
     
    Last edited: Aug 10, 2020
  16. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    No problem @Wright I totally undestand :).

    I do this for a client and I think he imported MM2 before updating to 2020, I will ask him to confirm.

    As for the add button, I am on windows 10 and my resolution is currently 4k. The project work without problem on 2019 but not since they updated to 2020.


    Thanks again for you time!
     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    As far as I understand all of the asset store packages should be imported via Package Manager in 2020. They even have their asset store window deprecated, with only the phrase stating that. Could you try removing MapMagic from assets and import it via package manager? MM v.2.0.6 will be released soon, so it might be worth to wait a couple of days before that.
     
    trilobyteme likes this.
  18. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I just made a clean reinstall of MM2 and it work, indeed the problem was the conversion from 2019 to 2020
     
    Nunez-Torrijos likes this.
  19. krrishsonigra

    krrishsonigra

    Joined:
    May 21, 2020
    Posts:
    1
    i am finding it rather difficult to use textures, could you please make a tutorial on them
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Version 2.0.6 has been released.

    Please note that it brings some changes in spline nodes, so it will change their produced results. Splines are still in beta.

    Bug fixes:
    - Height Output interpolation fixed
    - Un-check Infinite Generate stops generate tiles in playmode
    - Removing output node -> Clear didn't work, error in some cases, fixed
    - Object Output Regard Prefab scale didn't work, fixed
    - Grass Output offset the grass 1 pixel, fixed
    - Fixed the issue when distant tiles (over 10000 units) were not selected with frame
    - Objects preview background was black, fixed - When group was resized it moved in some cases, fixed
    - Gauge displayed complete while height was applying, fixed
    - Was constantly re-generating when curve node was selected with mouse, fixed
    - MicroSplat null reference exception when texture removed fix
    - VSPro grass green, blue, alpha channels fix
    - VSPro trees work fine now when MM object height != 0

    Minor Features:
    - Grass Resolution per patch exposed in Grass Output settings
    - Terrain Base Map Resolution now could be changed in Terrain Settings
    - Dragged tiles pin/unpin frame now resets by Esc or right-click
    - Values for Selector (MinMax mode), Levels and Unity Curve nodes are now could be exposed
    - Building on Android automatically disables native code

    You might find this video helpful (from minute 7).
     
  21. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    @Wright Sorry to bother you but I never got a reply for this. It's probably fine but I just wanted to make sure.
     
  22. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    So, have you tried it? I don't see any problem with MM, and hope that it can place dozens of thousands of objects, but can't say for sure without a try. The main problem I see is the performance issue. It will take long to place these objects, and even longer to render them all.
     
    Nunez-Torrijos likes this.
  23. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Yeah, it works. It places it really fast, but fps is horrible. But that has nothing to do with MM.
     
  24. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    188
    I miss the "Constant" node since the last update.
     
    Nunez-Torrijos likes this.
  25. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    In case anyone is unaware of it, dark mode is now included with the free personal edition of Unity3D. :)
     
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Thanks for notifying this! Quick fix. Hope changes will be reviewed in a couple of days.
     
    Nunez-Torrijos likes this.
  27. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,663
    This is definitely the wrong thread for that. Also, there have been countless threads now covering it - this one for instance. Let's keep it in one place.
     
  28. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    Hey @Wright hope you are doing well!

    I m transitioning my self from MM to MM2, and having some issues (2.0.6 MM2 with Unity 2019.4.7)

    1) I have is that I had a public GeneratorAssets to put my graph in there to do some random stuff on scatters, is this changed to something else? And is the way I used to randomize the scatters still exists in MM2?

    Code (CSharp):
    1. ScatterGenerator184 scatterPortals = graph.list[PortalsScatter] as ScatterGenerator184;
    2.  
    3. scatterPortals.seed = (int)Random.Range(1, 50000);
    4.  
    5. MapMagic.MapMagic.instance.Generate();
    BTW, there was a Debug option in MM1 that I could see the scatter# so I could change the seed in code, can't see it in MM2. So, in short, how can I change individual nodes seed in MM2 ? :)

    2) Also trying the demo a bit to test the Splines as well, I see that in many cases when the tiles are combined there is this (both with default spline scene and MM 2.0.6):
    https://ibb.co/q14XdHp
    https://ibb.co/kxRqtrq

    edit: I have the same issue on my map as well (using an import RAW if it matters), played with main margins but the result in edges was not ideal and had a lot of sharp edges: https://ibb.co/SwqdSwf and the height test graph which is almost the same as the demo splines with import RAW and 500 size terrains:

    Main Margins 8: https://ibb.co/1zGGKRr
    Main Margins 16: https://ibb.co/fXGvz55
    Main Margins 2: https://ibb.co/m8QTK53 (oposite side sharp edge)

    BTW, is there a way to have villages (flat terrain/locks) on some spline ends? And could we connect locked villages with splines?

    I know it's beta just seeing the huge performance boost of MM2 will ditch the MM1 with spline tools and go for this one :)

    3) How can I get when MM2 is loading a terrain so I can have the loading mark like in MM1? the old script doesn't seem to work

    4) Having VS Pro Maps node in the graph creates a huge spike of 5-6 seconds even with only 1 draft and 0 main range in Generate Infinite terrain, since it adds the components on all drafts as well. Am I doing anything wrong here? In general I tried with custom tagged objects to generate terrain, and VS Pro Maps are really slow in MM2 (using the same VS Pro package I use in MM1), any tips?

    5) VS Pro Maps Channel setup doesn't seem to work for me, it's pretty straight forward as I had it in MM1, using a group and channel, and having them setup in VS Pro Use Texture mas include rules. Again just using the VS Pro Maps and a grass portal.
     
    Last edited: Aug 15, 2020
  29. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Wright , Hi Denis, I was wondering about say a 10x10 tile map magic terrain with biomes.

    What happens if you had biomes stretched across both the X and Y access and they crossed over each other, if you see what I mean.

    Say I wanted the tiles all around the outside of the square to be going down in to the ocean, an island of sorts, but with lines of biomes criss-crossing each other along the Y and X axis...? Possible?
     
  30. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Using Mapmagic in Dark Mode on Linux Mint and found that the Menu is white on off-white. Very difficult to read... Can it be changed?
     

    Attached Files:

    Last edited: Aug 14, 2020
  31. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    @Wright I have updated to 2.0.6. Thanks for your hard work! Love this product.

    I still have a few issues with the microsplat compatibility:

    1. If I try to use more than 16 textures with the microsplat node (I have like 28 in my microsplat texture array), I get this error:

    Code (CSharp):
    1. Exception: Routine error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    2.   at MapMagic.Nodes.MatrixGenerators.CustomShaderOutput200+ApplyData.Apply (UnityEngine.Terrain terrain) [0x0009d] in C:\Users\jimmy\Documents\unity\projects\Native SD 2\Assets\Imports\MapMagic\Generators\Matrix\Runtime\TexturesOut.cs:400
    3.   at MapMagic.Nodes.MatrixGenerators.MicroSplatOutput200+ApplyData.Apply (UnityEngine.Terrain terrain) [0x00105] in C:\Users\jimmy\Documents\unity\projects\Native SD 2\Assets\Imports\MapMagic\Compatibility\Runtime\MicroSplatOutput.cs:115
    4.   at MapMagic.Terrains.TerrainTile.ApplyNow (MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x0003c] in C:\Users\jimmy\Documents\unity\projects\Native SD 2\Assets\Imports\MapMagic\Terrains\TerrainTile.cs:735
    5.   at MapMagic.Terrains.TerrainTile+<>c__DisplayClass39_0.<Generate>b__0 () [0x00000] in C:\Users\jimmy\Documents\unity\projects\Native SD 2\Assets\Imports\MapMagic\Terrains\TerrainTile.cs:709
    6.   at Den.Tools.Tasks.CoroutineManager.Update () [0x000f0] in C:\Users\jimmy\Documents\unity\projects\Native SD 2\Assets\Imports\MapMagic\Tools\ThreadManager\CoroutineManager.cs:136
    7. Den.Tools.Tasks.CoroutineManager.Update () (at Assets/Imports/MapMagic/Tools/ThreadManager/CoroutineManager.cs:137)
    8. MapMagic.Core.MapMagicObject.Update () (at Assets/Imports/MapMagic/Core/MapMagicObject.cs:141)
    9. MapMagic.Core.MapMagicObject.EditorUpdate () (at Assets/Imports/MapMagic/Core/MapMagicObject.cs:134)
    10. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    11. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    12. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    13. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    14. System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    15. System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    16. System.Delegate.DynamicInvoke (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    17. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <480b5a3bd3214ce5831f6dd8c68fdc55>:0)
    18.  
    I can fix this in the MicroSplatOutput.cs by adding more textures like this:

    Code (CSharp):
    1. var applyData = new ApplyData() {
    2.                 textureColors = colors,
    3.  
    4.                 // Fix IOOB exception by adding more texture names here.
    5.                 textureNames = new string[] {"_CustomControl0", "_CustomControl1", "_CustomControl2", "_CustomControl3",
    6.                     "_CustomControl4", "_CustomControl5", "_CustomControl6", "_CustomControl7"},
    7.  
    8.  
    9.                 textureFormat = TextureFormat.RGBA32,
    10.                 assignComponent = data.globals.assignComponent,
    11.                 propData = data.globals.microSplatPropData as MicroSplatPropData,
    12.             };
    2. If I try to pin a bunch of tiles, I eventually run into some kind of colored regions (see below - the west looks yellow and the north looks cyan/lightblue) that extend forever past that. Not sure if my 'fix' did this or if its some other type of bug.
    upload_2020-8-16_20-42-26.png


    And of course, just a reminder, I hope you review my changes eventually for adding the below feature for VSPro for maybe an upcoming version :)
    Just an FYI: I've been testing it for a few weeks now and its been working great! I made some performance enhancements that basically add only the packages a given terrain is using (by looking at the terrain masks generated). Really sped things up. I'll upload my results once I get it just right. Ill probably end up just creating a new type of VSProMaps Output node+editor that does everything.

    Summary:
    1. Added VSPro multi-package support
    2. Optimized texture mask writing to VSPro packages.
    3. Added a flag to disable rendering VSPro maps for draft tiles for when you have to pin a bunch of tiles.
    4. Added infinite terrain solution for VSPro
    https://forum.unity.com/conversations/map-magic-vspro-changes-i-made.558144/
     
    Last edited: Aug 18, 2020
  32. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Found one more issue when walking a FPS character from standard assets through a bunch of tiles...it seems to work initially but after some time I get this error:


    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. MapMagic.Core.MapMagicObject.get_PreviewData () (at Assets/Imports/MapMagic/Core/MapMagicObject.cs:194)
    3. MapMagic.Terrains.TerrainTile.StartGenerate (MapMagic.Nodes.Graph graph, System.Boolean generateMain, System.Boolean generateLod) (at Assets/Imports/MapMagic/Terrains/TerrainTile.cs:578)
    4. MapMagic.Core.MapMagicObject.StartGenerate (MapMagic.Terrains.TerrainTile tile, System.Boolean generateMain, System.Boolean generateLod) (at Assets/Imports/MapMagic/Core/MapMagicObject.cs:306)
    5. MapMagic.Terrains.TerrainTile.Dist (System.Single newRemoteness) (at Assets/Imports/MapMagic/Terrains/TerrainTile.cs:351)
    6. Den.Tools.TileManager`1[T].Deploy (Den.Tools.Coord[] camCoords, System.Collections.Generic.Dictionary`2[TKey,TValue] pinned, UnityEngine.MonoBehaviour holder) (at Assets/Imports/MapMagic/Tools/TileManager.cs:253)
    7. Den.Tools.TileManager`1[T].Update (UnityEngine.Vector3 tileSize, UnityEngine.MonoBehaviour holder, System.Boolean distsOnly) (at Assets/Imports/MapMagic/Tools/TileManager.cs:104)
    8. MapMagic.Core.MapMagicObject.Update () (at Assets/Imports/MapMagic/Core/MapMagicObject.cs:139)
     
  33. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I'm having those errors when I try to generate the world. It is not breaking the project and after a few click on generate the problem get solved by itself but I place the error here just in case.


    Code (CSharp):
    1. Thread failed: UnityEngine.UnityException: CreateScriptableObjectInstanceFromType can only be called from the main thread.
    2. Constructors and field initializers will be executed from the loading thread when loading a scene.
    3. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    4.  at (wrapper managed-to-native) UnityEngine.ScriptableObject.CreateScriptableObjectInstanceFromType(System.Type,bool)
    5.  at UnityEngine.ScriptableObject.CreateInstance (System.Type type) [0x00001] in <4cc8ec075538416496e5db5d391208ac>:0
    6.  at UnityEngine.ScriptableObject.CreateInstance[T] () [0x00001] in <4cc8ec075538416496e5db5d391208ac>:0
    7.  at MapMagic.Nodes.Graph.Create (MapMagic.Nodes.Graph src, System.Boolean inThread) [0x0001a] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:43
    8.  at MapMagic.Nodes.Biomes.Function200.GetSubGraph (MapMagic.Products.TileData parentData) [0x0002d] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Generators\Biomes\Runtime\Function.cs:129
    9.  at MapMagic.Nodes.Biomes.Function200.Generate (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00023] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Generators\Biomes\Runtime\Function.cs:185
    10.  at MapMagic.Nodes.Graph.GenerateRecursive (MapMagic.Nodes.Generator gen, MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00149] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:778
    11.  at MapMagic.Nodes.Graph.GenerateRecursive (MapMagic.Nodes.Generator gen, MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00077] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:757
    12.  at MapMagic.Nodes.Graph.GenerateRecursive (MapMagic.Nodes.Generator gen, MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00035] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:750
    13.  at MapMagic.Nodes.Graph.GenerateRecursive (MapMagic.Nodes.Generator gen, MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00035] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:750
    14.  at MapMagic.Nodes.Graph.GenerateRecursive (MapMagic.Nodes.Generator gen, MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00035] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:750
    15.  at MapMagic.Nodes.Graph.Generate (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00039] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:732
    16.  at MapMagic.Nodes.Graph.Generate (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00079] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Nodes\Graph.cs:737
    17.  at MapMagic.Terrains.TerrainTile.Generate (MapMagic.Nodes.Graph graph, MapMagic.Terrains.TerrainTile tile, MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x0004b] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Terrains\TerrainTile.cs:688
    18.  at MapMagic.Terrains.TerrainTile+<>c__DisplayClass36_0.<EnqueueTask>b__0 () [0x00000] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Terrains\TerrainTile.cs:598
    19.  at Den.Tools.Tasks.ThreadManager.TaskThreadAction (Den.Tools.Tasks.ThreadManager+Task task) [0x00000] in D:\Adventure\AdventureAlpha\Adventure\Assets\MapMagic\Tools\ThreadManager\ThreadManager.cs:133
    20. UnityEngine.Debug:LogError(Object)
    21. Den.Tools.Tasks.ThreadManager:TaskThreadAction(Task) (at Assets/MapMagic/Tools/ThreadManager/ThreadManager.cs:136)
    22. System.Threading.ThreadHelper:ThreadStart()
     
  34. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Thanks, don't worry is all good

    Fore me, it's not an easy work to convert project from MM1 to MM2. Personally I'd rather release it with MM1, which is still works. However I'll try to help you with that as I can. You can use mapMagicObject.graph.GeneratorsOfType<T> which will enumerate all generators of T, and you can assign their values here. It won't dive into biomes or functions, you've got to use graph.SubGraphs(recursively:true) to iterate them too.

    Thanks, I'm aware of this issue. Splines are still not finished, and there is still work to do and some bugs to fix.

    You can subscribe to static Action<TerrainTile, TileData, StopToken> TerrainTile.OnTileApplied to determine if some specific tile has been generated and applied, or to Action<MapMagicObject> TerrainTile.OnAllComplete that is called when all of the tiles are done. Depends on when you going to show loading mark - when MM generating terrain under player or while it will generate all the terrains like MM1.

    There was a suggestion on forums of how to avoid refreshing all of terrains. It's in my to-do list.

    So you are having bug here? Is the VS Pro demo scene working for you?

    Sorry, I've tried to wrap my head around your biome system, but it seems a bit complicated. Biomes are masked the same way terrain layers do - so if you can texture your terrain (maybe it's smaller copy on one tile) with the Texture Output, then you can use the same graph for masking biomes.

    Unfortunately I have no access to Linux, but I'll try to see what could be wrong there. I'll release a quick fix to let you see if it's changed, and maybe a series of quick fixes. If you don't mind, I'll be fixing it, and you do the testing :)

    Thanks!

    Seems to be MaterialPropertySerializer doesn't keep all of the textures. Try unpinning all the tiles and pinning them again. As an alternative solution you can try enabling SetComponent of MicroSplat Output (and assign the PropData) - it will be using MS component on all the terrains instead of MaterialPropertySerializer.

    Oh, I see your solution with texture names array. Yep, it seems to be the reason, I'll add more for the next version too. Or maybe make it generating on apply.

    Do I understand correctly that you are having more than 100 tiles? It's really a lot, and it might be some memory issue.

    Cool! Have not looked into it yet, but as you can see there are reports on VS Pro apply performance. I really appreciate your work, and will try to look into it as fast as I could.

    Just to find out what's it related with: have you used the preview tile selected with Select Preview button?

    Tanks for reporting this! Could you please email me your graph? I guess you are using the function nodes, so I'll need the function graphs too - and all the meta files.
     
    Duffer123 likes this.
  35. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    They actually still appear in a wierd color if I just pin a handful in those regions. I was just pointing out the colors in my screenshot.

    Ill post an update tonight because I made some changes yesterday.


    I have used it before, but not super recently?? I'll try it fresh again tonight.
     
  36. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    For the graph I used a backup to go before that problem, I think I did something wrong like entering 2 time the height data. Next time I will send you the graph via e-mail to be sure. Thanks!
     
  37. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Be glad to do some testing.
     
  38. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    My Custom VSPro Maps Node (Infinite streaming + multi-package support with optimizations) in Action:
    (Sorry about the video's lack of mouse cursor and no talking)


    Some screenshots of the node and results!
    emptyMpVsproMapsOutNode.png filledMpVsproMapsOutNode.png multipleVsproPackages.png

    @Wright I've updated my simple solution here as well (sorry for the constant bombarding of this topic, just excited to show it off!)
    https://forum.unity.com/conversations/map-magic-vspro-changes-i-made.558144/


    Enhanced MapMagic 2 VSProMaps node description:
    ---------------------------------------
    This new custom node: "MP VSP Maps" (mulit-package vegetation studio pro maps) allows the user to use any number of packages and writes texture masks to those packages for a given generated terrain.
    The basic idea was to copy a source vegetation studio pro system to each generated terrain and add only the packages and textures that are used to it.
    There are still some laggy spots as you will see when new terrain is generated but has been optimized in performance as much as I can do with MapMagic without getting into VegetationStudioPro code (which I have some ideas on how to optimize some things on that end as well which I will do later).
    The source VSPro system I use has around 20 packages and each package has around 5-20 models (Speedtrees, some AngryMesh Rocks, some ENTs ferns, and grass and flower billboards from TURBOSCALPEUR). I'm also using the Microsplat compatibility with Map Magic 2 with a texture array of around 30 textures.
    All considered this is a pretty reliable solution for truly infinite terrain using Vegetation Studio Pro + Map Magic 2.

    Unity Version: 2019.3.13f1
    Map Magic Version: 2.0.6
    Vegetation Studio Pro Version: 1.2.2
    Microsplat Version: 3.4801

    Code Changes:
    -------------
    I added three new files:
    StreamingVSProNodeSolution\MapMagic\Compatibility\VegetationStudio\MultiPackageVSProTile.cs
    StreamingVSProNodeSolution\MapMagic\Compatibility\VegetationStudio\MultiPackageVSProMapsOut.cs
    StreamingVSProNodeSolution\MapMagic\Compatibility\VegetationStudio\Editor\MultiPackageVSProMapsEditor.cs
    These files are similar to the VSProMaps files but with some radical changes.
    Finally, in StreamingVSProNodeSolution\MapMagic\Core\MapMagicObject.cs:
    I added a global variable to store the source VSPro tag name for these new nodes.

    To Use:
    ---------
    1. Add the code changes above.
    2. Add Vegetation Studio Pro to your scene's hierarchy.
    3. Find the VSPro game object with the 'Vegetation System Pro' script and tag it. For example: "Source VSPro"
    4. Add a new 'MP VSP Maps' node and select the tag your entered above and then add a package, texture mask name, and channel (like in VSProMaps).
     
  39. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    jimmygladfelter likes this.
  40. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    jimmygladfelter likes this.
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    @jimmygladfelter, I really appreciate your work! Can't wait to start implementing it! Will try to do this next week.
     
    SSL7, Kaen_SG and jimmygladfelter like this.
  42. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347

    Thanks for your replies, well I see I also have issues without the splines when using a raw image to create a map, it creates some abnormal terrain connection in some cases. Went back to MM1 for now since I'm in alpha. But that said, the locks are too useful and looking forward to move to MM2 soon :)
     
  43. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I would like to request a fix for the node previews resetting on load. I set nodes to be grayscale but they change back to false color on reopen.
     
    Wright likes this.
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I've fixed this or similar issue, but if it's still doesn't work then I might have missed something. Would you like me to look into this? If so could you please email me your graph (1), raw (2), imported raw asset (3) and scene where it happens (4)(along with their meta files) and the coordinates of the seam.

    Oh, it's really not saved. Adding to to-do list. Thanks for reporting that!

    I'm going to start working on 2.0.7 today, it will include fixes for the issues reported since previous release (that I will be able to reproduce and fix), and VSPro apply system suggested by jimmygladfelter. The thing that worries me the most is that MM doesn't generate infinite terrain in builds in some cases. I've got a couple reports about that, but could not get any details. If you have this issue - could you please check you've got native code disabled (C++ Native Code turned off in Window - MapMagic - Settings). If it is, and you still got this issue - email me your OS, build platform, unity version, scripting backend and API compatibility level (in project settings).
     
    Last edited: Aug 24, 2020
    Nunez-Torrijos and Duffer123 like this.
  45. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    Since I'm in heavy development right now and moved back to MM1, will get the next update that includes the VS Pro updates along with the fixes and do a retry to implement MM2, and if I still have issues will create a demo scene with the reproduced issues and send it :) Will send you the RAW though, and the scale was 16 on 1k terrains
     
    Last edited: Aug 24, 2020
    Duffer123 likes this.
  46. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    @Wright I posted some optimizations for @Lennart and Vegetation Studio Pro as well concerning caching models that keep having to be reloaded every time a new terrain is loaded (and a copied VSPro system is made for that terrain). So I made a way to cache all vegetation models for all packages referenced in the scene on startup of the game so it doesn't have to reinit any when new terrains are loaded. I made a quick video of my optimizations here:


    Here's a link to my updated VSPro code post to cache vegetation models:
    https://forum.unity.com/threads/released-vegetation-studio-pro.538451/page-24#post-6240542

    With optimized vegetation, it virtually gets rid of most lag when creating new terrains. FPS was also +10 when I wasnt recording my screen with Bandicam.

    I hope Lennart can maybe implement these changes as a nice solution for large world streaming systems and together with the custom node I made, should be a nice solution with Map Magic 2 + VSPro.
     
    Last edited: Aug 25, 2020
  47. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    Awesome news!!
     
  48. par-002

    par-002

    Joined:
    Jul 4, 2012
    Posts:
    52
    So I just started playing around w/ MM1/MM2 this past weekend and I think I have gotten quite far. I had purchased MM1 awhile ago, tried to get some things to work and figured I'd just go to MM2 as it seems as if that has more active development than MM1.

    TLDR; I cannot get MicroSplat to work with MM2. I followed all the steps from here (Custom-Shader is no longer there so I just used the MicroSplat node) and here (trying to follow him is tough!). Whenever I create the MicroSplat node in the graph the entire terrain goes dark. No matter what I do (other than deleting all MicroSplat items and specifically pointing the Terrain material to a known material) I cannot get the terrain to show any of the textures.

    The MicroSplat array is filled with all of the same textures used in the first video (the ones in MapMagic's demo folder). I followed those instructions doggedly.

    Here's a screen shot of my latest attempt. Any help would be wonderful :)

     
  49. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    If you are using any per-layer modifications in MicroSplat material (like UV Scale, Rotation, etc.) turn on Set Component and assign Propdata (asset file that should be created by MicroSplat next to material). This will assign unique MicroSplat component to each of the generated terrains. This might also help if you are doing any other deep MicroSplat material modification.
     
  50. par-002

    par-002

    Joined:
    Jul 4, 2012
    Posts:
    52
    I’m not doing anything different than what you did in the video. I did the Set Component and linked the prop file. I even set that advanced setting in the material to use custom splats.

    I feel I’m missing a step but not sure what because as you see in the screenshot the MicroSplat script is missing custom splat textures.

    Edit:

    Wondering if its because I'm using URP?
     
    Last edited: Aug 26, 2020