Contour drawing to heightmap converter


(PSIonic) #1

Hi all.

I’ve been trying to create a height map for my ET map’s terrain. However I find this very challenging because I get very bad frame rates when viewing my terrain in the editor and I also find it very tricky to communicate exactly how I want my terrain to look using simply a 256 colour height map. I bet a lot of people have that problem though.

I believe it all boils down to the fact that the human eye isn’t well equiped to distinguish between shades of colour… and just 1 shade down/up could mean a height difference of 16 units at least on most maps!

My proposed solution… use contours instead! Only problem is this… I can’t find a program capable of converting contour drawings to height maps. I don’t even have a standard format for a contour yet. Still, the idea is sound don’t you think?

I believe the result of such an operation would be a fairly smooth terrain map (unless you specify a LOT of contours). It should be a simple operation to add a little noice to the output though to create some roughness.

Would anyone care to discuss?


(nUllSkillZ) #2

I think contour maps are used in geography.
Some times ago I’ve been looking for data of the earth.
And I’ve found several files (I think it was some kind of database) and some kind of programs.
But I don’t know any web addresses any more nor the file extension or names of the programs.


(nUllSkillZ) #3

I’ve just remebered the file-extension: “.dem”
Have googled for it and have found a first link.
Actually it has been one of the first links I’ve found.
And I haven’t taken a look for the others.
But may be you now will be able to find some resources/information:
USGS Digital elevation Models (DEM)


(PSIonic) #4

Thanks nUllSkillZ.
I’m going to check out some of the software on that site. :drink:

If I can’t find any software capable of converting vector based contours into heightmaps for use with GenSurf, then I might attempt to program it myself (when I have a little more spare time!) :slight_smile:


(Chruker) #5

You might wanna have a look at the java program mentioned in this thread:
http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=2949


(PSIonic) #6

Interesting program. It makes some decent terrain with low poly counts. However, I find that you have to flip triangle pairs every now and then to get rid of step like terrain representation.
The program is especially useful for generating heightmaps from contour maps though. I would recommend it to anyone.

The best way I found to use it:

  1. Draw a very basic contour map from scratch using a graphics package like Paint Shop Pro (I assume PSP below). You just need to include enough contours to represent your terrain roughly.
  2. Use the program to interpolate the contour map. You will get a smooth heightmap.
  3. Now for the trick I worked out… use the posterize feature in PSP to reduce the number of colours. You will end up with another contour map. However, you don’t need to reduce the number of colours so much that it looks identical to the first one you made.
  4. Edit this contour map to better represent your idea of the terrain.
  5. Re-interpolate the contour map from (3) using the program.
  6. Use the heightmap which it now produces in GTKRadiant

I found this technique very useful for making sure certain features of the terrain are made exactly like I want. Roads for example need to be flat, so you can edit the second contour map to reflect that.

Note: It is sometimes useful to flood fill with a linear gradient 256 pixels wide, 1 pixel tall (i.e. one pixel per shade of grey), at the top of the contour map before interpolating, because otherwise the terrain heights will probably not be as you expect them to be. This is because contour maps don’t seem to set terrain vertex heights from the shade. Instead it set it from the shade relative to other shades in the contour map. Don’t know how else to explain that. :disgust: