Search Unity

Map Magic World Generator - a node based procedural and infinite game map tool

Discussion in 'Assets and Asset Store' started by Wright, Mar 10, 2016.

  1. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Has anyone reported an issue about that? :)
    This can make it visible both to me and Elroy

    It should. But you can't say for sure with a custom code. I don't even know where this code is inserted - maybe it happens after welding?
     
  2. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    That is just a custom generator using LegacyFractal noise, so prior to welding I think?

    I've been posting on Elroy's git, I'll start an issue on yours too Denis. Would be great if there are any fixes on your end! I've been assuming it's on Elroy's end.
     
  3. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    190
    is there any example / demo how we can make a map tile onto the MapMagic Terrain?
     
    The_Uber_Rasta likes this.
  4. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    I discussed it with Elroy in the uNature thread, but I didn't create an issue. I assumed it was a uNature issue, not a MapMagic issue. I'll create an issue if the next release of uNature doesn't fix the problems.
     
  5. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    You don't need MM specific example. MM outputs standard Unity terrain so you just need to figure out how to draw on top of that. I know there are assets available on AS for just that.
     
    Dwight_Everhart likes this.
  6. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi,

    I'm using your generator in combination with MegaSplat. So I uses the MegaSplat node for textures. The problem is, that the terrain shader is not anymore changable. The terrain shader created by MegaSplat is not anymore referenced to the terrain, instead it seems to be a copy of this shader is on the terrain. If I double click on the shader, which is on the terrain, then the changes are visible, so I can control the shader, but after non of the values are saved. If I change the shader asset, which was created by MegaSplat, then I see no changes on the terrain, but after "Force generate all" the changes will be applied to the shader copy on the terrain.

    It seems to be, that every time after clicking on "Force generate all" on the MapMagic script attached shader will be cloned to the terrain. The trouble is in this, that I cannot see the changes, if I modify the shader properties.
     
  7. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Do you mean material? I guess you are talking not about shader. Yes, MapMagic assigns individual material to all of the terrain chunks since they need an individual control textures (looking ahead, MaterialPropertyBlock could not be used since it's changes are not serialized for terrains).
    I've got a request to make the analog of InstantUpdater (that is used for RTP output) to work with MapMagic, and I'm going to make it in 1.8.3

    Diego_Graphics, MapMagic uses the standard Unity terrains internally, so if the grid asset is compatible with the standard terrains then it should be compatible with MapMagic
     
    Dwight_Everhart likes this.
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    So, in MegaSplat 1.14 I've added a new component that allows multiple terrains to share and sync a material. When you change a property on the original material asset, it syncs across all of the terrains, and the materials on the terrains are no longer available for edit. This makes working with many terrains much nicer, though I haven't tried this with the MM workflow yet. (If you'd like an early copy, send me a message w/ invoice and I'll send it over). I will test with MM before release and make sure it doesn't cause any issue, but having MM work with it might help smooth the whole process.
     
    Dwight_Everhart and malkere like this.
  9. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, @Wright
    I got an issue when trying to use mapmagic's object generators to place object trees:
    upload_2017-7-1_18-15-13.png

    I planted terrain trees on unity terrain (so they can be batched together by unity terrain's shader to save pass calls) , and need to use every tree's transform info to place other prefab trees with exactly the same transforms (the prefab tree is the same model as the terrain tree but has growing and fruiting scripts on it).
    So I used the same node to link into a Tree output and an object output for these two prefabs.
    But I got a very strange result:
    upload_2017-7-1_18-21-16.png
    The selected trees are object trees, they all have different Y rotation bias with their terrain tree twin. But the locations and scales are precise.
    This is causing quite a pain in my ass :/ any ideas why is the same node can output different data, and how to fix it?
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    I don't quite get it why are you trying to make trees overlap objects, but anyways...

    Note that those trees that could be batched by Unity terrain could not be rotated. I guess all of the trees rotation is zero. It's not MM limitation, but Unity one. Try placing those trees manually just in test purpose - guess they do not have a "Random tree rotation" value in tree settings.
     
    Last edited: Jul 1, 2017
  11. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    They actually have random tree rotation in unity terrain's trees settings, but that's not the case, I'm not using unity terrain's tree brush to place trees. I use MM's Trees output node to place trees.
    What's confusing me is that the adjust node clearly has effects on the results, but the Tree output node and the object output node seems to read Y axis rotation differently, the same data sending to trees output and object output then different results.
    And I'm not overlapping trees, but a fruit pool preset to allow terrain trees grow fruits ( say let coconut tree grow green coconuts overtime), but terrain trees cannot execute scripts so I put an empty object for each fruitable tree with fruit's locations and growing scripts on it. But this also requires that I must put this fruit object has the exact transform with the terrain tree.
    Now I can only disable all fruitable trees' rotation on the output nodes to make them only facing the original side.
    upload_2017-7-1_19-50-50.png upload_2017-7-1_19-50-35.png
     
  12. zef_tutounityfr

    zef_tutounityfr

    Joined:
    Jun 6, 2014
    Posts:
    16
    Hi everyone, quick question about trees / forest with Voxeland and MapMagic. I don't really know if I should post this on MM topic or the Voxeland one.

    I followed Denis' tutorial to integrate MM with Voxeland, I now have my terrain based on the video's one. I managed to add trees on a MapMagic map but I can't find how to add trees on Voxeland terrain based on the MM plugin. It's a bit hard to explain.

    EDIT : Found a solution, pretty sure it's not well optimised but here is my editor. With this configuration trees are spawning on the Voxeland terrain based on MM :

     
    Last edited: Jul 1, 2017
  13. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Harekelas, I've got your point, using fruit prefabs along with the trees objects must be a good idea.

    MM reads Y rotation similarly both for trees and objects outputs. But the thing is that Unity cannot display the rotated trees. Here is the issue on Unity issue tracker.

    If you will try using the trees with the LOD Group properly set up Unity will not consider them as "impostor" billboard trees, and this way they could be rotated. So, if you replace your trees with the ones that have properly set LODs you will notice that they are actually rotating - but it will not give you any performance gain considered to standard prefabs.

    _Diios, Trees Output works only with standard Unity terrains. The only way to place trees using Voxeland is to use trees as a Voxeland objects. You need to create a tree Object Block (you can see DemoScene for an example) and and use VoxelandObject Output in your graph.
     
  14. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    PS here are the instructions to make UNature work with MapMagic (on MM FAQ page).
     
  15. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    @Wright First, let me thank you again for creating such an extraordinary asset. My game would not be possible without it. Amazing work!

    However, an issue we discussed earlier is affecting my game again. We talked about how mixing biomes affects the final height map of the terrain, causing objects like trees to be placed under the ocean and causing the results of the shoreline generator to be warped, so the shoreline is no longer at sea level. I've worked around the tree issue with a script that removes underwater trees, and I can live without a nice shoreline for now, but I've run into a new issue that has nothing to do with being near the ocean.

    I'm using the puddle input of the MegaSplat output node to place shallow water in areas that have a slope of < 5 degrees. However, in areas where two biomes mix, the puddles can end up on hills, which looks rather odd for water that isn't flowing.

    CastleKingdoms-201706291158354505.png

    The problem, of course, is caused because the terrain is flat in the biome that is generating the puddles, but the final terrain is adjusted into a hill when the two biomes are mixed.

    I'm not asking for an immediate solution. I understand this is a hard problem that is caused by the way MapMagic generates biomes independently of each other and then mixes the results. I'd just like you to consider how this problem may be solved in a future release, perhaps when you need to do some redesign.

    Perhaps the final height map can be an output of the Biome nodes, or perhaps you could add a way to specify if a node should be evaluated before or after biomes are mixed. The later solution would be more elegant from my perspective as a designer, because I could keep everything related to a biome in one graph, yet I could apply nodes that would be affected by biome mixing after the mixing is done.

    For now, I've worked around the problem by making the puddles small, so they don't look too bad when they wind up on hills. But I'm sure I will run into this issue for other features I need to place in my biomes, and I imagine other designers will too.
     
  16. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    @Wright
    Hey, thanks for the tips, I set the LOD groups correctly, and the trees planted on terrains can rotate.
    It's only seems the rotated angle is different from the MM node outputs.
    They all have a different angle offset from the original Y rotation value.
    Maybe it's some settings about the unity terrain that will rotate the trees planted from MM once more. I'll tinker around to see if I can bypass this.
     
  17. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    This is an old biomes issue, I just quit using biomes, and create all biomes in one graph. Blend all heights together as a final height.
    Also the biome areas can be generated through noise and heights, then I send them to a portal to use them in textures and tree planting with the final height's data.
     
    Dwight_Everhart and malkere like this.
  18. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Interesting approach, but I like the results I'm getting with MapMagic's biomes, except for the few edge cases I'm encountering. I also like having multiple graphs. They reduce clutter and allow multiple designers to work on different biomes at the same time without fear of conflicts. I'll keep your approach in mind, though. Thanks.
     
  19. reocwolf

    reocwolf

    Joined:
    Aug 1, 2013
    Posts:
    182
    Why can't you create 4 islands with one single instance? It's infinite terrain.
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Actually, there is a way to do it now. The thing is that MapMagic generates the main graphs first, and all of the biomes after. So, if you will add an output node to the main graph it will be generated before the biomes.

    Since MapMagic generates an infinite terrain, using 4 instances of MapMagic will result in 4 islands, and each will have 1 island terrain and 3 flat terrains underneath that belong to the other islands. It's not a performance-friendly approach. You cannot have more than one infinite terrain since... well, since it's infinite. reocwolf is right, you've got to use one instance for all of your islands. You can use biomes if you are going to create absolutely independent graph for each island.
     
    Syberam and Dwight_Everhart like this.
  21. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    If you're creating static terrains you can create one, remove the MapMagic script and the start creating another. Or, if you comment out the line that checks if MapMagic is already in the scene you can actually just turn the script off, and then start another MapMagic instance. If you ever have more than one on at a time it won't work. But if you make sure to turn off your other three you can work on them one at a time independantly. I've been doing that for the past year. If you want them to generate infinitely you have to wait until one is idle, turn it off, turn another on one, wait until it finishes generating and goes idle, turn it off, etc.
     
  22. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    That's interesting, and it may be useful for some cases, but I don't think it will help with the puddle issue or the shoreline issue. I need to apply puddles and shorelines to the final height map that is generated after biomes are mixed.

    If there will never be a way to specify node execution time (before or after biome mixing) within a biome graph, I may need to eventually ditch biomes, as @Harekelas suggested, and generate everything in a single graph. I'd rather not do that.
     
  23. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I'm actually thinking if biomes system can let us modify results after the blending will be the best, we can let a part of our terrains generated through biomes blending and make the overall changes which are highly heightmap depended from the blended result, like shoreline and textures.
     
    Dwight_Everhart likes this.
  24. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I've created a node to scale the height on a curve, based on distance to a seed point. This creates a credible island. My next step is to add multiple seed points (each with their own distances). The goal is to do exactly what you are suggesting - create a set of island chains, simply by dropping in prefabs into the world. If interested, I will post it here when complete.
     
    Syberam and malkere like this.
  25. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Yes, that is the other approach I suggested. Having both options would be best. Some things, like shore generation, should be applied to the final height map regardless of which biomes contributed to it. However, other things, like puddles, are specific to biomes. I might want puddles in a jungle biome but not in a desert biome.
     
    malkere likes this.
  26. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    @Wright
    Hi, I'm using MM 1.8's noise node to generate the areas of my islands, but I found that when I change the overall seed, the areas are changed dramatically, so I'm wondering if there can be a way to let individual node to ignore the overall seed so that I can let the boundary generators keep to their own seeds so the island's area will always be in the same place, in the meantime, the terrain height generators are combined with overall seed that can be random each time I start a new game.
    Any ideas how can I do it or it is not possible?
     
  27. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    absolutely. just make a custom generator that does not take in the global seed. this line in the basic noise:

    Code (CSharp):
    1. Noise noise = new Noise(seed^this.seed, permutationCount:16384);
    is using the the global seed (seed) and the generator seed (this.seed). you could copy that exactly, give it a different name, and just replace it to this:

    Code (CSharp):
    1. Noise noise = new Noise(this.seed, permutationCount:16384);
     
    Harekelas and Dwight_Everhart like this.
  28. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Thank you very much!
     
    malkere likes this.
  29. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Feature Request: Add a virtual function to Generator that is called on the main thread before generation. (Example: OnBeforeGenerate). This way, we can do any initialization in our custom generators that need to be called on the main thread (such as FindObjectsOfType, etc).
     
    malkere likes this.
  30. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Dwight_Everhart, Harekelas, it would be great if you could describe the after-biome system as you see it. What should exactly be adjusted and how - I mean from the user's perspective?

    Here is this system as I see it: biomes can have a special Biome Output that returns some particular maps into the main graph. You can adjust these maps here, combine them the way you want and apply using only one Height Output (or texture, or any other output).

    However, I'm not sure that this will ever work. Sounds like an infinite loop. Main graph depends on biomes, and biomes depend on the main graph to calculate masks. I'm not sure that it could be resolved, so any other ideas are welcome.

    Syberam, I think this could be resolved using some "ratio" factor in a Texture Input values. It would be great if you could create a proposal at the issues page.

    But there's a simple workaround to that - you can make your texture square, but use only rectangular part of it, filling the rest with black. It may seem that it doesn't sound like an efficient solution, but if you are using the sane texture size it will not affect used memory or generate time a lot.

    Jaimi, I like that idea. It would be useful and not not hard to implement. So it's planned for 1.8.3
     
    julianr, Dwight_Everhart and malkere like this.
  31. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    Hi Dennis,

    I'm looking for a way to set values on a generator from script when loading a level, and then generate the terrain. I have a large height map for the entirety of my game world, but I want to generate a map using only a small portion of the heightmap, based on where the player is on an overworld map. To do this, I'm setting the scale and offset parameters of the raw input generator to get it to generate the map based on a section of the heightmap. However, since I don't know where on the overworld map the player will be each time they load the scene, I need to be able to set the offset value at load time based on the player's position, and then generate the map based on that.

    Thanks.
     
  32. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    @Ronald_McScotland if you start the MapMagic instance as disabled, figure out where your player is, change a public static variable, then enable the MapMagic instance, a custom generator making use of the public static variable will do what you're suggesting.
     
    Dwight_Everhart likes this.
  33. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    Thanks, I'll give that a try
     
  34. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    Ok, now I've run into a different problem, this time with the texture input generator. I enter the texture in, but the generator gives no output. If I try to preview it, it just shows a black image. I've made sure the texture is read/write enabled, tried enableing and un-enableing reload each generate, manually clicking reload and force generate all, but nothing seems to get it to output anything other than a plain black map.
     
  35. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    It is a challenging design problem, so I spent some time looking at my graphs and imagining how they would look with a new system that would let them work with the results of biome mixing. Here's my proposal: Add outputs to all output nodes. These outputs would contain the values of the output node after it has been mixed with other biomes. Nodes that need to process the mixed outputs would use these outputs for their inputs. These nodes would be evaluated after biome mixing is done, and the output they produce would replace the same type of output generated by nodes that were evaluated before biomes were mixed. The output they produce would not be re-evaluated by the graph, so there would not be an infinite loop.

    Here's an example of how the puddle problem could be solved with this design. The output of the Height node is sent to a portal and then evaluated to produce a puddle map for MegaSplat:

    MapMagicProposal-1.png
    MapMagicProposal-2.png

    Note that the MegaSplat output node takes inputs both from nodes that evaluate the unmixed height and from nodes that evaluate the mixed height. So the MegaSplat output node would be executed twice, once before biomes are mixed and once after. When it's executed before mixing, it would not have a Puddles input. When executed after mixing, it would have the Puddles map provided by the nodes that evaluated the mixed height map, in addition to the inputs evaluated before biomes were mixed. Or perhaps the MegaSplat node would only be executed once, with its inputs taken from both phases (with the pre-mixing inputs saved until after the post-mixing inputs are available).

    A similar approach could be taken with shoreline creation. This would best be done in the main graph:

    MapMagicProposal-3.png

    One unfortunate side effect of this design is that it sometimes requires using two output nodes of the same type in the same graph, as this example does. One is used as an input, and the other is used as an output. This looks confusing, and it raises the question of what should be done if a connection is made to the outputs of both nodes. I think they both should return the same map, the result of the biome mixing.

    An alternative approach to adding outputs to the output nodes would be to use portals. Output portals could contain references to the outputs of all output nodes, such as Height and Trees, and the designer could select one of those outputs to connect to the mixed outputs. Everything else would work the same. However, I prefer adding outputs to the output nodes directly. It's clearer and doesn't add any magically produced portals.

    I hope this design can work from an engineering perspective, and I hope it wouldn't be too difficult to implement. It would require that biomes be evaluated in two phases. You would need to determine which nodes should be evaluated before biome mixing, and which should be evaluated after. And the "after" results of each biome would need to be mixed with the other biomes, just like the "before" results were mixed, to produce the final results. However, this second mixing of biomes would not be fed back into the graphs. Graph nodes would evaluate either the original, unmixed state of the biomes, or the first mixed results.
     
    neoshaman likes this.
  36. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
  37. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Nice catch Jaimi. That is not original work. It even has "Island Demo" scene in the package, all the same grass/texture names. Pretty sure that's against the rules, I reported it. They won't take action if they consider that fair play.
     
    Dwight_Everhart, iddqd and neoshaman like this.
  38. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Yeah, nice catch! I've reported it too, as an original asset author.

    It's a good idea, but I'm afraid it's not possible. All of the biome blending takes place in the Process function, that is called after all Generate is done. There's no way to return to Generate when Process is called.

    In other words, you are going to apply biomes to height output at your first image - but how can MM know what are the other biome heights before generating them? So it will have to "pause" generate of this graph and keep it's data, and generate all of the biomes until they reach the Height Output - it's inefficient and will cause really a lot to refurbish, but at least it might work.

    The real problem arises when this Height Output output map is used in Texture Output in one biome, and the other biome is using Texture Output to generate Height Output. There is no way to determine such loops because biomes are independent and could be just plugged in a graph, implying they will work the same way as in "solo" mode.

    I guess that you mind a solution to that by saying "generate MegaSplat Output twice", but even I could not wrap my head around it. It's really very confusing, and I doubt that it follow "biome independence" principle. But anyways, thanks for the idea! I will try to think about it if I have to re-write the generate algorithm.

    Ronald_McScotland, I can't say for sure without seeing your graph and pinned terrains, but I guess your terrain is pinned far from the map your input. Try setting tiled wrap mode in Texture Input generator to check if it is really so.
     
  39. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    Ah, that was it, I'd set the offset to match my heightmap input, but I'd forgotten to set the scale to match, so it was reading from outside of the texture area. Thanks.
     
  40. j0hnbane

    j0hnbane

    Joined:
    Jul 2, 2014
    Posts:
    20
    @Wright

    I'm getting this weird square set of uneven heights whenever I change the terrain size of a Voxeland any bigger than 390. I made sure it wasn't Voxeland itself first. When I use MapMagic as the generator, its fine. But as soon as I use a clamp append with a blur, its very visable. Here's a pic:



    I've toyed around with it and cannot figure out what's doing it. I started a fresh project and did it again with minimal generators.



    I've been trying to dig through videos/documentation.. but it is somewhat limited atm.
     
  41. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Ah, that's too bad. I'm not familiar enough with MapMagic's architecture to even guess at what might be possible without major disruption. This sounds like a major disruption. I'm sure MapMagic's architecture is complex. I wouldn't know where to start, if I wanted to write something like it.

    Would it be more feasible to allow the mixed height map to be processed only in the main graph, the one with the biomes? Support for that would let me use the Shoreline node on the mixed height map. If even that is not possible, I may need to eventually ditch biomes and generate everything in a single graph.

    In any case, thanks for considering my ideas, and please keep them in mind if you need to modify MapMagic's architecture in the future.
     
  42. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Hi @Wright,

    Please consider implementing:

    * Spherical projection tiling (for world generation)
    * Call MM from code passing input parameters
    * Let the above call return the height texture, for instance

    Returning a texture is interesting for using it as a displacement map anywhere, not just for terrains.

    Regards,
    Rod
     
  43. MarkusNirpaw

    MarkusNirpaw

    Joined:
    Aug 4, 2016
    Posts:
    1
    Your manual badly needs an update.
     
    slimshader and Dwight_Everhart like this.
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Syberam, you can use the Flatten Generator to flatten a land under objects.

    Rod-Galvao, I'm thinking about a biome offset feature, it will generate biome just as usual, but with some shift distance. Assigning the same biome and setting offset will make it generate the same biome at the other location, this is the way to remove seams when repeating the world. You will be able to make it repeat itself infinitely too, however I have not thought about all the details.

    Speaking about calling generate function from custom scripts - there is a way to do it. Actually, it is the way Voxeland is using MapMagic to generate it's terrain. You will need to use graph's Calculate function for that.

    Code (CSharp):
    1. Calculate (int offsetX, int offsetZ, int size, Chunk.Results results, Chunk.Size terrainSize, int seed)
    2.  
    3. /**
    4. - offsetX and offsetZ  is the offset of the area to generate (in map pixels)
    5. - size  is the dimentions of the area
    6. - results  store all of the generate data, including the heightmap. Top access heightmap Matrix use results.heights value.
    7. - terrainSize  is a struct that holds information about world parameters: terrain resolution, terrain dimentions (it's size in world units), and maximum height value
    8. - seed  is a global seed used to generate unique terrain
    9. */
    10.  
    Note that this function is called not on MapMagic object itself - you can even have no MapMagic in scene at all - but on the graph, a saved .asset file.

    Here is a usage example:

    Code (CSharp):
    1. MapMagic.GeneratorsAsset mapMagicGens = MapMagic.instance.gens; //finding current graph asset
    2. MapMagic.Chunk.Results results = new MapMagic.Chunk.Results(); //preparing results
    3. MapMagic.Chunk.Size size = new MapMagic.Chunk.Size(MapMagic.instance.resolution, MapMagic.instance.terrainSize, MapMagic.instance.terrainHeight);
    4. mapMagicGens.Calculate(100, 100, 300, results, size, 12345);
    5.  
    MarkusNirpaw, I have to admit that's true. Here is a wiki page I edit from time to time, all of the new docs will appear here. I've got to transfer all of the old data here that have not change, I'm going to do that shortly.
     
    Rod-Galvao and Dwight_Everhart like this.
  45. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    502
    Has anyone got experience with MM and RTP using >8 textures? What about MM Biomes and RTP - does that work?

    Also, 4k bring the highest option available, that's a Unity thing, right? No way to get it to generate 8k textures?

    Finally, is there a list of what is done per-pixel vs per-meter? When going from a prototype generation at 1k or whatever, to a final generate with all the options turned back up to max and generating at 4k, things like noise (voronoi seems to be worst here) change in unexpected ways. Same with erosion, slope blend, etc. Anyone got a checklist for doing the final gen - things to tune when changing res?
     
    DesertRaven likes this.
  46. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I have a sloppy method that we've talked about before in here:

    Code (CSharp):
    1. int multi = 1024 / terrainResolution;
    2. result = noise.LegacyFractal(x * nearMulti, z * nearMulti, detail);
    this will only work on terrain up to 1024 of course, but my terrainResolution variable I set in a PlayerSettings sort of public static script that is also used to tell MapMagic what resolution to generate in. That way 128/256/512/1024, will always make use of the same x and z in the noise pattern.

    I've been meaning to just have it use the current resolution instead of the public variable because the public variable still gets used in editor mode when I do exactly what you're talking about, change the resolution around for testing. The current resolution is visible at MapMagic.Instance.resolution or something like that, so it shouldn't be hard.
     
  47. Sp-ce

    Sp-ce

    Joined:
    Feb 2, 2015
    Posts:
    65
    @Wright I'm having an issue where when I set the static flag to true on the MapMagic Parent object but then uncheck only 'Lightmap' Static. This will then process for the children terrain tiles as well.

    However, once I hit play to test and then exit play mode, the static flag on the children terrain is set back to 'Everything,' even though on the MapMagic parent it still says everything is static except Lightmap Static.

    Basically, the children terrains do not maintain the MapMagic parent's Static Flag inheritance once I enter and exit playmode.

    Anyone else having this issue?

    Thanks!
     
  48. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Hey Wright, thanks for pointing this out. I'm trying to get a direct height return using this, but getting an error:

    Code (CSharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. MapMagic.Matrix2`1[System.Single].get_Item (Int32 x, Int32 z) (at Assets/MapMagic/Main/Matrix2.cs:486)
    3. MapMagic.HeightOutput.Process (CoordRect rect, MapMagic.Results results, MapMagic.GeneratorsAsset gens, Size terrainSize, System.Func`2 stop) (at Assets/MapMagic/Generators/OutputGenerators.cs:83)
    4. MapMagic.GeneratorsAsset.Process (CoordRect rect, MapMagic.Results results, MapMagic.GeneratorsAsset gens, Size terrainSize, System.Collections.Generic.HashSet`1 changedTypes, System.Func`2 stop) (at Assets/MapMagic/Main/GeneratorsAsset.cs:422)
    5. MapMagic.GeneratorsAsset.Calculate (CoordRect rect, MapMagic.Results results, Size terrainSize, Int32 seed, System.Func`2 stop) (at Assets/MapMagic/Main/GeneratorsAsset.cs:224)
    6. MapMagic.GeneratorsAsset.Calculate (Int32 offsetX, Int32 offsetZ, Int32 size, MapMagic.Results results, Size terrainSize, Int32 seed, System.Func`2 stop) (at Assets/MapMagic/Main/GeneratorsAsset.cs:227)
    7. TerrainsManager.GetWorldHeight (Int32 worldX, Int32 worldZ) (at Assets/Scripts/Terrains/TerrainsManager.cs:387)
    8. EncounterManager.ChunkEnabled (Int32 worldX, Int32 worldZ, UnityEngine.Transform encounterParent) (at Assets/Scripts/Encounters/EncounterManager.cs:111)
    9. TerrainsControllerDistant.OnEnable () (at Assets/Scripts/Terrains/TerrainsControllerDistant.cs:44)
    10. UnityEngine.GameObject:SetActive(Boolean)
    11. MapMagic.MapMagic:Update() (at Assets/MapMagic/MapMagic.cs:247)
    12.  
    I"m calling with a positive x 1870 and z 1960 in this case, and using the size 100, though I only really want 1, 1 was throwing the same error. The error occurs on the actual Calculate line? Any ideas?

    Once it works then, can I use this:

    Code (CSharp):
    1. return results.heights.CheckGet(0, 0);
    to get the height?
    Thanks!
     
  49. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    Hello, just updated to 1.8.2 and I get this error:

    Assets/MapMagic/Generators/RTPOutputGenerator.cs(376,48): error CS0246: The type or namespace name `InstantUpdater' could not be found. Are you missing an assembly reference?
    Assets/MapMagic/Generators/RTPOutputGenerator.cs(370,39): error CS0246: The type or namespace name `InstantUpdater' could not be found. Are you missing an assembly reference?
     
  50. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    502
    MM_Example_DH.png

    this is technically just the default MM scene, with some more MM terrains pinned and a nicer fog applied. Thought this thread could use some more pictures.

    One of the trees and one of the bushes hate fog though, but that's default transparent tree shaders for you...