tags:

views:

96

answers:

6
+1  Q: 

Playable Heightmap

Hi,

I have a game with infinity procedually generated terrain. I'm using 1/f noise for the height (I think this is perlin noise?). Anyway it looks nice, but its not very playable since it doesn't really have flat areas. Just decreasing the amplitude won't work since I still want a large variation in height. Does anyone know of a filter I can apply to the heightmap to encourage flat areas while keeping a large range of heights?

Written in C#

EDIT: I've realised that what I want is for steep gradients to become steeper, and for flat gradients to become flatter. The terrain needn't be realistic, just "fun" for an FPS.

A: 

You can filter by median filter then. it will flatten your surface. But it will destroy mountains. This is fine for relatively flat areas like hollows and plateaus. If you want sharp mountains (with fast and big height diff) you should apply this filter selectively.

Andrey
+2  A: 

Not sure if this would help, but you could make that a range of your function is transformed into a flat surface with a high probability. For example all results between 0.1 and 0.3 have a 80% probability of end as a 0.1 surface. This way you encourage flat surfaces but keep the high variability you want.

Vicente Cartas
This made the terrain look very artificial, I got lots of flat surfaces, but they were all at the same level.
Hannesh
+2  A: 

I believe you need to use a smoothing function to get rid of the jaggedness of the terrain, if that seems to be your problem.

I only glanced through this page, but it may be a decent guide: http://www.float4x4.net/index.php/2010/06/generating-realistic-and-playable-terrain-height-maps/

Dr. Wily's Apprentice
That looks great! I'm trying to implement it but the erosion step doesn't seem to work well on my heightmap, I might just have bad params? I'll play around with it some more
Hannesh
A: 

You should look for more materials especialy on procedural textures and noise. Those three are related a lot. You should think about using more than one noise function with different parameters and combine them using different functions or operators.

To help your case, you can use one function to generate high-frequency noise and then multiply it by low-frequency noise. This will result in peaks where low-frequency noise is closer to 1 and flats where it is close to 0. Some kind of smoothing/erosion algorithm is cool too. But you will still need lot of trial and error and fine tuning your parameters to get at least usable results.

Some more complex terains may need over 10 noise functions with alpha blending or smoothing and such. Dont think you will get nice looking terrain from aplying simple filter.

Euphoric
+1  A: 

Simple noise is not enough to generate a good looking terrain. It's just one of the intermediate steps in a way more complicated process. You need to simulate some real world phenomena: temperature, erosion, precipitation, that sort of thing. It's a CPU-heavy process, usually, but well worth the effort. Here are some interesting links:

Dungeon League - read all of it. Great stuff.

World generation articles on The Chronicles of Doryen:

(You can download the generator too, but it's written in C++)

mingos
While I think it is good idea. I dont think OP needs such complex simulation. But it will give him nice idea how things really work.
Euphoric
+1  A: 

You need a "master random generator" that will decide what a new area should look like, with a frequency of your choosing. For mountains choose what you have already. For flats choose less noise.

Dialecticus