Converting Contours --> Height Map

Please post here for questions and discussion about unit modeling and general game modding. You can also post your new units and modifications here.

Moderator: EagleMountainDK

Post Reply
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

Converting Contours --> Height Map

Post by Mraah »

Ok everyone ... I don't have much time to go into a full explanation ... This is helpful if you have a contour map of of the area you want to build a map mesh ...

If you've been following my map making saga on building the town of Singling I'm currently designing the Height Map for the town. Unfortunately Nem's wasn't working too well for me because I needed an exact replica of the hills ...

So, after hours of experimenting I decided I needed to build a Height Map from scratch!!

Quote from the Ca3D-Engine website, definition of heightmap ...
A height-map is usually a square gray-scale image whose black pixels represent the lowest heights (0%) and whose fully white pixels describe the highest heights (100%). The gray values between them represent intermediate height values – the brighter a pixel, the higher is the resulting terrain at that spot.


The image is 256 gray scales. So, this means that you can have exactly 256 changes in elevation. In my case, I'm going to call each change as one meter.

I took my color map image of Singling and superimposed the contours on it. This took some time to get the scale right but it worked. Your image must be square in size ... mine was 832x832 pixels. After this, I made a new image with the same dimensions using totally white as the background. Then, I pasted this image as a new layer over my color image. From there, I painted the contours on the white layer using a slightly darker shade of gray. (My screen shot is exagerated for demo purposes.)

Once that was done, I copied and pasted the newly painted contour image as a new image, and saved it as a 64x64 BMP. I loaded up MS3D, using the heightmap tool I just loaded it up and viola!

Again, this is a quicky tutorial. As my work continues I'll show what it looks like with finer elevation changes.

Hope this helps !!!

Rob
Image
Attachments
contour1.jpg
contour1.jpg (529.31 KiB) Viewed 159 times
rickier65
Posts: 14241
Joined: Thu Apr 20, 2000 8:00 am

RE: Converting Contours --> Height Map

Post by rickier65 »

Rob -

i'll be looking forward to see how this progresses !

Thanks
Rick
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

RE: Converting Contours --> Height Map

Post by Mraah »


Below is a screenshot of my first version. The contour's are more to scale. It doesn't look very hilly ... the height range was only ~ 30 meters and when scaled to a 1000 meter horizontal plane it really isn't much ... hard to tell from screenshot anyway.

I did learn a few lessons :

1. Since I didn't use Nem's and just made a 64x64 height map I still had that "Lip" problem Stridor had. Mine was opposite though ...my lips folded down a bit on the edges. I fixed this by carefully moving the vertexs up a bit, but some evidence of lips can still be seen. I might suggest making a 66x66 map and then cutting off the one grid lips all the way around. Perhaps this is why Nem's defaulted to 65x65 ... it's like working with clay, you smash into a flat shape then trim the edges square.

2. The contour interval I used is ~ 6-7 meters per contour ... still rough and hills not perfectly smooth ... I may add another contour layer to smooth out the edges. I did a little amount of smoothing using Stridors "blur" and MS3D smooth .. both helped but I think extrapolating another contour is needed. I'm not too concerned though ... hills in real life aren't perfect anyway.

So ... I had good results. It does require patience and a steady drawing hand plus some math to figure out how much gray scale change equates to one meter ... (1 gray change ~ 1.333 meters using PcK 1km maps) so if you want to replicate an exact location it will be more work ... but can worth it.

I've still got more detailing to do besides getting the contours right, like a few raise roads around the fields, blah ... blah ... blah.



Image
Attachments
singlingv01.jpg
singlingv01.jpg (358.46 KiB) Viewed 157 times
User avatar
Stridor
Posts: 1391
Joined: Sat Sep 08, 2007 11:01 am

RE: Converting Contours --> Height Map

Post by Stridor »

Rob,

Looking really good!

That bevel like lip you have is because the smoothing groups got stuffed up. You can delete the smoothing group for the terrain mesh and reassign a new one and that should fix your little lip problem.
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

RE: Converting Contours --> Height Map

Post by Mraah »

By the way ... if anyone want's to try it, copy and paste my screen shot into your paint editor, then crop out the gray scale image in top left corner (I added this just for that purpoe). Then paste as new image, and resize it to a 64x64, (original size is 256x256) and load it into MS3D and have a peak.

Rob
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

RE: Converting Contours --> Height Map

Post by Mraah »

ORIGINAL: Stridor
Looking really good!

That bevel like lip you have is because the smoothing groups got stuffed up. You can delete the smoothing group for the terrain mesh and reassign a new one and that should fix your little lip problem.

Thanks ... it took me about 4 hours to do which includes numerous drink breaks and phone call interuptous.

Delete the smoothing group? I'll need some help with that ... like, which menu in MS3D and at what stage of creation?

I'll review your tut's again for the moment.

Thanks!
Rob
User avatar
Erik Rutins
Posts: 39324
Joined: Tue Mar 28, 2000 4:00 pm
Location: Vermont, USA
Contact:

RE: Converting Contours --> Height Map

Post by Erik Rutins »

ORIGINAL: Mraah
Below is a screenshot of my first version. The contour's are more to scale. It doesn't look very hilly ... the height range was only ~ 30 meters and when scaled to a 1000 meter horizontal plane it really isn't much ... hard to tell from screenshot anyway.

Looking good and yes, it can be hard to see contours from a zoomed out above view. We had the same trouble showing that some maps weren't "flat" in our promo shots.
So ... I had good results. It does require patience and a steady drawing hand plus some math to figure out how much gray scale change equates to one meter ... (1 gray change ~ 1.333 meters using PcK 1km maps) so if you want to replicate an exact location it will be more work ... but can worth it. I've still got more detailing to do besides getting the contours right, like a few raise roads around the fields, blah ... blah ... blah.

Shaping up very nicely though - congratulations! I look forward to playing on this one.
Erik Rutins
CEO, Matrix Games LLC


Image

For official support, please use our Help Desk: http://www.matrixgames.com/helpdesk/

Freedom is not Free.
User avatar
Stridor
Posts: 1391
Joined: Sat Sep 08, 2007 11:01 am

RE: Converting Contours --> Height Map

Post by Stridor »

Rob,

It is under Groups tab, smoothing groups. Have a play around it is pretty straightforward. Delete the old group and reassign (or auto assign) a new one. That little edge problem will the disappear.
Post Reply

Return to “Maps, Models and Mods”