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. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    when do you expect the RTP and biome upgrade to hit the store @Wright ?
     
  2. asilvas

    asilvas

    Joined:
    Aug 10, 2016
    Posts:
    9
    @Wright I'm trying to use Flatten, but I've scoured the docs and forums and the only couple examples I've found seem to be outdated and depend on older removed generators. It's not working how I would have expected, which would be auto-flatten the height map in the designated object locations. It takes the objects for location, and the canvas for the height map, and I output the modified height map. This is not the case. I'm missing at least one extra step.

    Edit - To be clear, I'm expecting a "leveling" of the area. I could add a little noise or something to it after so it's not completely flat, but the idea is that the surface is level so I can place the platform on the same plane.
     
    Last edited: Sep 28, 2016
  3. ArturoSR

    ArturoSR

    Joined:
    Feb 21, 2014
    Posts:
    21
    @Wright Hello and god day, I search some basic tutorials to make an scene like the one from terrain composer (world view), but no result, I need to make an scene for a parachute simulation, to achieve this, it's necessary to see more than 10 square terrains (1km x 1km), I try it to increase the Generate Range and Enable Range to see a large world view but no result, there is only one or two (if reach the edge at ground level but not in the air) is there a way to achieve this?.

     
  4. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    You need to increase your camera's Far Clip Plane to see more. It defaults at 1000.
     
  5. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    I've sent the beta version to my (former) coworkers - level-designers, and now got their reports. It will take a couple of days to fix the bugs, a couple of days to ensure that they are fixed, and about a week (probably less) for Unity to review the new version. A week and a half or maybe...


    BTW while the volunteer testers are reviewing MMWG I'm toying with Voxeland and making some integration tests. Seems that MMWG should generate the new land based on Voxeland's event, and it should work with no chunk. It will require some time to implement.

    asilvas, if you could post a drawing, scheme or reference of the result you are trying to achieve, I would help you constructing a proper graph. If it's really a worthy thing I can even find an inspiration for creating the new generators.

    That makes sense. I often forget to set up the camera in new scenes too.
     
    Last edited: Sep 29, 2016
  6. ArturoSR

    ArturoSR

    Joined:
    Feb 21, 2014
    Posts:
    21
    I not say that before, but I surely increase that, obviously (10000 even 20000), but the result is the same, maybe I'm not so clear about what I'm saying, the thing is: While walking it is work, but , if I try to fly does not do anything (that's the image from before).
     
  7. asilvas

    asilvas

    Joined:
    Aug 10, 2016
    Posts:
    9
    @Wright Sure, here's a very simple example of how I interpreted the generator to work (which is, clearly, wrong). Instead of flattening the areas, it's completely sinking it to the bottom (or near bottom) of the height map. It isn't clear to me why it works this way. I've tried to achieve the desired end result of flattening the height map around specific objects using a number of generators, but it's not clear what the best option is.


    upload_2016-9-28_20-23-24.png
     
    Last edited: Sep 29, 2016
  8. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Hey everyone, ive been trying to write a generator that scales up a section of chunk matricies to cover a larger area much like the objects do so i can make a map with varying detail levels. Ive got it to this point but im not sure why it isn't giving any result when i test it. It just runs without outputting anything when i test it. Could i have a little bit of help?


    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. // Assets.Scripts.Utility;
    4. using UnityEngine;
    5.  
    6.  
    7.  
    8. namespace MapMagic
    9. {
    10.     [Serializable]
    11.     [GeneratorMenu(menu = "CustomMap", name = "Transform", disengageable = true)]
    12.     public class TransformMatrix : Generator
    13.     {
    14.         public Input input = new Input("Input", InoutType.Map);
    15.         public Output output = new Output("Output", InoutType.Map);
    16.  
    17.         public float intensity = 1;
    18.         public int scale = 1;
    19.  
    20.         public int rectx = 2;
    21.         public int rectz = 1;
    22.  
    23.         //public Vector2 scale = new Vector2(1, 1);
    24.  
    25.         public override IEnumerable<Input> Inputs()
    26.         {
    27.             yield return input;
    28.         }
    29.  
    30.         public override IEnumerable<Output> Outputs()
    31.         {
    32.             yield return output;
    33.         }
    34.  
    35.        
    36.         public override void Generate(Chunk chunk, Biome biome = null)
    37.         {
    38.             if (!enabled || chunk.stop) return;
    39.             Matrix matrix = chunk.defaultMatrix;
    40.  
    41.             Coord min = matrix.rect.Min; Coord max = matrix.rect.Max;
    42.  
    43.  
    44.  
    45.             //float pixelSize = 1f * MapMagic.instance.terrainSize / matrix.rect.size.x;
    46.             //float ssize = matrix.rect.size.x; //scaled rect size
    47.             //int rx = scale * rectx;
    48.             //int rz = scale * rectz;
    49.  
    50.  
    51.             int chunkTargetx = (chunk.coord.x) / scale;
    52.             if (chunk.coord.x % scale == 0 && chunk.coord.x != 0) { chunkTargetx--; }
    53.             int chunkTargetz = (chunk.coord.z) / scale;
    54.             if (chunk.coord.z % scale == 0 && chunk.coord.z != 0) { chunkTargetz--; }
    55.  
    56.  
    57.  
    58.             if (chunkTargetx > rectx || chunkTargetz > rectz || chunkTargetz < 0 || chunkTargetz < 0)
    59.             {
    60.                 output.SetObject(chunk, chunk.defaultMatrix);
    61.             }
    62.             else
    63.             {
    64.                 Matrix origin = MapMagic.instance.terrains[chunkTargetx, chunkTargetz].defaultMatrix;
    65.                 Matrix patch = new Matrix(chunk.defaultRect/scale); // Get the small section that we will be using to scale
    66.                 for (int x = min.x / scale; x < max.x / scale; x++)
    67.                 {
    68.                     for (int z = min.z / scale; z < max.z / scale; z++)
    69.                     {
    70.                         try
    71.                         {
    72.                             patch[x, z] = origin[x, z];
    73.                         }
    74.                         catch
    75.                         {
    76.                             Debug.Log("failed on chunk " +chunk.coord+" Target: "+chunkTargetx + "," + chunkTargetz + " at " + x + "," + z);
    77.                             break;
    78.                         }
    79.                     }
    80.                 }
    81.  
    82.                
    83.                 //Debug.Log("matrix sizes: " + matrix.rect);
    84.                
    85.                 matrix = patch.Resize(chunk.defaultRect);
    86.                 //Debug.Log("Patch sizes: " + matrix.rect);
    87.                
    88.                
    89.                 if (chunk.stop) return;
    90.                 output.SetObject(chunk, matrix);
    91.  
    92.             }
    93.         }
    94.  
    95.    
    96.  
    97.  
    98.         public override void OnGUI()
    99.         {
    100.             //inouts
    101.             layout.Par(20);
    102.             input.DrawIcon(layout);
    103.             output.DrawIcon(layout);
    104.             layout.Field(ref intensity, "Intensity");
    105.             layout.Field(ref scale, "Size");
    106.             layout.Field(ref rectx, "Sample rect x");
    107.             layout.Field(ref rectz, "Sample rect y");
    108.         }
    109.     }
    110. }
     
  9. Rexoto-Games

    Rexoto-Games

    Joined:
    Jan 11, 2013
    Posts:
    41
    This could be helpful to anyone trying to make roads. The main issue seems to be it only works with one terrain.
     
    protopop likes this.
  10. rickcollette

    rickcollette

    Joined:
    Mar 17, 2013
    Posts:
    304
    Prior to asking, I searched and came up empty - maybe my search terms are horrible..
    Question is: Can I generate an island or some kind of larger aream and make it a static scene/terrain for use in a non-infinite world type game?

    If so ; is there a doc or tutorial on this process?

    [EDIT]:

    That gave me my answer.

    :)
     
    Last edited: Sep 29, 2016
  11. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    Hakazaba, chunk default matrix is an empty (filled with 0) matrix. It is just a shortcut for the
    Code (CSharp):
    1. new Matrix( new CoordRect(
    2. chunk.coord.x*MapMagic.instance.resolution,
    3. chunk.coord.z*MapMagic.instance.resolution,
    4. MapMagic.instance.resolution,
    5. MapMagic.instance.resolution) );
    So you copy the values from the one chunk default matrix (origin) - an empty one - to the other empty matrix.

    Are you trying to copy one chunk values to the other one? And what if the first chunk is not generated?

    thisnamesucks, making a road mesh is not a problem, and even changing terrain in a proper way for the road is pretty clear too. The problem is in connecting one chunk roads with the others. It's the same sort of the previous one - what if the neighbor chunk is not generated?

    arrested_games, you can pin a terrain and turn auto-generate off. None of the terrains will be generated during the playmode, and the pinned one will persist. You can even remove the MMWG component - it will not destroy the pinned terrain.
     
  12. asilvas

    asilvas

    Joined:
    Aug 10, 2016
    Posts:
    9
  13. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    look at the monolith








    It work like this in this case, it level around a POI using a inner and outer radius with:
    1. sample the height at the designated point
    2. level by making all point inside the radius the same height as the sample
    3. blend terrain height with a falloff between the inner and the outer radius (quadratic here)
     
  14. Goon-Studios

    Goon-Studios

    Joined:
    Mar 16, 2015
    Posts:
    8
    hello all,

    I need some help. Has anyone tried to mask a large area with a texture? I had it setup to do something similar to the biome generator. it worked nice, i have the raw image generating the land mass and the texture was supposed to mask an area so that i could put different features there. I had hoped that i could do something similar with biome generator, by using the texture to tell the biome where to generate. After I setup the texture input node in the editor It masked the area i wanted beautifully but i started getting the "Generate Thread Error" the masked area looked correct. the only problem is when i go to play mode the terrains wont generate. while in play-mode I can "Force Generate All" in the map magic editor and its works... if I detach the Texture Input node and go to play-mode the map generates correctly with no errors. after detaching the "Texture Input Generator" and reattaching the texture input, the mask does not work correctly anymore and i get "generic key not found" error. I did not change anything else that could possibly effect the texture input so im really stumbled as to why i wont mask correctly now.


    After all that I am also wondering if anyone has had success with the biome generator, and if anyone knows whether or not the biome generator runs better than a just having everything on a single graph. I couldnt get biomes to look good and seemed vary uncontrollable.
     

    Attached Files:

  15. asilvas

    asilvas

    Joined:
    Aug 10, 2016
    Posts:
    9
    Much appreciated! It still isn't clear what generators to compose in MM to pull that off (especially step 1), but I'll give it a shot.
     
  16. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    Goon-Studios, could you please send me the scene with all the graphs data (if they saved separately)?

    ArturoSR, let me clarify it: the terrains are not generated when you fly closer to them? Could it be a situation when there is no terrain right below the camera?

    asilvas, I've reproduced and fixed the bug on your screen. Since there is no Floor generator in the last version it flattens the land about objects that are located at the zero level. In the next version Flatten will work similarly to neoshaman's NMS screens.
     
  17. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    Hi, I am using the default terrain that comes with MapMagic, but see that all stone is generated twice in same location. If you click on one and hide it another is in exact same place and shape. How would I fix this as its creating unnecessary objects in the scene. Like I said this is using the default terrain setup that comes with MapMagic. Can someone else also confirm that they have the same thing?
     
  18. asilvas

    asilvas

    Joined:
    Aug 10, 2016
    Posts:
    9
    Excellent thanks!
     
  19. rpg_gamer

    rpg_gamer

    Joined:
    Nov 28, 2012
    Posts:
    214
    really considering getting this now. Is there a video available that shows the new biomes feature?

    *edit

    ah I see them on yt now.

    also is map magic compatible with external character controllers, say UFPS, or a third person controller?
     
    Last edited: Sep 30, 2016
  20. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Aah, i thought that default matrix was getting the input of the previous generator, how do i get that instead. Is it possible to force that chunk to generate first? Or even better, is it possible to get the input that chunk was going to use to generate?

    What I'm trying to do, is copy a small section of one chunk that gets smaller based on how high i want to scale it (saving on performance) based on the coordinates of the chunk that's being generated. Then resize it up to the size of a normal chunk. Hopefully generating that target chunk once and copying sections of it over the other chunks rather than generating anything prior to this for the ones being copied to.
     
  21. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Wait, i figured it out its
    (Matrix)input.GetObject([the chunk at the coordinates i want])

    Still, i need to figure out how to make sure its generated first i think
     
  22. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    I have another newbie questions:

    Different sizes of the same tree, is it possible?
    If I have a tree, and I want it to be different sizes, I must create different prefabs the same tree?

    How to disable the grass under the objects placed on the map independently from MapMagic (eg houses)?
     
    Last edited: Sep 30, 2016
  23. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    For the first you can use the forest generator, not sure about the latter issue.
     
  24. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    Hakazaba@
    I use forest generator, but it is not responsible for the size of trees (i use demo 1.4)

    Another newbie problem:
    I have in the game - objects that have rigidbody and fall when the area disappears when streaming terrain :(
    The objects must have rigidbody and I can't freeze their position, some advice?
    I must buy this:
    https://www.assetstore.unity3d.com/en/#!/content/36486
    if this will help? maybe are other ways?
    Is it cooperates with MapMagic?
     
    Last edited: Sep 30, 2016
  25. AdanGrotesco

    AdanGrotesco

    Joined:
    Sep 26, 2015
    Posts:
    33
    edit: do not link to pirated content.
     
    Last edited by a moderator: Oct 2, 2016
  26. asilvas

    asilvas

    Joined:
    Aug 10, 2016
    Posts:
    9
    Found another bug for ya, @Wright

    In MapMagic.cs:209 appears flawed in that it isn't loading textures that are still being accessed. Not sure if it's helpful, but I'm using a Texture Input in combination with Blend+Subtract.

    I'm working around the problem with this (not optimal, but a better solution wasn't obvious to me):

    Code (CSharp):
    1.             //preparing generators
    2.             //if (prepareGenerators)
    3.             //{
    4.                 foreach (TextureInput tin in gens.GeneratorsOfType<TextureInput>()) tin.CheckLoadTexture();
    5.             //}
    6.  
    I tried working around the issue where the original error occurs in MatrixGenerator.cs::Generate but it just moves the error around.

    Code (CSharp):
    1.         public override void Generate (Chunk chunk, Biome biome=null)
    2.         {
    3.             if (chunk.stop || !enabled || texture==null) return;
    4.             // this line is trying to work around a problem, but this isn't a valid location to load texture
    5.             if (textureMatrix == null) CheckLoadTexture();
    6.  
     
  27. wiseman_2

    wiseman_2

    Joined:
    Dec 11, 2013
    Posts:
    66
    yes, I use ufps with no problems
     
  28. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    Yeah, thanks, it is fixed for the upcoming version.

    Hakazaba, imagine a case when terrain chunk requires a generated result of the neighbor chunk on the right of it. It will force the neighbor chunk to generate, which in turn will force it's neighbor to generate, and so on. It does not matter if a required chunk has a particular coordinates or not since the generated chunk may change these coordinates or require some other chunk to generate.

    Sluta, you can use the different tree sizes if you will make a tree with a LODGroup component (and enable tree scale in tree output). That will prevent trees from baking into imposters, and thus will enable scale. This is the way Unity works...

    I'm not sure about what happens with rigidbody objects, but will freezing them in the air fix the problem? For example, to prevent objects falling through the non-ready terrain while it is generated you can use this script.

    AdanGrotesco, please don't do that. Don't publish the links to the pirate software - anywhere, and especially in the official thread. I'm aware of the it, and try to send copyright infringement reports every time I find illegal use of my plugins. If you want to help me in that by informing about some copyright violation you'd better send me a message or email rather than posting the link in public - this is the way you only raise it's position in google chart.

    asilvas, could you send me the full error description from the console and the way to reproduce it?
     
    cookimage likes this.
  29. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Well, unfortunately so far when i try to get information from a chunk that hasn't been generated, with MapMagic.instance.terrains[0, 0], it seems to be returning a null object if that hasn't been generated yet. So how do i make sure that's generated before the current chunk?

    Also that behavior you mention is fine for this, since it will only be one or two chunks that need to be pregenerated for about 500 other chunks.

    Also i would like to request a chunk offset property in the mapmagic editor. Its important to avoid floating point errors when trying to go to specific places I think its pretty easy to add, Ive been doing a bit to try and get it working myself, but at the moment im focused on the scale generator.
     
  30. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    @Wright
    That you mean?

    But I have the impression that the rotation does not work.

    On the issue of falling objects and streaming terrain:
    I can't freeze the object's position, because these are objects that movable. Does this mean, that I must to buy it:
    https://www.assetstore.unity3d.com/en/#!/content/36486 ?
    And if so, how will act streaming terrain? Can somehow disable streaming in MapMagic and use of streaming World Streamer? I have concerns about whether it will work. :( I know that this is not a problem itself MapMagic, but any streaming terrain.
    So I have to raise money for the World Streamer, or is it some other advice?

    edit:
    Any advice how to remove grass from objects placed manually, such as houses?
     

    Attached Files:

    Last edited: Oct 2, 2016
  31. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Basic unity trees cannot rotate when used as normal on terrains. Only Speedtrees can do that because of the way billboarding works. You can make a couple prefabs rotated at different angles to fake it at a tiny loss to performance.

    You can remove grass around manually placed objects by putting a script on them to check grass chunks on the terrain beneath them and remove within a certain proximity.

    as for the falling objects, you should make them children to the terrains. when they get switched off (not destroyed) they will just be disabled.
     
  32. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Here is an update on the current state of the scaling generator. At the moment im having this error:

    Internal_CreateGameObject can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.



    I'm not really sure how to get the origin chunk generating if it hasn't been already. Any help would be greatly appreciated.

    So far the generator works fine so long as the origin chunk is pre-generated.



    Code (CSharp):
    1. using System;
    2. //using System.Threading;
    3. using System.Collections.Generic;
    4. // Assets.Scripts.Utility;
    5. using UnityEngine;
    6.  
    7.  
    8.  
    9. namespace MapMagic
    10. {
    11.     [Serializable]
    12.     [GeneratorMenu(menu = "CustomMap", name = "Transform", disengageable = true)]
    13.     public class TransformMatrix : Generator
    14.     {
    15.         public Input input = new Input("Input", InoutType.Map);
    16.         public Output output = new Output("Output", InoutType.Map);
    17.  
    18.         public float intensity = 1;
    19.         public int scale = 1;
    20.  
    21.         //public int rectx = 2;
    22.         //public int rectz = 1;
    23.  
    24.         //public Vector2 scale = new Vector2(1, 1);
    25.  
    26.         public override IEnumerable<Input> Inputs()
    27.         {
    28.             yield return input;
    29.         }
    30.  
    31.         public override IEnumerable<Output> Outputs()
    32.         {
    33.             yield return output;
    34.         }
    35.  
    36.        
    37.         public override void Generate(Chunk chunk, Biome biome = null)
    38.         {
    39.             if (!enabled || chunk.stop) return;
    40.            
    41.             Matrix matrix = chunk.defaultMatrix;
    42.  
    43.             Coord min = matrix.rect.Min; Coord max = matrix.rect.Max;
    44.  
    45.  
    46.  
    47.             //float pixelSize = 1f * MapMagic.instance.terrainSize / matrix.rect.size.x;
    48.             //float ssize = matrix.rect.size.x; //scaled rect size
    49.             //int rx = scale * rectx;
    50.             //int rz = scale * rectz;
    51.             Coord chunkTarget = chunk.coord / scale;
    52.  
    53.             //int chunkTargetx = (chunk.coord.x) / scale;
    54.             //if (chunk.coord.x % scale == 0 && chunk.coord.x != 0) { chunkTargetx--; }
    55.             //int chunkTargetz = (chunk.coord.z) / scale;
    56.             Chunk targetChunk = MapMagic.instance.terrains[chunkTarget];
    57.  
    58.             //Debug.Log(chunkTarget);
    59.  
    60.             //MapMagic.instance.terrains.GetTerrain(chunkTargetx, chunkTargetz, true);
    61.             //Chunk chunkTarget = MapMagic.instance.terrains[chunkTargetx, chunkTargetz];
    62.             //Debug.Log(chunkTarget);
    63.             if (chunkTarget != chunk.coord && targetChunk == null)
    64.             {
    65.                 MapMagic.instance.terrains.Nail(chunkTarget);
    66.                
    67.                 targetChunk = MapMagic.instance.terrains[chunkTarget];
    68.             }
    69.            
    70.             Debug.Log(chunkTarget);
    71.             Matrix origin = (Matrix)input.GetObject(targetChunk);
    72.  
    73.             Matrix patch = new Matrix(chunk.defaultRect/scale); // Get the small section that we will be using to scale
    74.             bool test = true;
    75.             for (int x = min.x / scale; x < max.x / scale; x++)
    76.             {
    77.                 if (test == false)
    78.                 {
    79.                     break;
    80.                 }
    81.            
    82.                 for (int z = min.z / scale; z < max.z / scale; z++)
    83.                 {
    84.                     try
    85.                     {
    86.                         patch[x, z] = origin[x, z];
    87.                     }
    88.                     catch
    89.                     {
    90.                         test = false;
    91.                         Debug.Log("Matrix transform failed on chunk " +chunk.coord+" Target: "+ targetChunk.coord + " at " + x + "," + z);
    92.                         break;
    93.                     }
    94.                 }
    95.             }
    96.  
    97.                
    98.             //Debug.Log("matrix sizes: " + matrix.rect);
    99.                
    100.             matrix = patch.Resize(chunk.defaultRect);
    101.             //Debug.Log("Patch sizes: " + matrix.rect);
    102.                
    103.                
    104.             if (chunk.stop) return;
    105.             output.SetObject(chunk, matrix);
    106.             Debug.Log("Patch sizes: " + matrix.rect+ " The chunk we were targetting was: "+ targetChunk.coord);
    107.  
    108.         }
    109.        
    110.        
    111.    
    112.  
    113.  
    114.         public override void OnGUI()
    115.         {
    116.             //inouts
    117.             layout.Par(20);
    118.             input.DrawIcon(layout);
    119.             output.DrawIcon(layout);
    120.             layout.Field(ref intensity, "Intensity");
    121.             layout.Field(ref scale, "Size");
    122.            
    123.         }
    124.     }
    125. }
     
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    Sluta, has your tree a LODGroup component?
    Here you can see the boulders are rotated (and they scattered using the Tree Output, not an Objects one) just because they have a LODGroup with only 1 LOD level:
    BouldersRotated.jpg

    I don't really know how could World Streamer help you in rotating trees. It seems that it's absolutely unrelated with your problem.

    There is a better way - Blob Generator:
    SubtractGrass.jpg

    Hakazaba, unfortunately there is no way to force some chunk to generate from the other chunk's thread by design. But you can try calling it's thread function directly after checking if it exists and before getting origin matrix:
    Code (CSharp):
    1. chunkTarget.start = true;
    2. chunkTarget.ThreadFn();
     
  34. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I was assuming by manually he meant outside of MapMagic
     
  35. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    I just get this when i try to do that because chunk is null before it exists:


    [Error] Generate Thread Error:
    System.NullReferenceException: Object reference not set to an instance of an object
    0. TransformMatrix.Generate()
    1. Generator.GenerateWithPriors()
    2. Generator.GenerateWithPriors()
    3. Chunk.ThreadFn()
    4. Chunk.ThreadFn() Assets/MapMagic/Scripts/Chunk.cs:213

    I need a way to make it exist in the first place.
     
    Last edited: Oct 3, 2016
  36. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    I'm afraid that the misunderstanding occurred.

    First misunderstanding: (rotate trees + World Streamer = mistake)
    World Streamer - problem falling objects (such as NPC or animals) "into abyss", when terrain disappears during streaming.

    Secondly misunderstanding :
    Grass under the buildings - I know how to remove the grass from the objects placed by nodes MapMagic. But the buildings must be placed by MANUALLY, and i don't know how subtract the grass in such places


    So only SpeedTree can rotate...
     

    Attached Files:

    Last edited: Oct 3, 2016
  37. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Can anyone explain how the "width" and "height" parameters of (billboarded) grass work? I had expected them to be independent - and therefore by setting both to a range between 0.5 and 2, then I would get some short, fat grass, and some tall, thin grass. However, this doesn't appear to be what I experience - which is instead that I get some small (but otherwise well-proportioned) grass, and some large (but well-proportioned) grass - as if the two variables are correlated somehow?
     
  38. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    Is it a programing fix or just setting in the editor as its holding my project a but behind as the amount of rocks continuously crashes Unity and I don't want to go manually and remove them.
     
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    Yeah, my bad. If you are placing buildings manually why don't remove the grass under them with a brush? Or you are using some scripts for that?
    I don't really know if World Streamer will fix falling objects. I thinks that the best way to do that is script that casts a ray down "to abyss" from an object on Update - and if the ray hits nothing then freeze it.

    They work the same way the standard grass does :) MMWG uses the standard terrain with a standard grass, so it inherits all of it's limitations.

    It's a demo scene bug, a mistake in a graph. I've turned off a couple of nodes and forgot to remove a Split Generator. Does this bug appear in your scenes?
     
  40. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I think the part you may be missing is "Noise". A setting of 1 should give you grass at both extremes (I'm pretty sure).
     
  41. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    Thanks for the reply, but I don't think that's it. "Noise" affects how mixed-up the small and the large grass patches are: with Noise=0, I get clearly delineated patches where all grass is small, or all grass is large, say. With Noise=1, I get variation of sizes within a patch, but each individual grass mesh is still in proportion. What I want is for the height and width of each grass instance to be scaled independently somewhere within the min/max range specified.

    Interestingly, I have had some success though - by setting the minimum width/height to a negative value, I then get the desired variation. To demonstrate, here's the texture for my grass prototype:
    grass_original.png

    And here's what I get from fiddling with the grass settings:
    grass_scaling.jpg
    I had expected that setting both width and height to the range 1-10 would have resulted in my grass having any aspect ratio from 1:10 to 10:1 but, as you can see in the top examples, this clearly doesn't happen. However, setting the width range from -8 - 10 and I suddenly get the result I want. Not sure if this is a MM issue or a general Unity issue - I might dig into the code at some point and investigate, but it'll do me for now!
     
    protopop likes this.
  42. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    But after editing a brush, any change in the nodes MapMagic - generates terrain again and deletes brush changes (I use the demo v 1.4)
     
  43. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,275
    Standard Unity grass interface does not allow setting the negative size values, so it seems like sort of a hack. Anyways I didn't know that it works, thanks for the hint! :)

    You can lock the pinned terrain from changing using the Lock button (it works the same way as a Pin). This will do if you do not plan to change the terrain in any way further, but if you are going to go on editing textures or trees than I guess scripting is the only solution.
     
  44. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    It is possible in Terrain Composer 2. But MapMagic is better in other elements. Always is something for something. Write a script that removes the grass from under the buildings is still too difficult for me. However, thank you for your help.
     
  45. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    http://www.independent-software.com/removing-grass-from-a-terrain-in-unity/
    there's a good tutorial if you ever want to get into it. There is just a texture map, like a bitmap that says how many of what details are on each "section" of the terrain, so 128x128 or whatever your detail settings are at. Calculate what is where and you can delete or add anything you want by editing that "section."
     
  46. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    You need to lock the terrain section on which you've manually placed your buildings (and removed grass) to prevent them being recreated by MM.
     
  47. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, I just a question sorry if its been answered 1 million times before...
    How can I add a script to each terrain I need for UConstruct also the Layer... Also can RTP work with this yet?

    Thank you
     
  48. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    We are using you Demo scene as is, I don't see any split generator on the rocks graph. This is the demo scene that's just terrain not the islands.
     
  49. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    You can add the component to the "parent" object on which you place the MapMagic script and then select the "Copy Components to Terrains" checkbox. Or, you can assign a function that listens for one of MapMagic's events - e.g. OnGenerateCompleted - which will get fired after each new terrain chunk is generated and assign the component in that:

    e.g.
    Code (CSharp):
    1. MapMagic.MapMagic.OnGenerateCompleted  += MyGenerateNotify;
    2.  
    3. public void MyGenerateNotify (Terrain terrain) {
    4.     terrain.AddComponent<WhateverYouWantToAdd>();
    5. }
     
    malkere and llJIMBOBll like this.
  50. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hey, Thank you very much :D