1
\$\begingroup\$

I'm making a map generation script which generates different biomes: "land", "beach", "ocean" using perlin noise but the problem is that each biomes is at different heights for example i use

height = (int)PerlinNoise (seed,x,90,10,15); //for land
height = (int)PerlinNoise (seed,x,70,10,5); //for beach
height = (int)PerlinNoise (seed,x,20,10,35); //for ocean

This is the method:

float PerlinNoise( int seed, float x, float height, float scale, float roughness){
    Vector2 originPoint = new Vector2 ((seed + mapSize.x / 2) * roughness / mapSize.x, 0);

    float xCoord = (seed + x) * roughness / mapSize.x;

    return (Mathf.PerlinNoise (xCoord, 0) * scale) + height;
}

But my problem is merging between biomes, when i generate the terrain each biome just jumps down/up to the required height how can i fix this? I've tried using a lerp function but the map is generated left-right. Is there a way i can implement this in the PerlinNoise method so that if i supply the previous height and a weight it returns the next height as if the biomes where going to merge.

\$\endgroup\$
  • \$\begingroup\$ You could define biome-centers or biome-chunks and then linearly interpolate between those points: float height = Math.Lerp(height1, height2, distance) \$\endgroup\$ – Vengarioth Nov 30 '16 at 10:19
  • 1
    \$\begingroup\$ You should be sampling the same noise data, not one for each biome type. Take a look at jgallant.com/… \$\endgroup\$ – jgallant Nov 30 '16 at 10:20
  • \$\begingroup\$ Possible duplicate: gamedev.stackexchange.com/questions/55712/… \$\endgroup\$ – MichaelHouse Nov 30 '16 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.