- Home /
Terrain generation problem.
Hello.
So, I've managed to make a terrain generation script, which generates random continents, but there's one problem. Since I'm using the Libnoise library, when I use some of the noises, they have some zero values. Because of that I have to raise the whole terrain a little, which creates these nasty looking cliffs.
Is there a way to smooth these cliffs out via script?
-Xentarok
P.S: I apologize for any mistakes.
P.S2: If you have questions, write them down in the comments.
Answer by kingmac2104 · Feb 11, 2014 at 04:47 PM
What about getting heights Array from TerrainData and going linear through them searching for a height increase from 0 to maybe 0.5 or from >0.5 to 0, take the half of the difference and put it too the array back where the values are 0. A small example:
0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5
0 0 0 0 0 0 0 0 0 0 1 2 3 3 3 4
0 0 0 0 0 0 0 0 0 0 0 1 2 4 5 6
would end after frist step in:
0 0 0 0 0 0 0 0 0 0 0.5 1 2 3 4 5 <= Change here
0 0 0 0 0 0 0 0 0 0 1 2 3 3 3 4 <= this line has not 0 directly under the frist 1 in the line above
0 0 0 0 0 0 0 0 0 0 0 1 2 4 5 6
seccond step:
0 0 0 0 0 0 0 0 0 0 0.5 1 2 3 4 5
0 0 0 0 0 0 0 0 0 0.5 1 2 3 3 3 4 <= Change here
0 0 0 0 0 0 0 0 0 0 0.5 1 2 4 5 6 <= Change here
So always the direct neighbours of the heightincrease should be manipulated.
I think that should smoothen the cliffs enough
Actually, in the end I used a different method. Because I have the generation in two steps, I added the height values from the first step (which is creating the basic continent shape) ins$$anonymous$$d of adding just the same value to everything in the second step. But thanks anyway!