- Home /
How can i make this noise generated terrain more interesting?
Hello all,
how can i make the noise for my terrain generation more interesting? The terrain is generated by 3 Perlin-noises which are being combined.
The terrain looks like that (i had to compress the screenshot since it was too big for this thread. The full version can be found at the link below) : Screenshot
As you can see the terrain is bumpy and repeats itself pretty quickly. So i would want some more flat areas in there.
Currently the terrain is generated using 3 Perlin-Noises, here is the code:
The Perlin class is provided by the libnoise C# port.
Setting up the noises:
baseTerrianLayer = new Perlin();
baseTerrianLayer.Frequency = 6f;
baseTerrianLayer.Lacunarity = 1;
baseTerrianLayer.OctaveCount = 1;
baseTerrianLayer.Persistence = 1;
secondTerrainLayer = new Perlin();
secondTerrainLayer.Frequency = 0.02f;
secondTerrainLayer.Lacunarity = 1;
secondTerrainLayer.OctaveCount = 1;
secondTerrainLayer.Persistence = 0.05;
thirdTerrainLayer = new Perlin();
thirdTerrainLayer.Frequency = 6;
thirdTerrainLayer.Lacunarity = 4;
thirdTerrainLayer.OctaveCount = 3;
thirdTerrainLayer.Persistence = 2;
Now getting the height for each block in each chunk:
float n1 = (float)Generator.baseTerrianLayer .GetValue(xCoordinate, 0, zCoordinate);
float n2 = (float)Generator.thirdTerrainLayer.GetValue(xCoordinate, 0, zCoordinate);
float n3 = (float)Generator.secondTerrainLayer.GetValue(xCoordinate, 0, zCoordinate);
float n = (n1 + n2 + n3) / 3f;
float mappedNoiseValue = Map(0, 120, -1, 1, n);
float height = FastFloor(mappedNoiseValue);
Here is the mapping and the fastfloor method:
float Map(float min, float max, float omin, float omax, float value)
{
return Mathf.Lerp(min, max, Mathf.InverseLerp(omin, omax, value));
}
private static float FastFloor(double f)
{
return (f >= 0.0f ? (int)f : (int)f - 1);
}
I hope that somebody can help me with that!
Thanks in advance
- Damian
Answer by avallsrodriguez2138 · Jan 07 at 09:46 PM
@Razor1994 There are lots of ways to create terrains more dynamic and interesting!
INTRO
You can already start doing it tweaking easy things like giving it a bigger amplitude (aka elevation range), creating mountains and lakes, coloring the landscape based on the vertex heights, and adding a blue plane simulating water
JSFiddle Perlin Noise demo: https://jsfiddle.net/alonso2138/7oj8y2fe/33/
If you want to go further, try biomes, biomes can be a really difficult challenge because it is difficult to determine dynamic areas and assign a biome to it thinking that it has to be determined by its neighbor's areas.
Well, don't panic because here you have two approaches you can take to implement biomes into your world:
CLIMATE SIMULATION
This can sound like an extremely difficult approach but it is indeed the easiest one:
Take at least two noise-generated planes different from each other. If you only have one noise function you can play with offset, frequency, and layers to create two different planes. Layers are something important to talk about; you take many noise-generated planes varying the frequency and then mix them up in a new blank one (by iterating through each vertex and mixing the different geometries in different ways; adding dividing subtracting... until you get something you like). These planes will be temperature and humidity simulations, the higher the point in the temperature plane is the hotter the place is. The quality of the climate depends on the processing effort you want to put on and the number of layers/climates simulations you do. Now you have to apply each vertex in your final plane (totally flat and blank) a biome. This is a chart I made to help me with my world creation, but you can create your own one with fewer biomes:
In my world, the climate simulation plane's elevation amplitude is from -3 to 3 which is why it's based on those values.
The next step is having a special configuration for each biome; ground color, plants, and animals species that can generate in those vertices, and the most important; terrain shape. Look at Minecraft: each biome has a characteristic topography that makes each biome almost unique, it's important because it's the most visual thing. So instead of using a simple noise plane, use a noise-generated plane for each biome with its own options, just like in the climate simulation. After all of this is done, you will notice once you get to the frontier between two biomes that they are not continuous with each other. This is normal as they have different generation algorithms so, the solution is very simple: "weights"! Weights are a way to calculate an average between the two functions to bring them together in a continuous way. For example, you are in a grass biome, everything is pretty flat, if we suppose you are in a full-grass position, then the grass weight is 1 and all the other biomes' weight is 0. Let's say you get closer to a mountain biome, then, the grass weight will get smaller and the mountain biome weight will get bigger (you will notice that the terrain is as the weight changes it becomes more a mountain-like biome) until you get to a point that is totally mountain biome, with a mountain biome weight of 1 and grass biome weight of 0.
VORONOI BIOMES
Sadly I don't master this approach since I find the best one is the climate one but, this approach consists of having a Voronoi or Worley continuous noise function and using those cells as biomes to make their shape of them look dynamic and more organic. Then to determine the cell's biomes you iterate through every cell and check if every biome could be assigned to that cell according to certain rules made by you. For example, mountain biomes have to be at least 2 cells away from beach cells. The using the weights which are already given by the noise; the intensity of the color in each cell to create the transition between both biomes, as you see the white vertices are the center of the cells, where the weight is 1 and the black vertices are the edges of them where the weight is divided into the neighboring cells weights.
CONCLUSION
Sorry for the simplicity of the Voronoi approach I provided but I wasn't able to fully implement it in javascript to give you an example. Anyways, both of them have great potential and can make awesome and realistic landscapes. Just try things until you get what you want. With procedural generation, almost any result works well.