Spreading out continents in a Perlin noise-based terrain generator

Started by
4 comments, last by OpOpOpOp 10 years, 2 months ago

I made a terrain generator for a game. It makes some nice terrains with water, land, and mountains. However something seems off about the output. After some thought I figured it out: there are too many little islands laying around for it to look realistic. You don't see that on a real world map.

Is there a "clean" way to solve this problem? I could simply calculate the size of every landmass, declare the larger ones as continents, and then delete all the smaller islands within X distance of the continents, but that feels like a hack so I'm wondering if anybody has a better idea. Thanks in advance.

Example file: http://i.imgur.com/QRwU4Bg.jpg (warning: it's almost 5 megs in size)

Advertisement

One typical way to tweak the perlin noise terrain to make it look right is to simply add (or subtract) a constant offset from the function, thereby literally raising or lowering the sea level. If you raise it, you should get a lot more water and much fewer tiny islands. Also, your perlin noise does seem a bit off, are you sure you are reducing the amplitude properly as the frequency increases? You seem to have some pretty sharp peaks, normally perlin noise is a bit smoother.

Another more advanced method is to take your mesh and smooth it out a little bit to simulate erosion (such as an average, or a rule which lowers a point's height depending on neighbouring heights) which would tend to get rid of the small islands while only eating a little bit at the large continents. It is mostly tweaking, really, there is no magic setting that'll make things look earth-like.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

You can do a few passages of smoothing pixel by pixel: you take a couple of peeks and begin smoothing the surrounding pixels.

Example, say a peek for you map is a height value of 9: the surrounding pixels might have 8, then 7, then 6 and so on.


from this randomic noise:

9 8 6 0 8 5 2
4 2 7 2 0 7 3
1 4 2 6 2 4 0
2 4 2 0 9 3 9
3 9 1 9 2 0 2
8 2 5 2 0 4 2

to this (choosing a high value of 9 in row 3, col 4

5 6 6 6 6 6 6
5 6 7 7 7 7 7
5 6 7 8 8 8 7
5 6 7 8 9 8 7
5 6 7 8 8 8 7
5 6 7 7 7 7 7

this will generate a mountain with smooth degradation: with a couple of these your map will probably looks better. Choosing a minor peek you will be able to preserve more water, but you can also do the inverse and choose the lowest value (this will create an abyss on your map). Play with it.

If your height function only contains high frequencies, you would get a lot of little islands. This suggests that maybe you need to add some lower frequencies to your Perlin noise. Perhaps that's not enough to solve your problem, but I think it would probably help.

You could do 2 passes. The first pass with low frequency and the second with higher frequency, adding them together. The first pass should have a higher weight than the second.

One typical way to tweak the perlin noise terrain to make it look right is to simply add (or subtract) a constant offset from the function, thereby literally raising or lowering the sea level. If you raise it, you should get a lot more water and much fewer tiny islands. Also, your perlin noise does seem a bit off, are you sure you are reducing the amplitude properly as the frequency increases? You seem to have some pretty sharp peaks, normally perlin noise is a bit smoother.

Another more advanced method is to take your mesh and smooth it out a little bit to simulate erosion (such as an average, or a rule which lowers a point's height depending on neighbouring heights) which would tend to get rid of the small islands while only eating a little bit at the large continents. It is mostly tweaking, really, there is no magic setting that'll make things look earth-like.

I calculate the sea level after the terrain is generated, because there's a "land percentage" setting. I basically set it to zero and then raise it until the specified proportions are met, so that pixel in the terrain that's lower than that value will be set to water. This doesn't alter the noise.

You are correct though, I didn't change the amplitude. I just re-read the article where I learned Perlin noise from and realized I missed that step. Every layer goes from 0.0 to 1.0. I'll go correct that now and see how it looks.


You can do a few passages of smoothing pixel by pixel

Actually it does have a smoothing step. That particular map was smoothed for 16 passes if I recall correctly, but it's not peak-based as what you mentioned. I'll give that a try.

If your height function only contains high frequencies, you would get a lot of little islands. This suggests that maybe you need to add some lower frequencies to your Perlin noise. Perhaps that's not enough to solve your problem, but I think it would probably help.

There are both. I think my problem is what Bacterius said, I didn't alter the amplitude.

You could do 2 passes. The first pass with low frequency and the second with higher frequency, adding them together. The first pass should have a higher weight than the second.

Yep, that's what Perlin noise is. That map has 10 layers: 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, and 8.

Thanks everybody a ton!

This topic is closed to new replies.

Advertisement