Jump to content

  • Log In with Google      Sign In   
  • Create Account






More islands

Posted by JTippetts, 16 July 2008 · 483 views




Got the colormapping back up and running, and worked out a bug in the color curve as well. Tired now, and the Nyquil is kicking in.




Very pretty looking stuff. Some of the most realistic-looking procedurally-generated terrain I've seen as well. I take it you're using some sort of rules for the terrain colouring?

Also, is this going to be used in a game, or some project?
I'm considering making a Dragon Warrior-style old school RPG, only with procedural areas and questline. It's something I've been kicking around.

For generating these islands, I start with a 2D circle function, that returns 1.0 at the center of the circle, fading out to -1.0 at the radius, and I perturb it in the XY plane using a pair of fractal functions. In the above images, I'm using just 1 set of turbulence functions; I have gotten really nice results, though, by using 2 stages of turbulence. 1 stage is high-power, low frequency fractal noise to give the continent a very irregular large-scale shape, and the second state is high-frequency, lower power noise to give the coastlines detail. Either way works fairly well, and using a single stage is slightly faster.

I then branch twice from the perturbed circle in the module chain. One branch scales the output of the perturbed base map to act as a base continent elevation, to which subsequent terrain features are added. This has the effect of keeping the coastlines fairly low in elevation, and the areas further inland staying higher elevation. The second branch is a selection mask that returns 0.0 if a point is outside the perimeter of the island, and 1.0 if it is inside, with a very narrow blend zone right at the coastline. This is used later for masking out pieces of other functions to act as terrain features.

Mountains are simply a single 2D multifractal function, with relatively high frequency. Rough hills are another fractal function, a scaled-down high-frequency fBm fractal. For flat lowlands, I simply use the base continent elevation map.

To select areas of lowland, hills, or mountains I use 2 more fBm fractals as selection masks. The first fractal, called highlands, chooses between either rough hills or high mountains. By changing the threshold parameter and the falloff setting, I can modify the ratio of hills to mountains, and make the transition between them sharper or more gradual. The second fractal mask selects between lowlands or highlands, again with the same ability to modify the transition and ratio using threshold and falloff.

Once areas of lowland or highland are selected, they are further masked out using the continent mask. The blend-zone of the continent mask ensures that steep drop-offs where mountains meet ocean are made more gradual; although the falloff band is narrow enough that some pretty sharp cliffs still occur where mountains meet ocean.

I've simplified the color-mapping from what I have done before. Anything above a certain cutoff elevation is color-mapped from a curve ranging from a dark grey stone color to a white snow color. Anything below that is colored from a lowlands color scale. The lowlands base ground cover color is determined using a rainfall map. I take the perturbed continent base, invert it and apply another layer of turbulence. This creates a rainmap that roughly follows the pattern of wetter coasts and drier inland areas, although the additional turbulence modifies this pattern so that wet areas can appear far inland, and dry areas can appear near the water. The rainfall map is used as a simple curve-mapping parameter to choose from light green grass or brown desert.

In past iterations, I have applied a scaled turbulence map to the rainfall map, using areas of mountains to scale the turbulence so that the rainfall is highly perturbed in areas where there are sharp peaks and high mountains. This method more closely models reality, as can be seen in this average annual rainfall map of the US. It can clearly be seen that in the western US, where there are lots more high mountains, the rainfall patterns are far more highly agitated than in the central and eastern parts of the country. However, I have eliminated this elevation-based turbulence in the current model for simplicity.

A final fBm fractal map is used as a selection mask for forests. With a sharp falloff, the forests appear as sharp-edged splotches. Currently, forests are simply overlaid on top of the lowland groundcover, with no consideration given to whether the groundcover is grass or desert, so forests can appear in the middle of a desert. I'm still working on the best way of either modifying the character of the forest for dry areas (ie, creation of scrub-brush thickets, etc...), or masking out the forest completely above a certain dryness threshold.

This current scheme is sufficient for my current needs. Pretty much, I just need to create a few parameter maps (dryness, vegetation level, terrain type, etc...) so that I can create area maps to suit the local terrain. From the overmap will be created a tile-based map in the style of the old school RPGs, with areas of tiled mountains, plains, deserts, etc... As one wanders this map, random encounters draw them into battlefields that are themselves randomly created based on local terrain parameters.

I'm in the final stages of cleanup with the noise library before I release it.
PARTNERS