Not so uniformly random terrain

Started by
5 comments, last by Dwiel 20 years, 3 months ago
Hello, I have been working on the terrain generation for my 3D RTS game, and am having difficulties figuring out how I can make the terrain not so uniformly random... right now, I like the terrain that my perlin noise system is creating, but it seems that it is too consistent. There are no mountain ranges, no platoes, no lakes, no flat lands, no rolling hills... or at atleast, none of these land form can ever appear on the same map. I have seen plenty of pics where it looks like the terrain type is varied in a natural looking way, but they normally only explain the algorithm used to generate a terrain similar to like what I am getting. I have searched the forums a couple of times and havnt seemed to find anything that applied, which is why I am posting... if it has been, please give me some links cause I didnt see them First of all, I am looking at the terrain from above, so there are no skies to be rendered or horizons, etc... I would like to keep the advantages of using perlin noise: given a seed, re-create the entire map perfectly, use no externally created maps/models/etc, I would like everything proceduraly generated too... What kind of methods have you guys used/seen used to help simulate a realistic mix of terrain types, and how can it be implemented into a perlin noise function? The first thing that came to my head was to simply use a simple perlin noise layer with low frequency and low frequency to determine the land type... I would just cut all values of this layer to one an integer, and then assigning the integer to a terrain type. This has a couple of problems, it includes no interpolation between terrain types and only one terrain type can be assigned to each number, obviously, so each type can only touch the types with the integer value above and below it... not sure if that makes sence... I also found that this doesnt work well, because certain types of terrain are found in different formations than others... like mountains noramlly come in ranges, lines, gorge in a kind of fractal patern, and many others in a grouped manner like desserts, rolling hills, flat grasslands, etc. How can I make it so that the types of terrain are created in a way that is unique to them? hopefully Ive made some sence durring that ramble... Thanks! Dwiel
Advertisement
Look into midpoint displacement

You can also consult
this

Remember you can still uniformize it with some kind of noise...

You uniformize a lot at some points more than other, to create plains.

You uniforize it less and voila you have mountains...

You could divide the terrain into some kind of n by n sections and take parameters for the roughness of each section...

Anyway, just my two cents.





[edited by - xmcbainx on January 5, 2004 2:18:19 PM]
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style
Forgive me if you already know this, but just plain old noise is pretty boring. One thing you should experiment with is using a noise function as a basis and playing around with it. Check out this slide and the three after it to get an idea of how to do this.

Your idea of using a low frequency noise to determine terrain type is a good one, you're just going about it wrong. Don't simply clamp the noise values to integers and use those integers as specific terrain types (at least I think that's what you meant by "cut all values to an integer"). To create more natural terrain (i.e. terrain that transitions nicely between hills/mountains/plains) use that 'master' noise function to blend between different terrain types. Try something like this:

Create your master noise function that will determine the terrain type. Map a few key noise values to specific terrain types (what values and what terrain type is totally up to you), for example:

1.0 - mountain
0.5 - rolling hills
-1.0 - plains

Then create a different noise function/height map for each terrain type (see the slides I linked above):

mountain = sum(1/f(|noise|))
rolling hills = lower frequency & amplitude noise function
plains = even lower frequency & amplitude noise function

Blend those height maps together linearly, using the value in the master height map as the blending factor. This will make a relatively smooth transition between terrain types. The basic algorithm for blending the maps together at a point (x,y) is:

1 - figure out which terrain types the value of master(x,y) falls between (e.g. if master(40,20) = -0.32 then it's between plains and hills)
2 - calculate the fractional distance this represents between the two terrain types (e.g. abs(-0.32) / (0.5 - -1.0) = ~0.21 so it's about 20% hills and 80% plains)
3 - use this fraction to blend the height maps (e.g. the final value is (1 - 0.21)*plains(40,20) + 0.21*hills(40,20))

And there you go, smooth transitions between terrain types.

You can use similar principles to create plateaus, lakes, etc. but I'll leave that up to you. There's also lots of ways you can modify this method to get different (possibly better) results.

[edited by - Dobbs on January 5, 2004 2:27:32 PM]
I really like the idea dobbs, I''ll be implementing something like it soon. This method easily transitions between mountains/hills/flatlands, which is good, but Im not sure how to implement the other kinds of things that are kinda mixed in there like gorges, platoes, etc... Luckily those arent really all that important, and I would rather spend more time on other things than worring about how to get those in there.

Thanks for trhe help guys!

Dwiel
The method described (having master noise, to govern the blending of the octaves or the perlin noise) is a very good scheme. I have used it myself, and was very pleased with the results. It gave me an infinite (non repeating) terrain, with lots of character. You can also make lakes, rivers and seas.. or get it to generate islands too. None of these are too hard (though rivers are a bit of a pain). Good luck :D
Glad that helped, but I just realized my math was off a little in my example. This:

quote:
1 - figure out which terrain types the value of master(x,y) falls between (e.g. if master(40,20) = -0.32 then it''s between plains and hills)
2 - calculate the fractional distance this represents between the two terrain types (e.g. abs(-0.32) / (0.5 - -1.0) = ~0.21 so it''s about 20% hills and 80% plains)
3 - use this fraction to blend the height maps (e.g. the final value is (1 - 0.21)*plains(40,20) + 0.21*hills(40,20))


Should be more like this:
1 -> master(40,20) = -0.32
2 -> blending factor = (master value - lower bound) / (upper bound - lower bound) = (-0.32 - -1.0) / (0.5 - -1.0) = ~0.45 so it''s 45% hills and 55% plains
3 -> the final value is (1 - blending factor)*(lower value) + (blending factor)*(upper value) = (1 - 0.45)*plains(40,20) + 0.45*hills(40,20)

If you think about it, a gorge could just be a very quick transition from mountains -> plains -> mountains in your master noise function. This means that instead of using a plain noise function to generate the master height map you would use something more interesting that will generate those kind of features.

Plateaus are basically just plains but at a higher altitude. You could probably implement them as another terrain layer like this:

-1.0 = plains
0.0 = hills
0.5 = mountains
0.7 = plateau (plains)
1.0 = mountains

And then use a plateau noise function that has low frequency and that generates relatively high, positive values, something like (noise/16 + 0.6) which varies roughly between 0.54 and 0.66.
Thanks for the ideas dobs! Your ideas have been very helpful. I''ll let you know what kind of results I get as soon I get some in! I''m really looking forward to getting this implemented, especially with people giving testimonials as to how well it works

Thanks again everyone!

Dwiel

This topic is closed to new replies.

Advertisement