Heightmap creation from topography

The aim of this project is to render a map, starting with the topography of the map ie lines of equal height (level lines).

From level lines of the map, I generate a heightmap picture. Each pixel correspond to a vertex of the terrain, the color correspond to the height of the vertex. This picture (called heightmap picture) can be used to render the map.
To render the heightmap, it can requieres a lot of vertices (for example, a 1800x1400 pixels map is about 5 million of vertices). To save performance, the space (ie the map) is partitionned in small cubes. Each cube are rendered only if they are visible (ie intersect with the frustum).
 

For generating the terrain, I start with the below picture :


Level lines
Taken from a real map !

The image is read and level lines are detected and rendered as colored lines in the next screenshot :


Flat map rendered with level lines
Level lines are extracted from the above picture

Each lines is affected with a different each :


A height is assigned to each level lines

and finally a flat heightmap is generated.


Flat 'Heightmap' generation
Generated using level lines and height value

Here are the first attempts to generate a smooth heightmap, you'll see some notable artifacts:


Heightmap generation
Generated using level lines and height value

This project has not gone really farter than that, so the final pass has just been generated using a gaussian blur image processing algorithm:


Heightmap smooth
Generated heightmap + a blurred filter

 

To optimize rendering of the terrain, its is partitionized on multiple box areas, or 'octree'. The terrrain in each octrees is rendered only the octree volume is visible by the camera. Some screenshots showing different octree volumes:
 


Terrain rendered


Full map rendering + Octree (cubic boxes)
from two view point


Full map rendering + Octree optimized (parallelepiped boxes)
from two view point
 

 

 

Copyright © 2004-2012 Jérôme Jouvie - All rights reserved. http://jerome.jouvie.free.fr/