Sign in to follow this  
grillsnusk

Contour maps and height maps

Recommended Posts

Hey there! I have browsed around the internet a bit without finding anything that can help my particular problem... I would like to use an height map, but since my app only has access to (very) very little disk space I must save the height map in some other form, namely topology contour maps (I hope you know the kind I'm talking about :) ). The thing is, I've not been able to figure out how to "decompress" such a contour map into a grayscale height map, which I intend to do on smaller portions of the map, as they come along. My app is not very dependent on speed, so it doesn't matter if the contour map -> height map conversion takes a little time. So, basically, what I'm asking is, how do you go from a countour map to an height map? Any links or tips are much appreciated! Thanks in advance! /Magnus

Share this post


Link to post
Share on other sites
Really, how little space are we talking about here? How big is the world? Would an image really be too large?

Anyways, if you're going to start with a contour map, why not create an appropriately sized array, and go through and set the heights of the points that fall along the lines of contour. After that, you could simply interpolate the values of any field that is unset. With bilinear interpolation, it should be too hard, and you can always iterate until all fields are full.

Share this post


Link to post
Share on other sites
How about constructing a finite element approximation based on the contour lines? I mean, a piecewise continuous function F(x,y) whose values are fixed at points belonging to the contour lines and interpolated everywhere else.

The simplest way to do this would be to sample the contour lines at N points. We'd obtain an N point set which we can triangulate using standard algorithms. This corresponds to a piecewise-linear approximation of F.

After triangulation we have a representation for F, the triangle mesh, which we can sample to construct the heightmap.

-- Jani

Share this post


Link to post
Share on other sites
Thanks for your replies!

We're talking around 100k for map storage, and a pretty vast map ;)

I've thought about that bilinear interpolation approach, and I think it would actually suit me quite well :) Thanks for sparking the idea!

/Magnus

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this