Saturday, 27 December 2008

Geomorphic landforms

The previous blog entry was about cosmetic changes. This one is about adding landforms to the terrain. The Perlin terrain works well for generating your basic (perhaps flattish) terrain, but I want to be able to place specific obstacles at specific locations. Not obstacles that are placed on the terrain: but rather obstacles that are part of the terrain.

I am thinking about volcanoes and craters. A volcano is a cone shaped mountain with a hole in the middle. The cone surface is made less smooth with randomised adjustments. Although a crater is simply a large hole with an elevated rim at its edge; it gets slightly complicated when you consider that the rim must fit nicely with the original landscape.

The implementation starts with a definition for the ILandform interface. Instances of this interface is added to an object that inherits from HeightMap via the Landformations member on this class. Right after the heightmap itself is established each of the landforms in this collection are initialised. The lanform has full access to the heightmap data. The classes LandformVolcano and LandformCrater embodies the volcano and crater functionality. Not really much code there; but some experimentation was needed to get things just right.

I must admit, gross shortcuts were taken. There must be more geomorphologically correct ways to build these landforms (and I cannot help but feel my volcano can do with some smoke). Alas, these artifacts are good enough for my current expectation. The image above shows a crater next to a volcano. I am sure you can spot the difference between the crater pool and the Perlin pool.

No comments:

Post a Comment