Community Forum

Heightmap vs. Actual Map Size & Density Map Questions

Forum Overview >> Editor

CategoryEditor
Created04.11.2021 19:33


Cory Rentz (coryrentz) 04.11.2021 19:33
First and foremost, my apologies for beating this subject to death. It would seem there is a lack of, or incorrect information out there regarding the size of the heightmap vs. the actual map size. The biggest confusion comes from the terminology used when referring to map sizes. It’s the whole 1x, 4x, 16x vs. 2km, 4km, 8km debate. If my math and research is correct, then the following table should show the correct correlation between heightmap size and actual map size. (Note: I don’t believe anyone has created a 64x or 256x map, nor do I believe GE/FS could handle that size.)

map_dem.png | in-game | kilometer | Map | GDM/GRLE
Resolution | coordinates | size | Size X | density map size
-----------------------------------------------------------------------------
1025 x 1025 | 2048 x 2048 | 2.1 km² | 1x | 4096 x 4096
2049 x 2049 | 4096 x 4096 | 4.1 km² | 4x | 8192 x 8192
4097 x 4097 | 8192 x 8192 | 8.2 km² | 16x | 16384 x 16384
8193 x 8193 | 16384 x 16384 | 16.4 km² | 64x | 32768 x 32768
16385 x 16385 | 32768 x 32768 | 32.8 km² | 256x | 65536 x 65536

n = heightmap width or height (use (n-1) if dem is +1 in size eg. 1025 instead of 1024)
km Size Formula: (n * 2) / 1000
Map size X Formula: (n / 1024)^2
GDM/GRLE Formula: n * 4

Here is a visual representation of what that looks like:
https://drive.google.com/file/d/1SRjiodKcTkJTE4zHRQHTyrex6D-1KT9R/view?usp=sharing

That seems to be straight forward and “easy” to follow, right? Well, it would seem maps are getting released stating they are size X, but are actually size Y. To show this I downloaded 25 various maps of different sizes and put all the image dimensions into a spreadsheet. You can see that here:
https://drive.google.com/file/d/1EYoFZNQG3t8SA5BJryZyy5UE9xR2hTh5/view?usp=sharing

This research also led me to my next question; what about all the other density maps (gdm, grle, .png)? While going through tutorials to figure out how to create my own map I read numerous times that I needed to increase the size of these density maps if I increased the heightmap size. Ok, to what size? As you can see from the spreadsheet the dimensions are all over the place. Is there supposed to be any correlation between the heightmap and the density map sizes? Does it even matter?

A point of interest: I also noticed that (almost) all maps are using a height scale of 255. While this can be used if you’re sculpting your own terrain, it’s not correct if you are using real-world terrain data.

I hope all of this makes sense and someone can verify my information and answer my questions.

Thank you ALL for your time and effort with GE & FS.

Colin Smith (WrinkleysRule) 04.11.2021 20:08
Grle/gdm maps are required to work to the power of 2 so
2k x 2k map --dem size 1024 x 1024 --grle/gdem 4096 x 4096
4k x 4k map -- dem size 2048 x 2048-- grle/gdm 8192 x 8192

"A point of interest: I also noticed that (almost) all maps are using a height scale of 255. While this can be used if you’re sculpting your own terrain, it’s not correct if you are using real-world terrain data. "

Only incorrect if your real world terrain scale ie. difference between min and max terrain exceeds 255m regardles of start level height.

Further info here,

https://farmerboysmodding.com/index.php?/topic/463-dems-and-borders-the-easy-way/

Cory Rentz (coryrentz) 04.11.2021 21:49
WrinkleysRule: I have updated the table in my post to reflect the GDM/GRLE resolutions. Thank you for that input. I've been meaning to read through your tutorial(s) while creating my heightmap. I'm not sure if the statement "Only incorrect if... exceeds 255m..." is accurate. The data that I pulled had a difference of 55m, and I could see quiet a difference when setting HeightScale from 255 to 55. However, this is where your tutorial will help me greatly as I didn't even think to apply a blur to the raw file to smooth things out. I did notice that I had to convert from the initial 64bit to 24bit or less, otherwise it caused massive spikes.

Actually, I’m pondering writing an application that will auto-create a mod map (all folders and files) based on user selections. For example, if you select a 4x map it will create the “map” folder with all the GDM/GRLE/PNG files in the correct resolution, as well as write all the .XML’s with correct data. Not sure if it would be of benefit for others in the modding community. Thoughts?


Colin Smith (WrinkleysRule) 04.11.2021 22:56
"I'm not sure if the statement "Only incorrect if... exceeds 255m..." is accurate. The data that I pulled had a difference of 55m, and I could see quiet a difference when setting HeightScale from 255 to 55"

You do not to change the HeightScale value in the map i3d, that is the reference point (0 -255 m) that mapDem .png works from and the shading is the various height levels.

The maximun bit range for a maoDE.png is 16 bit the DEM Converter v1.1.2 is for in the download section of this forum - to convert 8bit png's to 16 bit

I suggest you read the tutorial and actually create a proper mapDem.png in a map before confusing people with your incorrect assumptions.

Cory Rentz (coryrentz) 05.11.2021 00:52
“You do not to change the HeightScale value in the map i3d, that is the reference point (0 -255 m) that mapDem .png works from and the shading is the various height levels.”

Please see: https://medium.com/farmsim-forensics/farmsim-forensics-real-world-terrains-a-k-a-dems-934c267a60e5#:~:text=CRS%3A84%20coordinates.-,Elevation%20levels,-Next%20up%2C%20we

Mr. Brandwijk states: “…we need to figure out what the minimum and maximum elevation is in the tile. We need this information, because we need to tell GE what the heightScale of our DEM is (in other words, how many meters of elevation does going from completely black to completely white in our heightmap represent).” And under ‘Creating the heightmap‘: “Don’t forget to set the heightScale to whatever range you picked (in our case: 300)”
Following this tutorial tells me that no matter what the Min/Max is, I should update GE so it knows what the bottom and top of the heightmap is. – not to update “only if >250m.”


"I suggest you read the tutorial and actually create a proper mapDem.png in a map before confusing people with your incorrect assumptions."

That's the problem; my assumptions are BECAUSE I've read numerous tutorials and they do not cover a lot of that stuff, or they have conflicting information. Even your tutorial does not state the max bit range for a heightmap is 16bit. You do state "Paint.net not recommended as it doesn't appear to save in 8bit greyscale format," and you also give instruction to use your converter to convert an 8bit to 16bit. Well, when I created my .TIF files using MicroDem and exported my area to PNG, it exported to 64bit. (I will admit that I used Paint.net and it is possible things got messed up.) And before you rant about using TIF instead of Earth Explorer .dt2 files; the site I used (TNM Viewer https://apps.nationalmap.gov/) had more current images and only had GeoTIFF and IMG as export options. This is where I couldn’t use your tutorial for those steps.

With my research on all the various maps it's very apparent that not everyone is using the same "rules" that you may be using - it all depends on what "tutorial" you follow and the assumptions you make to fill in the blanks. It’s difficult as a new map creator to do things “correctly” when your examples may not be correct. Thus the reason for this post.

This is where an in-depth “How-To” or "Guidebook" from Giants would be beneficial. Then we can at least follow some standards.

PS: I am not calling anyone right or wrong. I am simply trying to get the correct information for myself and others to use. Please don’t take my replies as arguing- I’m simply trying to do some fact-finding.

Colin Smith (WrinkleysRule) 05.11.2021 13:13
The reason you have to be careful with any setting above 255m ( although you can go as high as 355) is the game engine does not create an accurate dem as it is only looking for a greyscale between 0 and 255 above which distortion will occur which is why I said do not change the setting.

The tutorial was written to be as simple as possible and not require initially any programming knowledge just an image editor.
In fact had you downloaded any file from the OpenDEm.info site you when unzipped you would have discovered it to be a Geo.tiff
this formatt was chosen because it can easily be dragged and dropped into Google Earth with no conversion or extra programming necessary.

With min and max height ranges (or Z Ranges in MIcrodem) as long as they are between the values of 0 and 255 there is no need to adjust anything, the heightScale in the mapi3d just gives the max level.
Dems do not need to be 16bit but can be easily created with 8bit images they just have slightly less detail and require more smoothing in GE which when you consider 1 pixel on your dem equates to a 2m square on your map is not too much of a problem.

Regarding height scales I have updated the relevant information in the tutorial to the following

" Zrange Values
If the difference in min/max height values is greater than 255m for example i.e 37 to 560m = 523m to keep the same ratio between the min and max heights it’s just a case of bit of maths

i.e. min 37 max 560 – ratio 560/37 = 15.13
max hgt in GE 255/15.13 = 17
so new Zrange will be min 17m, max 255m

If the max height is above 255 you will have to adjust the heightScale value in the map i3d to the higher value (not recommended but can be a max of 355m otherwise distortion will occur) and adjust the max height figure in the above example to suit

I use Qgis for all my dem creation as that is more accurate and has greater control over any height changes I need to make and also allows for different CRS settings for example TNM uses WSG 84 but UK Lidar uses EPSG:2700(OSB 1936 British National Grid) and one projection may differ by 5-10 miles in the same area.

It is up to you what Tutorial you follow but I suggest you read any throughly at least twice before starting



Note: Log in to post. Create a new account here.