Search Unity

[RELEASED] MapMagic 2 - infinite procedural land generator

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

  1. RefactorDev

    RefactorDev

    Joined:
    Jul 10, 2018
    Posts:
    21
    Any ETA on the next update? :)
     
  2. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    189
    Hey @Wright,
    It seems like your email is not working properly. I sent you 3 emails with repro packages regarding some of the issues I reported but all the mails came back to me so far with the following error:
    Code (CSharp):
    1. The recipient server did not accept our requests to connect. Learn more at [URL]https://support.google.com/mail/answer/7720[/URL] [[URL='http://nomail.nic.ru/']nomail.nic.ru[/URL]. [URL='http://127.0.0.1/']127.0.0.1[/URL]: timed out]
    Where should I send the repro packages and details? One of them contains full MM2 source, so I did not want to post it publicly.
     
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    It's still might be stripping by Unity unless Instancing Variants below shaders list is switched to Keep All.

    Do you have any error in the console?
    Don't remember whether I've mentioned it or not, but native code should be disabled when building for WebGL (Windows - MapMagic - Settings - disable C++ Native Code).

    Thanks for sharing your ideas! Would be cool if you could outline these thoughts on the IdeaInformer.

    I've submitted version 2.0.5 on Fridaye, and currently it's pending the review. Here is what it brings:
    - Android build fix
    - RAW import 1 unit higher fix
    - Error on removing object asset fix
    - Disable Instant Generate fix
    - Values of the Stamp node can now be exposed
    - MM skips Shift-Space to maximize the window
    - Rotation bug when using terrain normal is fixed
    - Stamp node brush is now centered to object
    - For two outlets with the same name in function the warning will be displayed in function header
    - Regard/respect/use prefab scale fix
    - Don't destroy Texture2D on creating new tiles fix
    - The map can now be exported from Matrix Window with margins

    Thanks for letting me know! Oddly enough, I still get messages, but trying to write to myself failed. Will look into it ASAP.
     
  4. RefactorDev

    RefactorDev

    Joined:
    Jul 10, 2018
    Posts:
    21
    Does the fix include the thing with Main and Draft terrain not transforming correctly in playmode?
     
  5. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    The other day I was trying to find how to disable C++ and couldn't find it. You should probably make this information easy to find in the documentation.
     
  6. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    Hello @Wright I'm still stuck on this one:
    - Having a very hard time trying to get a road to follow the terrain height. Whenever I "flatten" the road it seems to use an average height, raising some areas. What cause a spline to do this rather than follow the changes in elevation?

    I tried to recreate the approach you show in the Splines demo, but it uses two pathfinders in the same graph and I'm not sure why. It also corrupted my scene terminally and I had to revert to an earlier one.

    any thoughts on what affects heights of spline would be helpful - feels like there's some part I'm missing.
     
  7. adriankml

    adriankml

    Joined:
    Apr 11, 2020
    Posts:
    8
    No errors are coming up in the console which is weird and disabling C++ Native Code doesn't seem to work.
     
  8. Gerark87

    Gerark87

    Joined:
    Feb 2, 2013
    Posts:
    6
    Hi! First of all, MM2 is awesome!

    Are there any utilities in code to access to the Terrain tile when the game is running?
     
  9. Drahtzieher02

    Drahtzieher02

    Joined:
    Oct 4, 2018
    Posts:
    2
    Hey,

    I'm new to MM 2, just using it for two days now. I also do not have experience with MM1. I tried to build my own map generator along routes. So the spline plugin in MM2 came in handy. I have an existing software using spline tools, so applying the data from external source to your MM2 splines is necessary. For my first trial i tried it with the PathCreator spline tool from the Unity Asset store, created points along the spline and filled MM2 spline through the Positions200 Generator.

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using System.Linq;
    3.  
    4. using MapMagic.Core;
    5. using MapMagic.Nodes.ObjectsGenerators;
    6.  
    7. using PathCreation;
    8.  
    9. using UnityEngine;
    10.  
    11. [RequireComponent(typeof(MapMagicObject))]
    12. public class CSplineMapMagic : MonoBehaviour
    13. {
    14.     [SerializeField]
    15.     private PathCreator m_splinePath;
    16.     [SerializeField, Range(1, 10)]
    17.     private int m_resolution = 1;
    18.  
    19.     private MapMagicObject m_mapMagicObject;
    20.  
    21.     // Start is called before the first frame update
    22.     private void Start()
    23.     {
    24.         m_mapMagicObject = GetComponent<MapMagicObject>();
    25.  
    26.         // Check for object references
    27.         if (m_mapMagicObject == null
    28.             || m_mapMagicObject.graph == null
    29.             || m_splinePath == null)
    30.         {
    31.             return;
    32.         }
    33.  
    34.         Positions200 positions = GetPositionsFromGraph();
    35.         positions.positions = GetSplineVertices().ToArray();
    36.  
    37.         m_mapMagicObject.Refresh();
    38.     }
    39.  
    40.     // Returns a List of Vector3 receiving every [resolution] point from the splinePath
    41.     private List<Vector3> GetSplineVertices()
    42.     {
    43.         List<Vector3> vectors = new List<Vector3>();
    44.         for (int i = 0; i < m_splinePath.path.localPoints.Length; i++)
    45.         {
    46.             if (i % m_resolution == 0)
    47.                 vectors.Add(m_splinePath.transform.TransformPoint(m_splinePath.path.localPoints[i]));
    48.         }
    49.         return vectors;
    50.     }
    51.  
    52.     // Returns the first Position200 generator from the graph. Only works stable for graphs with 1 Position200 generator.
    53.     private Positions200 GetPositionsFromGraph() => (Positions200)m_mapMagicObject.graph.generators.First(x => x.GetType() == typeof(Positions200));
    54. }
    55.  
    So far, so good. It is working. The Positions200 will be filled with the points from the spline tool, the spline interlink is connecting the points, optimizing, stamping and receiving the height information:



    Now, trying to insert trees. I tried to avoid setting trees on the path, so i added stroke, and a Mask, filtering the stroke data. The trees will also be drawn, BUT I get many errors:



    Trying it with Vegetation Studio Pro results in the same problems.

    Currently im using 2019.3.13f1, I also tried it with 2019.3.15f1 and 2020.2.0a13 on .NET 4.x.

    Do you have an idea, where all the errors come from?

    Meanwhile, the Scene looks like this:



    Best regards,
    Thomas
     

    Attached Files:

  10. ko0zi

    ko0zi

    Joined:
    Feb 27, 2017
    Posts:
    15
    Hey Denis, @Wright

    So I've been experimenting a little bit with MapMagic2 and I'm trying to get hold of the height data from a graph that has been generated. I've tried to look at the documentation but the MM1 way is obviously deprecated or non existent in MM2.

    I'm making a preview feature from a Main Menu in the game and want to just display a Texture2D of the generated heightmap whenever the player has entered a new seed and clicks a preview button.

    Right now I just have a dummy terrain and a mapmagic object in the scene with a callback on TerrainTile.OnAllComplete and then I just get the heights from the Unity terrainData, but I recon that it would be a lot faster if I could just skip the dummy terrain and get the heights from MapMagic directly.

    Would appreciate if you could give me some hints, I just cant wrap my head around all the mapmagic code right now.. :)

    Also I've noticed that mapmagic applies incorrect height values on tall mountains in my graph. I dont know if I'm making something wrong in my graph but the height info there seems to be missing or 0. You can see it here in some exported heightmap data from the unity terrains that mapmagic has generated.





    This is also noticeable from the culling system in game when the camera is looking at some of the highest mountain tops. The polygons there are invisible / culled.
     
  11. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    If you are talking about #331 then yes, it's fixed.

    Yep, I'm going to add a doc of the whole Compatibility window soon.

    It's hard to say for sure without a screenshot, but looks like a tangents issue - in cases where the spline doing up very steep and then sharply becomes horizontal - in this case it's tangent is facing up, and spline followed by it could raise above the terrain a bit.

    I could reproduce this issue. Will try to fix it for the next version, but can't promise that. Have no idea yet why it happens, so I might perform a refund if WebGL build is crucial for you.

    Thanks!
    Depends on what exactly you are trying to do. 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.
    I've never encountered such an issue. Could you email me the graph so I could reproduce it?

    Are you sure you are not exceeding maximum terrain value (1) on these points?

    The best solution would be writing a custom height output, but I'm afraid this will be very complicated. So I'd like to recommend using a standard custom node that only receives Matrix (you can take Contrast200 as a reference) and stores it in some static variable. You can't create a texture right in a custom node since it runs not in a main thread. Once the preview texture is needed in a main thread you can convert matrix from static variable to texture with matrix.ExportTexture.
     
    camta005 likes this.
  12. ko0zi

    ko0zi

    Joined:
    Feb 27, 2017
    Posts:
    15
    Nope this is probably the case, I didnt know 1 could be exceeded by MM, thanks, I'll look into that :)

    Alright I see, thank you very much for the quick reply! Will try this approach :)
     
  13. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    New version 2.0.5 is available at the Asset Store. Here is what it brings:
    - Android build fix
    - RAW import 1 unit higher fix
    - Error on removing object asset fix
    - Disable Instant Generate fix
    - Values of the Stamp node can now be exposed
    - MM skips Shift-Space to maximize the window
    - Rotation bug when using terrain normal is fixed
    - Stamp node brush is now centered to object
    - For two outlets with the same name in function the warning will be displayed in function header
    - Regard/respect/use prefab scale fix
    - Don't destroy Texture2D on creating new tiles fix
    - The map can now be exported from Matrix Window with margins

    Don't forget to update modules as well!
     
  14. mbussidk

    mbussidk

    Joined:
    May 9, 2017
    Posts:
    59
    HI @Wright I'm having issues with MicroSplat. The demo scene works, but every time I try to create a new MS material I get a constant stream of these errors:
     

    Attached Files:

  15. mbussidk

    mbussidk

    Joined:
    May 9, 2017
    Posts:
    59
    This is with any combination of MS textures. Even recreating from scratch the setup of the demo scene throws these errors
     
  16. adriankml

    adriankml

    Joined:
    Apr 11, 2020
    Posts:
    8
    Yeah WebGL is the platform I'm hoping to target but I'm happy to wait for a bit if you think you can figure it out.
     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    MicroSplat was updated yesterday. Might be changed something that causes this error. I'm already downloading the new version to look into it.

    Glad to hear that! However still don't have a clue why this happens.
     
  18. RefactorDev

    RefactorDev

    Joined:
    Jul 10, 2018
    Posts:
    21
    upload_2020-6-16_23-34-34.png

    Bug isn't fixed. I made a new terrain with basic Noise->Height map and made them draft terrains. When I disable draft on playmode (hoping it would become main terrain) and it remains draft terrain.
     
  19. mbussidk

    mbussidk

    Joined:
    May 9, 2017
    Posts:
    59
    Hi @Wright question on the Splines module: is there a way to get the spline points? I would be happy with a dump on the console
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    You've got Generate Infinite Terrain disabled, and no generate marker selected. Since you turned off generate MM isn't generating main chunks, leaving the scene as it is. It's an expected behavior. You can either generate infinite terrain, or do not generate anything. There is no way to make some tiles or tile detail levels to be generated.

    If you just want to log them in console you can use some testing node for that:
    Code (CSharp):
    1.     [System.Serializable]
    2.     [GeneratorMenu (menu="Spline/Test", name ="Log Nodes")]
    3.     public class LogNodes : Generator, IInlet<SplineSys>
    4.     {
    5.         public override void Generate (TileData data, StopToken stop)
    6.         {
    7.             SplineSys src = data.products.ReadInlet(this);
    8.             if (src == null) return;
    9.            
    10.             if (stop!=null && stop.stop) return;
    11.             string nodePositions = "Node Positions: ";
    12.  
    13.             for (int l=0; l<src.lines.Length; l++)
    14.             {
    15.                 Line line = src.lines[l];
    16.  
    17.                 nodePositions += $"\n   Line {l}: ";
    18.  
    19.                 for (int s=0; s<line.segments.Length; s++)
    20.                     nodePositions += $"{line.segments[s].start.pos}, ";
    21.  
    22.                 nodePositions += $"{line.segments[line.segments.Length-1].end.pos};";
    23.             }
    24.  
    25.             Debug.Log(nodePositions);
    26.         }
    27.     }
    You can also populate lists the same way.
     
  21. RefactorDev

    RefactorDev

    Joined:
    Jul 10, 2018
    Posts:
    21

    No I was thinking that it was possible to have Draft mode terrain is just the editor while coding and messing around with it but then in play mode it would change the draft ones to main mode
     
  22. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    89
    Hey everyone,

    having some issues with this. The tool itself works absolutely wonderful, however the microsplat node causes it to keep infinitely loading. So I thought I'd try CTS (had that already), doesn't work properly either. Now I prefer Microsplat anyway, so removed CTS... unfortunately that causes issues after having it installed once as well. Any tips on how to get rid of this error?
    And how to get Microsplat working?

    Assets\MapMagic\Compatibility\Runtime\CTSOutput.cs(88,11): error CS0246: The type or namespace name 'CTSProfile' could not be found (are you missing a using directive or an assembly reference?)
     
  23. baddiego

    baddiego

    Joined:
    Jan 21, 2018
    Posts:
    6
    I do not own CTS so I don't know much about it, but microsplat sets a define switch when you add it to your project. Maybe CTS does the same. You can check in the project settings (edit->project settings), there is a comma separated line with defines that lists all for your project. When you delete an asset, the define often remains set which may confuse assets. Maybe the problem will be gone if you remove the define from the line (and possibly re-load the project).
     
  24. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    304
    What bit depth does the Imported Map asset use for textures? I have identical 16-bit RAW and PNG files but they are producing different results.

    EDIT:
    Sorry, my mistake. The PNG texture was set to POT (power-of-two) on the import dialogue but it's 513x513. Changing it to NPOT made it match up again.
     
    Last edited: Jun 20, 2020
  25. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    304
    A few questions.

    1. Can I change the Imported Map asset texture/raw source at runtime?
    2. Can I change the seed at runtime, both global and node?
    3. I'm going through the MapMagic namespaces but it's not clear what I have access to. Do you have further docs regarding scripting?
     
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    You can add an idea to IdeaInformer, I consider implementing every idea that gets enough votes.

    You've got to disable CTS compatibility in Window - MapMagic - Settings.
    If this window is not accessible then remove the CTS_PRESENT keyword from Edit - Project Settings - Player - Scripting Define Symbols.

    If you reproduce MicroSplat infinite loading then could you email me scene+graph?

    PNG is using only 8 bits per channel - it's the texture limitation, not MM one. It would be still slightly different to 16 bit RAW - mainly because of the "stairs" effect. I'd recommend using RAW maps for heightmaps, while textures for various masks.

    Unfortunately no.

    You can, but you'll have to re-generate already existing tiles - otherwise they will not weld with new ones properly.

    I plan to add docs on how to create custom generators or use tile events, but it won't be a comprehensive code guide. I'm not going to change members exposed as public, so feel free to use them.
     
  27. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    89
    Awesome that worked thank you. Stupid that I didn't think of checking a setting like that.

    I've send the email regarding MicroSplat :) a fresh instal of microsplat + map magic 2 still yielded the same results.
     
  28. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi @Wright, I'm trying to set up RTP in MapMagic2.
    I installed MapMagic2, I installed RTP, and the special generator for RTP says RTP is not installed or compatibility is disabled.
    When I go to Window>MapMagic>Settings, there are options to activate CTS, Micro and Mega Splat, and Vegetation Studio Pro, but no trace of RTP.
    I checked these videos on youtube on how to setup RTP in MapMagic 1


    but the generators have features that are not present in MapMagic2.
    I also tried putting ReliefTerrain.cs into the MapMagic GameObject, and then pressing "reset layer numeric params to default". This created the _RTP_LODmanager GameObject under the MapMagic GameObject, but still the RTP generator in MapMagic says RTP is not installed...

    Some step-by-step instructions would be greatly appreciated.
     
  29. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    304
    After extensive testing with a pure linear gradient, I can confirm that PNG is indeed 16 bit if the source is grayscale, imported as R16, and Red channel is chosen in the Imported Map inspector. It's identical to the 16 bit RAW, and both produce a smooth slope. An 8 bit PNG produces a stair-stepped slope, as expected.

    This is good news and if you can confirm it, would mean another option for using external heightmaps.
     
  30. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    Somehow RTP is not exposed in the settings window. This is a bug, and will be fixed for the next version. You can enable compatibility manually by adding RTP keyword in Edit -> Project Settings -> Player -> Scripting Define Symbols.

    Yes, PNG really has a 16 bit support, and Unity can read it as a 16-bit R texture.This way it's really possible to have 16 bit heightmaps from textures with no stairs look, so I was wrong about it.
     
    Nunez-Torrijos likes this.
  31. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    I wrote down the keyword, but it didn't work, it throws many errors. I tried closing Unity and starting it again, only to find lots of errors regarding VS Pro, and the following error about RTP:
    Assets\MapMagic\Generators\Matrix\Runtime\TexturesOut.cs(465,11): error CS0246: The type or namespace name 'ReliefTerrain' could not be found (are you missing a using directive or an assembly reference?)
    This error even causes the MapMagicObject Script to not show, and i cannot interact with my mapmagic generators.
    So, I guess I'm uninstalling RTP, and waiting for the next update... I'm going to try with VS Pro again...
     
  32. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    I got some trouble with Masks...
    In MM1, there was a Mask Generator and an Invert generator. Furthermore, there was a Mask input in the Noise generators...
    In MM2 there is a Mask generator, but at least in my case it doesn't work... I thought I might be doing something wrong, so I went to the manual and the wiki, and realized there is no support for that generator in the Manual, and no support in the wiki.
    So to make masks, I'm currently using the Unity Curve generator, which thankfully has a Mask Input.
    Is somebody else having issues with the mask generator?
    Will the Noise Generator have a mask input in future releases?
    Is the Mask generator going to disappear, implementing masks as input parameters in other generators?
     
  33. SigmaVulcan

    SigmaVulcan

    Joined:
    Jun 11, 2015
    Posts:
    3
    upload_2020-6-23_21-51-35.png

    When I am opening any Graph I don't get the UserInterface-Colors that I see on every screenshot. The header background of every single node is light grey while the header text is white. This really forces me to go very close to the display and using it over a longer period of time makes it very tiring. Furthermore the group background is not changing its color even when selected by using your color dropdown menu.

    I am using your SimpleGraph which comes with the asset. Also I am using macOS as my operating System (latest version) with the 2019.4.0f1 version of Unity with the latest version of you MapMagic2 pack with all extension packs.

    I would be really glad if you could provide me with a solution, even if it is just a temporary fix.
     
  34. SigmaVulcan

    SigmaVulcan

    Joined:
    Jun 11, 2015
    Posts:
    3
    Also when I use your URP Example I get these weird artefacts:
    I figured out a way to remove the artefacts temporary: Deactivate draft and activate it again on a Tile within the TerrainTile script. Also just deactivating "Base Map Distance" on the Map Magic Object removes these artefacts. Maybe this gives you some idea, where this is coming from.

    upload_2020-6-24_1-4-15.png
     
    Last edited: Jun 24, 2020
  35. mrnas

    mrnas

    Joined:
    Jan 13, 2018
    Posts:
    14
    Hi!

    I am having a Problem with the Infinite Terrain Generation when i build the game. In Editor Playmode it works fine, but the built version only has a single Tile.

    Any hints on what could cause this?


    Edit: Nevermind, i got it to work!


    The Problem was that i was compiling a x86 build. In the Error log i discovered, that MapMagic produced Errors due to 64 bit dlls.
    So i switched to x86_64 Architecture in Build Settings, now it works :cool:
     
    Last edited: Jun 24, 2020
    malditonuke likes this.
  36. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi again,
    In MM1 I usually set my water level at Y=0, so I usually position my MapMagic Object at Y=-50, for example. I work with big maps, so I also set the overall map height at 3000.
    The problem is, it was quite complicated to get Vegetation Studio going, I managed to do it, but the VSPro object generator does not account for the position of the mapmagic object, hence, my trees are floating. If I move the Mapmagic object to Y=0, it looks ok, but if I place the MM Object at Y=5, my trees are half below ground... I tried with and without the Floor generator, and it doesn't work.
    This doesn't happen with the normal MM2 object placer. Stuff is placed in the surface no matter the Y level of the MM object.
    I could set the MM object to Y=0, but that would ruin other things I have that count with a water level at zero...
    Is there a way to approach/fix this?
     
  37. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    Yep, I could reproduce the issue, and going to fix it for the next version. Thanks for reporting it!

    Inputs from the initial generators were removed to prevent confusion. The thing they did was just blending generated noise/voronoi/etc pattern with the map provided in Input or Mask. Input blended the map additive, while Mask multiplied generated pattern. Now the initial nodes generate pattern, and Blend node blends the generated result. Here is the setup similar to the Mask input in MM1:
    InitialMask.jpg

    I've got a couple of reports about this issue, but still have no clue why this happens. I know it happens on macs with 4k displays, but only on some of them. Still I cannot reproduce it. I will gladly try to find out why it happens, but I need your help to find out what happens. Could you please email me your mac configuration, and I guess I will have to ask you to test some code changes that might solve this?

    This one looks like a videocard issue - basemap is generated on GPU, and there's something wrong went while it's generating. Headings colors could be related with it too, since they are rendered with shaders. But it's just a guess.

    If anyone else got these issues:
    please contact me.

    Yes, can see this issue. Going to fix it for the next version.
     
    Nunez-Torrijos likes this.
  38. Refeas

    Refeas

    Joined:
    Nov 8, 2016
    Posts:
    189
    Hey @Wright,
    I finally got to making a build of our project and discovered that native Noise code (C++) crashes the standalone IL2CPP build. Turning off the Native code in MM settings window gets rid of the crashes.
    I logged the issue here: http://mm2.idea.informer.com/proj/?ia=133873

    Please let me know if you need further help reproducing it. Thanks!
     
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    IL2CPP produces the same category C++ code, that works with about the same performance. So there's no need to use Native code when building with IL2CPP. However it should not crash anything, at least as I see it now, so I'll look into this issue. Don't promise to fix it as it might be something incompatible between native MM's code and IL2CPP, but at least will try.
     
  40. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    304
    I'm using an orthographic camera and I see vertical lines in the terrain. I've seen this before with other terrain generators. I tried adding turbulence to the Noise node but it had no effect. Any suggestions to defeat this?

    terrain.jpg
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    Try using the simplex noise (Noise node - Type - Simplex), it's using hexagonal grid instead of square one.

    Some lines might be related with the texture tiling. Try using more uniform textures instead (especially the BrightCliff).
     
    JohnnyFactor likes this.
  42. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi everyone, some things I discovered while setting up Vegetation Studio Pro.
    • Don't forget to register all your cameras in VSPro, or you won't see trees in runtime.
    • The option "Enable run-time spawn" needs to be turned off for trees, but turned on for grass.
    • If your VegetationPackage is tagged with a Biome different than "Default", "Desert" in my case, you can generate trees, but the grass won't work. I guess this probably has to do with the VSPro biome system. If I tag my VegPack as "Desert", but there is no Desert biome delimited with VSPro, it won't generate, it only generates "Default". Although this seems reasonable in retrospective, it took me quite some time to realize this.
    • I generated grass using Texture Masks rules. The Red channel works ok in the editor, but for some reason the Green, Blue and Alpha throw an error that stops the terrains from generating:
      • Thread failed: System.IndexOutOfRangeException: Index was outside the bounds of the array.
        at MapMagic.VegetationStudio.VSProMapsOut.Finalize (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x000f9] in D:\Dropbox\GameDev\Projects\NewProject\Assets\MapMagic\Compatibility\VegetationStudio\VSProMapsOut.cs:77
        at MapMagic.Nodes.Graph.Finalize (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00088] in D:\Dropbox\GameDev\Projects\NewProject\Assets\MapMagic\Nodes\Graph.cs:805
        at MapMagic.Terrains.TerrainTile.Generate (MapMagic.Nodes.Graph graph, MapMagic.Terrains.TerrainTile tile, MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x0007c] in D:\Dropbox\GameDev\Projects\NewProject\Assets\MapMagic\Terrains\TerrainTile.cs:689
        at MapMagic.Terrains.TerrainTile+<>c__DisplayClass37_1.<StopEnqueueTask>b__0 () [0x00000] in D:\Dropbox\GameDev\Projects\NewProject\Assets\MapMagic\Terrains\TerrainTile.cs:641
        at Den.Tools.Tasks.ThreadManager.TaskThreadAction (Den.Tools.Tasks.ThreadManager+Task task) [0x00002] in D:\Dropbox\GameDev\Projects\NewProject\Assets\MapMagic\Tools\ThreadManager\ThreadManager.cs:133
        UnityEngine.Debug:LogError(Object)
        Den.Tools.Tasks.ThreadManager:TaskThreadAction(Task) (at Assets/MapMagic/Tools/ThreadManager/ThreadManager.cs:136)
        System.Threading.ThreadHelper:ThreadStart()
    • I managed to generate grass, in the editor I see the grass, but the grass doesn't appear in run-time. I can see trees but no grass in the ground, and some weird pieces of grass in the sky.
    upload_2020-6-25_1-7-17.png

    Just to be clear, I'm using Unity 2019.3.15f1.

    During all my attempts I bumped into several errors both from the VSPro side, and from th e MM2 side. This broke my project a couple of times, so I had to start over new projects, and I had to close without saving to reverse some errors. Apparently, some of these errors were not "fixable", they kinda damaged the internal data keeping of either MM2 or VSPro.

    Regretfully, I was too focused in trying to make things work, so I didn't keep track of every single error and how to reproduce them exactly. One arised when I apparently did things in the wrong order. Unpinning terrains, or pinning new ones without updating the VSPro coverage, removing the vegPack generated errors when there were Generators referencing it on the MM2 side.
     
    hp01001 likes this.
  43. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    I just completed the tutorial Simple Graphs. When I added my own player prefab the frame rate dropped by 70-80 frames. Is MM2 really that heavy? Also, the blue regeneration bar (i think that what is called) at the top never fully completes and says it's ready. Is this normal when not in playmode? Also, it updates quite often during play mode. I say at least once every 2-3 seconds. When it does the frame rate drops another 10-15. Are these things related?
     
    Last edited: Jun 26, 2020
  44. malditonuke

    malditonuke

    Joined:
    Apr 15, 2017
    Posts:
    16
    MicroSplat stopped working right and I got hit with a stream of missing reference errors.

    The problem starts at line 399 of TexturesOut.cs
    Code (CSharp):
    1. if (tex==null || tex.width!=resolution || tex.height!=resolution || tex.format!=textureFormat)
    2.                     {
    3.                         #if UNITY_EDITOR
    4.                         if (!UnityEditor.AssetDatabase.Contains(tex))
    5.                         #endif
    6.                             GameObject.DestroyImmediate(tex);
    7.                            
    8.                         tex = new Texture2D(resolution, resolution, textureFormat, false, true);
    9.                         tex.wrapMode = TextureWrapMode.Mirror; //to avoid border seams
    10.                         //tex.hideFlags = HideFlags.DontSave;
    11.                         //tex.filterMode = FilterMode.Point;
    12.  
    13.                         matPropSerializer.SetTexture(textureNames[i], tex);
    14.                     }
    I replaced with:
    Code (CSharp):
    1. bool badTex = false;
    2.                     if (tex == null) {
    3.                         badTex = true;
    4.                     }
    5.                     else if (tex.width != resolution || tex.height != resolution || tex.format != textureFormat)
    6.                     {
    7.                         badTex = true;
    8.  
    9.                         #if UNITY_EDITOR
    10.                         if (!UnityEditor.AssetDatabase.Contains(tex))
    11.                         #endif
    12.                         GameObject.DestroyImmediate(tex);
    13.                     }
    14.                     if (badTex == true)
    15.                     {
    16.                         tex = new Texture2D(resolution, resolution, textureFormat, false, true);
    17.                         tex.wrapMode = TextureWrapMode.Mirror; //to avoid border seams
    18.                                                                //tex.hideFlags = HideFlags.DontSave;
    19.                                                                //tex.filterMode = FilterMode.Point;
    20.  
    21.                         matPropSerializer.SetTexture(textureNames[i], tex);
    22.                     }
    No more errors and MicroSplat is working. Hopefully the dev can check this out soon.
     
    p87 likes this.
  45. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    Added those two to bug list, thanks! Feel free to inform me about the others if you encounter them once again.

    Does the flying grass issue happen in a demo scene?

    You might have an error in the console. If it's so, could you please email me your graph so I could look into it?

    I guess what the issue is - the texture was removed before the destroy. Adding to bug list, thanks!
     
    p87 and malditonuke like this.
  46. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi Denis,

    Some comments:
    1. When you try to remove a generator, it sometimes asks you to confirm, and it gives you two options: "Clear" and "Keep". However, if you press clear, it doesn't remove the generator, and if you press Keep, the generator is removed...
    2. Some Generators do not allow you to expose a variable when you are making a Function. In Scatter, you can, but in Selector or Objects, you can't.
     
    malditonuke likes this.
  47. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi everyone,

    I suspect that certain Starter Generators may be responsible for an artifact that makes your terrain look jagged like this:

    upload_2020-6-29_12-15-40.png

    In this case I used Simple Form, and then Stamp, and I used a huge Size in the Stamp generator. I suspect this made the underlaying texture become "pixelated". However, this has also happened to me with Unity Noise and Simplex Noise.
    I found a workaround that sometimes works: using the Blur Generator after the generator that's causing the issue. Below you can find the same tract of land as before, but with a Blur generator afterwards.

    upload_2020-6-29_12-16-25.png

    This may be related with the issue that @JohnnyFactor identified in [RELEASED] MapMagic 2 - infinite procedural land generator.

    @Wright, if you decide to include some kind of softening coupled with increased scale in future releases, please let us know, since this may turn my Blur generators redundant, losing terrain detail.
     
  48. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,026
    When removing an output generator, it will suggest you to remove the data it generated as well - trees output can clear the trees, grass output - the grass, etc. You can chose whether you want to remove that data or keep it.
    Don't know why the generator remains on pressing Clear, will look into it.

    Thanks for notifying it! Will fix it for the Selector, however not sure about objects output.

    This could happen when using Unity Noise on a distant chunks (over 10000 units), but should not happen with other noise types. It definitely looks like a bug, it should be fixed instead of masking it with Blur. Could you please email me the graph and the scene with the artifact tile pinned?
     
  49. malditonuke

    malditonuke

    Joined:
    Apr 15, 2017
    Posts:
    16
    When I added an Object output generator to my graph, the map wouldn't generate and I got the following error:

    InvalidOperationException: Destroying a GameObject inside a Prefab instance is not allowed.
    Den.Tools.ObjectsPool+Pool.Clear () (at Assets/MapMagic/Tools/ObjectsPool.cs:226)
    Den.Tools.ObjectsPool.SetPrototypes (Den.Tools.ObjectsPool+Prototype[] prototypes) (at Assets/MapMagic/Tools/ObjectsPool.cs:251)
    Den.Tools.ObjectsPool+<RepositionRoutine>d__6.MoveNext () (at Assets/MapMagic/Tools/ObjectsPool.cs:326)
    MapMagic.Nodes.ObjectsGenerators.ObjectsOutput+ApplyObjectsData+<ApplyRoutine>d__4.MoveNext () (at Assets/MapMagic/Generators/Objects/Runtime/ObjectsOut.cs:258)
    MapMagic.Terrains.TerrainTile+<ApplyRoutine>d__41.MoveNext () (at Assets/MapMagic/Terrains/TerrainTile.cs:779)
    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)


    The problem is that I deleted an asset that the pinned map had already generated in the object pool (so the tile object pool had a bunch of missing prefabs). When I manually deleted the missing prefabs from the object pool, the problem was fixed. So it looks like the Clear method in ObjectsPool.cs needs to check for missing prefabs first.
     
  50. malditonuke

    malditonuke

    Joined:
    Apr 15, 2017
    Posts:
    16
    I had the same problem, and then I noticed that I had missing prefabs in the object pool of my pinned tile. When I manually deleted the missing prefabs from the object pool, "Clear" started working again. It's probably tied to the problem with the Clear method in ObjectPool.cs not checking for missing prefabs.
     
unityunity