Skip to main content
GameDev.net gamedev.net
🔒 Locked

Contour to Heightmap

Started by colinolivant Jan 15, 2007 at 5:08 AM 2 replies 5.2k views
Original Post
colinolivant
colinolivant
I am trying to convert a contour bitmap file into a heighmap .raw file. The contour map only has contour lines on and nothing else. Any ideas? Thanks C.
Demus79
Demus79
Hello,

What you are after is nearly impossible, since sometimes it is even difficult for a human to trace a contour line.

However, you could study bitmap vectorization and be able to create polygonal contour lines that way. Then, somehow someway you'll need to find a way to assign the heights for the contour lines. Maps usually have information about the slope direction for the contour lines, so that could also be used. If you are able to build such a intelligent program, please let me know :)

Practically, to calculate heightmap from a contour lines is quite simple. You'll just need to find the distance from the sample point to the base contour line and to a contour line inside that base contour and use it as a factor to find the height. But once again ... you'll need polygons and their heights ... not a bitmap contour.

Cheers !
Drazgal
Drazgal
Try looking at the paper here (pdf link to the top right) and the similar pdfs that it links to, this should give you a decent base to start work off.

colinolivant
colinolivant
Thanks for the reply.
My idea is...

Load Bitmap Image of Contours
Ask the User to Select the Lowers Points on the Map
Ask the User to Select the Highest Points on the Map
Workout the Gaps Between Each Contour
Set Each Gap With its Correct Height Value
Perform a Smoothing Algorithm Over the Whole Image (Gaussian Blur)
Export to .raw Image File For Rendering With Terrain Render

I dont think that should be impossible?

Example pic:
http://www.colinolivant.co.uk/Contourconverter.jpg

Any thoughts?
C.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.