开发者

Playable Heightmap

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 b开发者_如何学Goecome steeper, and for flat gradients to become flatter. The terrain needn't be realistic, just "fun" for an FPS.


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/


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.


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.

  • http://www.dungeonleague.com/

World generation articles on The Chronicles of Doryen:

  • http://doryen.eptalys.net/2010/01/back-to-the-caves-world-generator/
  • http://doryen.eptalys.net/2010/01/the-cave-map-with-ice-floe/
  • http://doryen.eptalys.net/2010/01/the-caves-biome-map/
  • http://doryen.eptalys.net/2010/01/nifty-debug-maps/
  • http://doryen.eptalys.net/2010/01/improved-precipitation-map/
  • http://doryen.eptalys.net/2010/01/biomes-balancing-and-rivers/
  • http://doryen.eptalys.net/2010/01/rrt-rivers-until-i-get-something-better/
  • http://doryen.eptalys.net/2010/01/disco-time/

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


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.


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.


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.


What you can do for an easy and ok looking solution is to Evaluate the height you get from your noise map with a custom curve function.

For example you can make your curve map noise points from 0.1-0.3 to 0.1-0.15 and then from 0.3-1.0 to 0.15-1.0.

This way you still keep the actual roughness of the terrain but make it flatter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜