Jump to content
Sign in to follow this  

Working With Height Maps ...

Recommended Posts

The Question:


I see on the Terrain Editor that there is a way to import a .BMP as a height map. What I'd like to do is crop out a certain portion of that .bmp file and use it as a map instead of what the DEM files give me.


Is there something special I need to do to it to get it to work? Because I can't seem to get it to.


The Answer:


You have to set up a new map in TE which matches the size of your cropped heightfield .bmp.


So, open TE, File\New from the dropdown will give you "New Terrain Dialog" Box. Leave Texture Tile and Height Field resolution as stock, unless you are confident playing with those settings. Adjust the Terrain Map Size setting to suit the size of your cropped .bmp. Your new .bmp has to be square. Also, in paintshop or whatever, ensure the colour mode for the .bmp is set to Indexed, NOT RGB, or TE won't be able to read it.


I think 1 pixel on the .bmp equals 2km in TE, so for 500x500 bmp image you would set terrain size to 1000km.


Also, when exporting/importing heightfield bmp to/from TE, look in the TerrainEditor.INI file (in TE folder) and check these settings are correct for the maximum peak height on your terrain:-









"HeightScale" is very important. TE has a pallette of 256 colours to cover the whole heightscale, with each colour representing a different height in the .HFD file. So, divide your max peak height (in meters) by 256 to get the correct heightscale setting for your particular terrain. Otherwise, when you import/export the bmp data to/from TE, you will get the peaks of your mountains chopped off. In the above example, the maximum peak height read by TE when exporting/importing heightfield as bmp is 17 x 256 = 4352 meters. Anything above that is chopped off and you will get tabletop mountains. Equally, if your max peak height is lower, you should adjust the heightscale setting for finer detail in terrain at lower altitude.


EG, max peak height 1250meters. 1250/256=4.88

Set HeightScale=5, for both import and export. That way, you will see more detailed terrain contours for that map, without losing the tops of your mountains.


The process is this:-


In TE, select as big a map size to cover the terrain you want. Import the DEM data as normal. This will give you "raw" heightfield data in TE.


In TE, float the cursor over the heightscale map over your highest peak to find the max peak height of the highest peak on your map. Divide that height in meters to get the correct figure to put in HeightScale= flag in TE (same number for both import and export, as above). Round up to nearest integer (whole number).


Edit terrainEditor.ini file with new heightscale setting.


Export bmp from TE.


Edit bmp in photoshop, gimp, whatever. You can expand the whole map to get full-scale terrain, or cut a piece out, flatten awkward bits of shoreline by hand, paint new mountains, whatever.


Save edited .bmp (make sure coloursetting is indexed, not RGB)


Create new terrain in TE with correct size for your edited bmp. (1 pixel = 2km)


Import edited .bmp to your new terrain.


You will know it has worked when TE shows new heightfield view.


(Wrench Note: this next paragraph is VERY Important!! It's also how I work Terrains, too!)

I have separate TE folders for each WIP terrain, to keep heightfield import/export settings correct for each terrain, and also because TE remembers a save file path and this avoids the danger of over-writing one map with another.


One more thing, I use a topographical colour pallette (in gimp) as that makes it much easier to see the different heights. The stock TE pallette shows very little variation between neighbouring height steps, which makes it difficult to do much else than edit coastlines using that pallette.


I see in TerrainEditor.ini there is a section for [HeightMapColor], maybe those settings can be adjusted to help with this?


Good luck,





With thanks to Pfunk, who asked the question, and Baltika, to who answered it!!



kevin stein

Share this post

Link to post
Share on other sites

This topic is now closed to further replies.
Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use, Privacy Policy, and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..