kurt miller's homepage
( My development journal and homepage has moved to a new system here: kurtm.flipcode.com )

Basic Terrain Generation 10 November 2004, 4:39AM

I had some trouble sleeping tonight, as I found myself with a strange and sudden urge to mess with some terrain generation; partly to test the tool interface I talked about in my last update, and partly because I know there are some terrain-related algorithms/optimizations I've been thinking about recently that I'd eventually like to work with.

To start though, I just wanted to get something on-screen, which means I needed some elevation data to build the terrain from. After poking around the net for a bit, I found this page with some reference data. Unfortunately its in BT format, and I just wanted some greyscale heightmap images to work with. As a quick and hacky substitute, I ended up just using the pre-rendered texture from one of the data sets as the heightmap itself.

After a bit of coding on a terrain editing dll for the editor, a nice little heightmap loader and big 'generate' button let me finally get on with actually generating a terrain mesh. Here's a screenshot:



Not bad for an hour or so of work. Then again there's no magic involved here. The above mesh is built from a typical brute-force grid, which reads each pixel from the height map and sets the corresponding vertex to an appropriate height. What I'd like to do though is have every aspect of the terrain generation configurable in the editor, such as the height deltas, grid size, etc. I also plan to add some basic 2D 'paint' tools to the heightmap editor, where areas can be depressed and so on. As for how I plan to manage the level of detail and rendering in-engine, that's something I hope to spend some time on in the days to come. I'm just glad the editor interface is turning out to be as convenient as I'd hoped. Anyway, more later. I'm off to sleep.






Complete List Of Journal Updates:
  • Auto-Terrain Texturing (15 November 2004, 12:27PM)
  • On Orientation Interfaces (14 November 2004, 7:30PM)
  • Basic Terrain Generation (10 November 2004, 4:39AM)
  • Engine Tool Interface (07 November 2004, 2:37AM)
  • Render Buffer Ranges (02 November 2004, 5:15AM)
  • wxWidgets GUI Toolkit (29 October 2004, 2:31AM)
  • Generic Rendering Interfaces (27 October 2004, 6:55PM)
  • Source Documentation with Doxygen (25 October 2004, 6:34PM)
  • Signs of Life? (25 October 2004, 5:14PM)
  • Key Value Scripts (08 November 2003, 4:32PM)
  • Octrees for Potential Colliders (01 November 2003, 4:09PM)
  • Flexporter and Game Levels (31 October 2003, 12:14PM)
  • New Project and More Updates (31 October 2003, 6:14AM)
  • HSL Color Space (07 May 2003, 6:14AM)
  • A Couple Graphics Books (02 December 2002, 5:12PM)
  • Texture Detail Using Colored Triangles (02 November 2002, 3:26AM)
  • Voxel Mesh Creation and Rendering (27 October 2002, 11:30AM)
  • Development Journal (25 October 2002, 10:57AM)



  • Site Contents Copyright (c) 2002-2004 Kurt Miller. Please do not reprint this jibberish anywhere.