Search Unity

Problem generating terrain on the fly

Discussion in 'Scripting' started by TheEnigmist, Sep 3, 2012.

  1. TheEnigmist

    TheEnigmist

    Joined:
    Jun 10, 2012
    Posts:
    51
    I'm trying to generate a terrain using NoiseLab's Chman. Well i'm pretty near to goal but i can't get what i want as terrain in Unity.
    I'm able to generate this png in Unity:

    So i know that color in Unity has a range of 0->1, same as heightmap. So i tried to use the same value used to generate this png for terrain and this is what i get:
    http://img685.imageshack.us/img685/8752/senzatitolo2bm.jpg
    http://img829.imageshack.us/img829/4928/senzatitolo1fk.jpg

    I don't know how to make it a playable terrain :(
     
  2. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Your image noise doesn't look that smooth eiter. Maybe try another noise type? I heard Simplex noise and Perlin noise are great for procedural terrains.
     
  3. Marrrk

    Marrrk

    Joined:
    Mar 21, 2011
    Posts:
    1,032
    The generated terrain looks like I would imagine the result. Whats your problem? I guess the high peaks? When you look over your generated png you see that there are high luminance peaks as well.
     
  4. TheEnigmist

    TheEnigmist

    Joined:
    Jun 10, 2012
    Posts:
    51
    Uhm ok, so i've to set less color to the image, i will try to divide all by 2 and let's see if i get a smoother image :p
    My script right now will set image from 0 to 1, what are a good range for a smoother terrain? 0->0,2?
     
  5. Marrrk

    Marrrk

    Joined:
    Mar 21, 2011
    Posts:
    1,032
    Nothing wrong with the 0..1 range, your algorithm only produces to high peaks sometimes, try to fix that.
     
  6. TheEnigmist

    TheEnigmist

    Joined:
    Jun 10, 2012
    Posts:
    51
    Yes :( i ported this:
    http://libnoise.sourceforge.net/examples/complexplanet/index.html
    to C#, and seems that i've to change input values (100+ input to check :S) or can i use the same value but use smoother render value.