Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Height map generation  (Read 2029 times)

0 Members and 1 Guest are viewing this topic.

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1530
Height map generation
« on: December 27, 2018, 06:21:46 AM »

In a different thread the topic came up that you need a tool to generate map_h files from satellite data.

I have already been working on this for my own simulator, so I thought I could do something to help.

This is part of the mission builder for my game, but if you think it is useful I can polish it a little and release it early so you can use it to help generate IL2 maps.

You hit "New Mission" and you will see this screen.




Drag out the region you are interested in and hit one of the snap buttons. The system only works for integer latitude and longitudes because the SRTM data is organised that way.

One the next screen it downloads any SRTM files that don't exist for you.



The list on the left is the files that don't exist. It will try and download them for you. Note it is common for files to not exist. Only regions that contain land masses are stored in the database.

The middle window shows you the progress, the right window details what has been done. As you can see I already had 40 of the files already, so it didn't bother to download those.

Then it generates an atlas. This isn't used in IL2, but I need it.



The left display shows the bathymetry data for the region with black == land. The coloured bit is my atlas with green totally land, blue totally water, yellow mixed.

Hit "yes" and it will start to generate the map



The left window is the progress display

Note depending on your machine, it may crash at this point. Microsoft in their infinite wisdom copy image data before saving it to disk. So you may run out of memory for large maps.

The result is something like this.



In this image I have deleted all the water just so you can see it easier. The heights are based on 255 == 4032 Metres. I think that is correct. Also each pixel is 200 by 200 metres.

If you think this is useful please let me know and I will tidy it up and publish it, if not I will just continue on with making it for my sim.

I think I have got some distortion in the map because of the curvature of the Earth, I can fix that if needed.

Also do you need an option for 400 metres per pixel?

Not sure.

Anyway let me know if it is worthwhile completing.

Oh and happy Xmas.. or Las Posadas or Pancha Ganapati or Hanukkah or Koliada or Newtonmas or Hogswatch
Logged

slibenli

  • member
  • Offline Offline
  • Posts: 618
    • IL-2 Graphics Extender
Re: Height map generation
« Reply #1 on: December 28, 2018, 09:54:16 AM »

Looks awesome - I think it could be very useful.
Does it generate a single image?
The mapping of height map pixel values to height in IL2 is not linear, but done accorting to this table: https://gitlab.com/vrresto/il2ge/blob/master/common/height_table.
IL2GE can also handle 16-bit TIFFs.

I could imagine the following approcach for generating IL2GE specifc base height maps (used to extend the existing height map):
  • Use your tool for generating a height map for the area around the existing height map.
    It might be useful to save this map in the maximum possible resolution to avoid information loss before the following step.
  • A yet to be written tool is used to specify the location of the existing height map in the base map and generate the final image to be used by IL2GE.
    During this step some transformation might be applied to the base map to make it fit to the existing height map.

carsmaster

  • Modder
  • member
  • Offline Offline
  • Posts: 727
Re: Height map generation
« Reply #2 on: December 28, 2018, 10:45:26 AM »

In a different thread the topic came up that you need a tool to generate map_h files from satellite data.
This is a very useful tool.
I think it is very necessary to create maps in the IL-2 1946.

I think it does NOT need 400 meters per pixel. This is too much and there will be a very big inaccuracy.

Ideally, you need 200 meters per pixel and 50 meters per pixel for my future development of new DLLs and Java classes.
Logged

Chrival

  • member
  • Offline Offline
  • Posts: 164
  • The wacky guy
Re: Height map generation
« Reply #3 on: December 28, 2018, 03:04:57 PM »

Maybe this could help :

https://www.mediafire.com/file/zyfv8zdckg8r46n/altitude_scale.xlsx/file

Just a small spreadsheet I've made to convert height to/from RGB
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1530
Re: Height map generation
« Reply #4 on: December 29, 2018, 07:49:17 AM »

So it looks like it will be useful, but needs more work.

So let's work out a TODO list here.

As I see it so far..

  • Change mapping from height to RGB
  • Allow option to output 16 bit TIFF (need confirmation of the height encoding for this format)
  • Bug fixes

To give you a little more detail, SRTM data comes in two sizes, 1201 by 1201 and 3601 by 3601. Both 16 bits per record in metres.

The code works out how wide the cell is in metres and then works out how many records are inside the 200m by 200m cell and averages the records in this region to give a final height value.

Because of the distortion caused by the curvature of the Earth this is a bit nasty. This will cause some distortion at the bottom of the map. I am trying to think of a good way to sort this out.

Anything else you think needs doing?
 
Logged

Chrival

  • member
  • Offline Offline
  • Posts: 164
  • The wacky guy
Re: Height map generation
« Reply #5 on: December 29, 2018, 09:49:11 AM »

i don't understand the trouble you experience exactly.
AFAIK SRTM data can be converted into Il2 with this tool :

https://www.mediafire.com/file/hww8zpdd1v50b1l/ELEV_COLORS_IL-2_Sturmovik.dbf/file

Made by Kevinp. 1000 thanks to him for all that work and tutorials .
And yes the scale is 50 meters per pixels, that gives the map_c and then to be reduced by a factor 4 (so it means 16 in surface) for map_H.
Logged

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Re: Height map generation
« Reply #6 on: December 29, 2018, 10:00:10 AM »

Carmaster, does that mean you are working on a new height model with a resolution of 50 meter? Cool. With a proper conversion tool to the existing maps this will elonge the live of the sim an other 10 years. Do you also plan to use integers instead of bytes?

I don't know the tiff thing, but i think the values to read must be 8 bit in any case, as there are 256 different height values so far. Afaik tiff also may not urgendly needed, as the tga is good enough here and easy to handle. Compression also is not needed.
Logged

slibenli

  • member
  • Offline Offline
  • Posts: 618
    • IL-2 Graphics Extender
Re: Height map generation
« Reply #7 on: January 04, 2019, 06:40:35 AM »

I think TIFF output won't be necessary ATM, because the engine is still restricted to 8-bit heightmaps.
Pages: [1]   Go Up
 

Page created in 0.08 seconds with 25 queries.