Special Aircraft Service

the SAS Hangar => The Lounge => Stainless' new Flight Simulator => Topic started by: Stainless on November 23, 2019, 08:45:01 AM

Title: Terrain height map generator for slibenli
Post by: Stainless on November 23, 2019, 08:45:01 AM
As requested I am writing a new tool, this thread will be the documentation for it and hold the download link when it is finished.

So here we go....


1) Boot up the app.  It's windows wpf

(https://i.postimg.cc/0jXytzTH/Desktop-Screenshot-2019-11-23-14-57-42-100.png) (https://postimg.cc/XBFWqY7w)

2) The first time you run the app you need to set the directory you want to store all the SRTM data. So Options SRTM Directory
 You can either type in the directory or use the browse button.
 Note, WPF does not have a folder browser dialog, so I cheated and used the save file dialog.

(https://i.postimg.cc/FRy4dYFJ/Desktop-Screenshot-2019-11-23-15-27-19-52.png) (https://postimg.cc/HckKFsyp)

3) Create a new project.
    You can either fill in the fields by hand or you can use the pick location button

(https://i.postimg.cc/ZnrYPfTj/Desktop-Screenshot-2019-11-23-15-11-33-57.png) (https://postimg.cc/xN1Sn3Nb)

The pick button will open a new window and display google maps.

Click on the map where you want the top left of the IL2 map to be. You will see the latitude and longitude popup in a little window.

(https://i.postimg.cc/ydm2v2ZJ/Desktop-Screenshot-2019-11-23-15-11-59-20.png) (https://postimg.cc/9Rfxf81V)

Click on the latitude and longitude.

(https://i.postimg.cc/FR4BdGBh/Desktop-Screenshot-2019-11-23-15-12-08-69.png) (https://postimg.cc/5Hs3D5Jr)

Then cut and paste the coordinates into the text boxes.

(https://i.postimg.cc/j2gT4BpH/Desktop-Screenshot-2019-11-23-15-12-29-91.png) (https://postimg.cc/m1HKbp2k)

4) Save your project!!!

 The download can take a very long time, so save the project. The download will resume from where it left off as long as you delete any bad zip files.

(https://i.postimg.cc/05XtG866/Desktop-Screenshot-2019-11-23-15-13-09-61.png) (https://postimg.cc/rzWCM2Nc)

5) Start the map generation. Actions Generate Map

The display will change and show a list of SRTM files needed for the project. Now SRTM files do not exist for areas of the world that are totally ocean, so some files will never be downloaded. Don't worry about it.
If the zip file already exists on the disk, it won't download it again.
If the download times out, it will retry. It will retry a lot. Hence saving your project is a good idea.
Once all the zip files are downloaded, the app will extract the contents into the directory.
 
(https://i.postimg.cc/QtC0WPqG/Desktop-Screenshot-2019-11-23-15-16-22-61.png) (https://postimg.cc/qhf8P1Yj)

Now the app will work through all the SRTM files loading in the height map data to form a virtual height map much bigger than IL2 can handle

SRTM data uses -32768 as a special value which means "we don't have any data for this region", so I scan all the data and if I find this value I sample a 3 by 3 area around it and put an average value in this data point.

Then it builds the requested image as signed 16 bit values in metres.

It have put a simple screen in so you know it hasn't crashed.

(https://i.postimg.cc/fWcT5dqy/Desktop-Screenshot-2019-11-26-10-59-52-10.png) (https://postimg.cc/14zQ38Q1)

Finally it creates a false colour image to show you the region covered by the map.

(https://i.postimg.cc/285RvLPP/Desktop-Screenshot-2019-11-26-17-45-10-65.png) (https://postimg.cc/SjHvbRQr)

I had to do this as most terrain we are interested in is a lot lower than 5000m , and hence damn near black.

You are then free to save the generated height map from the action menu.

I have PNG , TGA , and also IL2 format.

I.E. The height is mapped to 0-255 using the height equation used by IL2. This is basically you map_h


Created a repository for it.

https://github.com/PaulBlythe/IL2Tools

Title: Re: Terrain height map generator for slibenli
Post by: slibenli on November 24, 2019, 05:56:17 PM
Thank you for doing this!

There is one possible problem.
You're using wpf, which means the app will probably not run in linux (which I use for developing - actually I currently don't have a working windows installation). So I would need to setup a vm.
The question is whether that would be more productive (in the long run, as I would need to keep that vm running and updated - all drawing system resources) than porting the gui code to some other framework (which I would do, if you gave me the source).

BTW: I tried to load a 16000*16000 px height map in il2ge - unsuccessfully. At least for now the maximum size is 8000*8000 px.
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 25, 2019, 04:29:47 AM
Linux..... man I have 7 machines set up here and the only one that runs Linux is the raspberry pi  :)

I work in C# for tools because you have so much already done for you.

Multithreading Trivial
Parrallel programmingTrivial
User interface Trivial
CollectionsTrivial
Image loadingTrivial

The list just goes on.

To convert this to Linux is a major task.

Let me think about what I can do. I have a laptop here I don't need, but it has a Swedish keyboard....
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on November 25, 2019, 06:58:21 AM
C# as such shouldn't be a problem, as long as you don't use Windows-only stuff like Windows Forms or WPF.
I figure that the amount of GUI-specific code in the tool is relatively small(?)
With porting to another framework I meant porting that GUI-specific code to another (C# based) framework, like Qml.Net (https://qmlnet.github.io/introduction/) for example.

Hmm, I'll google what Swedish keyboard looks like ;)
Edit: OK it's a qwerty layout - that's good for me :)



Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 26, 2019, 01:28:38 PM
This is the map saved as an IL2 map_h file

(https://i.postimg.cc/nr1mN5Ld/Desktop-Screenshot-2019-11-26-20-27-14-56.png) (https://postimg.cc/hQfhd2Tx)
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on November 27, 2019, 02:41:54 AM
Those red areas are negative elevations?
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 27, 2019, 03:48:44 AM
Yes.

I used a mapping table from a different thread.

There's a spreadsheet knocking about that defines height range and pixel colour.

I don't like it. It has errors in it which I have patched into this table

Code: [Select]
MapRecord[] map = new MapRecord[]
        {
            new MapRecord( -100  ,-1 ,255,   0,  0 ),
            new MapRecord(0 ,0  ,0  ,0  ,0),
            new MapRecord(1 ,1  ,1  ,1  ,1),
            new MapRecord(2 ,2  ,2  ,2  ,2),
            new MapRecord(3 ,3  ,3  ,3  ,3),
            new MapRecord(4 ,4  ,4  ,4  ,4),
            new MapRecord(5 ,5  ,5  ,5  ,5),
            new MapRecord(6 ,6  ,6  ,6  ,6),
            new MapRecord(7 ,7  ,7  ,7  ,7),
            new MapRecord(8 ,8  ,8  ,8  ,8),
            new MapRecord(9 ,9  ,9  ,9  ,9),
            new MapRecord(10 ,10 ,10 ,10 ,10 ),
            new MapRecord(11    ,11 ,11 ,11 ,11),
            new MapRecord(12    ,12 ,12 ,12 ,12),
            new MapRecord(13    ,13 ,13 ,13 ,13),
            new MapRecord(14    ,14 ,14 ,14 ,14),
            new MapRecord(15    ,15 ,15 ,15 ,15),
            new MapRecord(16    ,16 ,16 ,16 ,16),
            new MapRecord(17    ,17 ,17 ,17 ,17),
            new MapRecord(18    ,18 ,18 ,18 ,18),
            new MapRecord(19    ,19 ,19 ,19 ,19),
            new MapRecord(20    ,20 ,20 ,20 ,20),
            new MapRecord(21    ,21 ,21 ,21 ,21),
            new MapRecord(22    ,22 ,22 ,22 ,22),
            new MapRecord(23    ,23 ,23 ,23 ,23),
            new MapRecord(24    ,24 ,24 ,24 ,24),
            new MapRecord(25    ,25 ,25 ,25 ,25),
            new MapRecord(26    ,26 ,26 ,26 ,26),
            new MapRecord(27    ,27 ,27 ,27 ,27),
            new MapRecord(28    ,28 ,28 ,28 ,28),
            new MapRecord(29    ,29 ,29 ,29 ,29),
            new MapRecord(30    ,30 ,30 ,30 ,30),
            new MapRecord(31    ,31 ,31 ,31 ,31),
            new MapRecord(32    ,32 ,32 ,32 ,32),
            new MapRecord(33    ,33 ,33 ,33 ,33),
            new MapRecord(34    ,34 ,34 ,34 ,34),
            new MapRecord(35    ,35 ,35 ,35 ,35),
            new MapRecord(36    ,36 ,36 ,36 ,36),
            new MapRecord(37    ,37 ,37 ,37 ,37),
            new MapRecord(38    ,38 ,38 ,38 ,38),
            new MapRecord(39    ,39 ,39 ,39 ,39),
            new MapRecord(40    ,40 ,40 ,40 ,40),
            new MapRecord(41    ,41 ,41 ,41 ,41),
            new MapRecord(42    ,42 ,42 ,42 ,42),
            new MapRecord(43    ,43 ,43 ,43 ,43),
            new MapRecord(44    ,44 ,44 ,44 ,44),
            new MapRecord(45    ,45 ,45 ,45 ,45),
            new MapRecord(46    ,46 ,46 ,46 ,46),
            new MapRecord(47    ,47 ,47 ,47 ,47),
            new MapRecord(48    ,48 ,48 ,48 ,48),
            new MapRecord(49    ,49 ,49 ,49 ,49),
            new MapRecord(50    ,50 ,50 ,50 ,50),
            new MapRecord(51    ,51 ,51 ,51 ,51),
            new MapRecord(52    ,52 ,52 ,52 ,52),
            new MapRecord(53    ,53 ,53 ,53 ,53),
            new MapRecord(54    ,54 ,54 ,54 ,54),
            new MapRecord(55    ,55 ,55 ,55 ,55),
            new MapRecord(56    ,56 ,56 ,56 ,56),
            new MapRecord(57    ,57 ,57 ,57 ,57),
            new MapRecord(58    ,58 ,58 ,58 ,58),
            new MapRecord(59    ,59 ,59 ,59 ,59),
            new MapRecord(60    ,60 ,60 ,60 ,60),
            new MapRecord(61    ,61 ,61 ,61 ,61),
            new MapRecord(62    ,62 ,62 ,62 ,62),
            new MapRecord(63    ,63 ,63 ,63 ,63),
            new MapRecord(64    ,64 ,64 ,64 ,64),
            new MapRecord(65    ,66 ,65 ,65 ,65),
            new MapRecord(67    ,68 ,66 ,66 ,66),
            new MapRecord(69    ,70 ,67 ,67 ,67),
            new MapRecord(71    ,72 ,68 ,68 ,68),
            new MapRecord(73    ,74 ,69 ,69 ,69),
            new MapRecord(75    ,76 ,70 ,70 ,70),
            new MapRecord(77    ,78 ,71 ,71 ,71),
            new MapRecord(79    ,80 ,72 ,72 ,72),
            new MapRecord(81    ,82 ,73 ,73 ,73),
            new MapRecord(83    ,84 ,74 ,74 ,74),
            new MapRecord(85    ,86 ,75 ,75 ,75),
            new MapRecord(87    ,88 ,76 ,76 ,76),
            new MapRecord(89    ,90 ,77 ,77 ,77),
            new MapRecord(91    ,92 ,78 ,78 ,78),
            new MapRecord(93    ,94 ,79 ,79 ,79),
            new MapRecord(95    ,96 ,80 ,80 ,80),
            new MapRecord(97    ,98 ,81 ,81 ,81),
            new MapRecord(99    ,100,82 ,82 ,82),
            new MapRecord(101,  102 ,83 ,83 ,83),
            new MapRecord(103,  104 ,84 ,84 ,84),
            new MapRecord(105,  106 ,85 ,85 ,85),
            new MapRecord(107,  108 ,86 ,86 ,86),
            new MapRecord(109,  110 ,87 ,87 ,87),
            new MapRecord(111,  112 ,88 ,88 ,88),
            new MapRecord(113,  114 ,89 ,89 ,89),
            new MapRecord(115,  116 ,90 ,90 ,90),
            new MapRecord(117,  118 ,91 ,91 ,91),
            new MapRecord(119,  120 ,92 ,92 ,92),
            new MapRecord(121,  122 ,93 ,93 ,93),
            new MapRecord(123,  124 ,94 ,94 ,94),
            new MapRecord(125,  126 ,95 ,95 ,95),
            new MapRecord(127,  128 ,96 ,96 ,96),
            new MapRecord(129,  132 ,97 ,97 ,97),
            new MapRecord(133,  136 ,98 ,98 ,98),
            new MapRecord(137,   140 ,99 ,99 ,99),
            new MapRecord(141,  144 ,100,   100 ,100),
            new MapRecord(145,  148 ,101,   101 ,101),
            new MapRecord(149,  152 ,102,   102 ,102),
            new MapRecord(153,  156 ,103,   103 ,103),
            new MapRecord(157,  160 ,104,   104 ,104),
            new MapRecord(161,  164 ,105,   105 ,105),
            new MapRecord(165,  168 ,106,   106 ,106),
            new MapRecord(169,  172 ,107,   107 ,107),
            new MapRecord(173,  176 ,108,   108 ,108),
            new MapRecord(177,  180 ,109,   109 ,109),
            new MapRecord(181,  184 ,110,   110 ,110),
            new MapRecord(185,  188 ,111,   111 ,111),
            new MapRecord(189,  192 ,112,   112 ,112),
            new MapRecord(193,  196 ,113,   113 ,113),
            new MapRecord(197,  200 ,114,   114 ,114),
            new MapRecord(201,  204 ,115,   115 ,115),
            new MapRecord(205,  208 ,116,   116 ,116),
            new MapRecord(209,  212 ,117,   117 ,117),
            new MapRecord(213,  216 ,118,   118 ,118),
            new MapRecord(217,  220 ,119,   119 ,119),
            new MapRecord(221,  224 ,120,   120 ,120),
            new MapRecord(225,  228 ,121,   121 ,121),
            new MapRecord(229,  232 ,122,   122 ,122),
            new MapRecord(233,  236 ,123,   123 ,123),
            new MapRecord(237,  240 ,124,   124 ,124),
            new MapRecord(241,  244 ,125,   125 ,125),
            new MapRecord(245,  248 ,126,   126 ,126),
            new MapRecord(249,  252 ,127,   127 ,127),
            new MapRecord(253,  256 ,128,   128 ,128),
            new MapRecord(257,  264 ,129,   129 ,129),
            new MapRecord(265,  272 ,130,   130 ,130),
            new MapRecord(273,  280 ,131,   131 ,131),
            new MapRecord(281,  288 ,132,   132 ,132),
            new MapRecord(289,  296 ,133,   133 ,133),
            new MapRecord(297,  304 ,134,   134 ,134),
            new MapRecord(305,  312 ,135,   135 ,135),
            new MapRecord(313,  320 ,136,   136 ,136),
            new MapRecord(321,  328 ,137,   137 ,137),
            new MapRecord(329,  336 ,138,   138 ,138),
            new MapRecord(337,  344 ,139,   139 ,139),
            new MapRecord(345,  352 ,140,   140 ,140),
            new MapRecord(353,  360 ,141,   141 ,141),
            new MapRecord(361,  368 ,142,   142 ,142),
            new MapRecord(369,  376 ,143,   143 ,143),
            new MapRecord(377,  384 ,144,   144 ,144),
            new MapRecord(385,  392 ,145,   145 ,145),
            new MapRecord(393,  400 ,146,   146 ,146),
            new MapRecord(401,  408 ,147,   147 ,147),
            new MapRecord(409,  416 ,148,   148 ,148),
            new MapRecord(417,  424 ,149,   149 ,149),
            new MapRecord(425,  432 ,150,   150 ,150),
            new MapRecord(433,  440 ,151,   151 ,151),
            new MapRecord(441,  448 ,152,   152 ,152),
            new MapRecord(449,  456 ,153,   153 ,153),
            new MapRecord(457,  464 ,154,   154 ,154),
            new MapRecord(465,  472 ,155,   155 ,155),
            new MapRecord(473,  480 ,156,   156 ,156),
            new MapRecord(481,  488 ,157,   157 ,157),
            new MapRecord(489,  496 ,158,   158 ,158),
            new MapRecord(497,  504 ,159,   159 ,159),
            new MapRecord(505,  512 ,160,   160 ,160),
            new MapRecord(513,  528 ,161,   161 ,161),
            new MapRecord(529,  554 ,162,   162 ,162),
            new MapRecord(555,  560 ,163,   163 ,162),
            new MapRecord(561,  576 ,164,   164 ,164),
            new MapRecord(577,  592 ,165,   165 ,165),
            new MapRecord(593,  608 ,166,   166 ,166),
            new MapRecord(609,  624 ,167,   167 ,167),
            new MapRecord(625,  640 ,168,   168 ,168),
            new MapRecord(641,  656 ,169,   169 ,169),
            new MapRecord(657,  672 ,170,   170 ,170),
            new MapRecord(673,  688 ,171,   171 ,171),
            new MapRecord(689,  704 ,172,   172 ,172),
            new MapRecord(705,  720 ,173,   173 ,173),
            new MapRecord(721,  736 ,174,   174 ,174),
            new MapRecord(737,  752 ,175,   175 ,175),
            new MapRecord(753,  768 ,176,   176 ,176),
            new MapRecord(769,  784 ,177,   177 ,177),
            new MapRecord(785,  800 ,178,   178 ,178),
            new MapRecord(801,  816 ,179,   179 ,179),
            new MapRecord(817,  832 ,180,   180 ,180),
            new MapRecord(833,  848 ,181,   181 ,181),
            new MapRecord(849,  864 ,182,   182 ,182),
            new MapRecord(865,  880 ,183,   183 ,183),
            new MapRecord(881,  896 ,184,   184 ,184),
            new MapRecord(897,  912 ,185,   185 ,185),
            new MapRecord(913,  928 ,186,   186 ,186),
            new MapRecord(929,  944 ,187,   187 ,187),
            new MapRecord(945,  960 ,188,   188 ,188),
            new MapRecord(961,  976 ,189,   189 ,189),
            new MapRecord(977,  992 ,190,   190 ,190),
            new MapRecord(993,  1008,191,   191, 191),
            new MapRecord(1009, 1024,   192,192,    192),
            new MapRecord(1025, 1056,   193,193,    193),
            new MapRecord(1057, 1088,   194,194,    194),
            new MapRecord(1089, 1120,   195,195,    195),
            new MapRecord(1121, 1152,   196,196,    196),
            new MapRecord(1153, 1184,   197,197,    197),
            new MapRecord(1185, 1216,   198,198,    198),
            new MapRecord(1217, 1248,   199,199,    199),
            new MapRecord(1249, 1280,   200,200,    200),
            new MapRecord(1281, 1312,   201,201,    201),
            new MapRecord(1313, 1344,   202,202,    202),
            new MapRecord(1345, 1376,   203,203,    203),
            new MapRecord(1377, 1408,   204,204,    204),
            new MapRecord(1409, 1440,   205,205,    205),
            new MapRecord(1441, 1472,   206,206,    206),
            new MapRecord(1473, 1504,   207,207,    207),
            new MapRecord(1505, 1536,   208,208,    208),
            new MapRecord(1537, 1568,   209,209,    209),
            new MapRecord(1569, 1600,   210,210,    210),
            new MapRecord(1601, 1632,   211,211,    211),
            new MapRecord(1633, 1664,   212,212,    212),
            new MapRecord(1665, 1696,   213,213,    213),
            new MapRecord(1697, 1728,   214,214,    214),
            new MapRecord(1729, 1760,   215,215,    215),
            new MapRecord(1761, 1792,   216,216,    216),
            new MapRecord(1793, 1824,   217,217,    217),
            new MapRecord(1825, 1856,   218,218,    218),
            new MapRecord(1857, 1888,   219,219,    219),
            new MapRecord(1889, 1920,   220,220,    220),
            new MapRecord(1921, 1952,   221,221,    221),
            new MapRecord(1953, 1984,   222,222,    222),
            new MapRecord(1985, 2016,   223,223,    223),
            new MapRecord(2017, 2048,   224,224,    224),
            new MapRecord(2049, 2112,   225,225,    225),
            new MapRecord(2113, 2176,   226,226,    226),
            new MapRecord(2177, 2240,   227,227,    227),
            new MapRecord(2241, 2304,   228,228,    228),
            new MapRecord(2305, 2368,   229,229,    229),
            new MapRecord(2369, 2432,   230,230,    230),
            new MapRecord(2433, 2496,   231,231,    231),
            new MapRecord(2497, 2560,   232,232,    232),
            new MapRecord(2561, 2624,   233,233,    233),
            new MapRecord(2625, 2688,   234,234,    234),
            new MapRecord(2689, 2752,   235,235,    235),
            new MapRecord(2753, 2816,   236,236,    236),
            new MapRecord(2817, 2880,   237,237,    237),
            new MapRecord(2881, 2944,   238,238,    238),
            new MapRecord(2945, 3008,   239,239,    239),
            new MapRecord(3009, 3072,   240,240,    240),
            new MapRecord(3073, 3136,   241,241,    241),
            new MapRecord(3137, 3200,   242,242,    242),
            new MapRecord(3201, 3264,   243,243,    243),
            new MapRecord(3265, 3328,   244,244,    244),
            new MapRecord(3329, 3392,   245,245,    245),
            new MapRecord(3393, 3456,   246,246,    246),
            new MapRecord(2347, 3520,   247,247,    247),
            new MapRecord(3521, 3584,   248,248,    248),
            new MapRecord(3585, 3648,   249,249,    249),
            new MapRecord(3649, 3712,   250,250,    250),
            new MapRecord(3713, 3776,   251,251,    251),
            new MapRecord(3777, 3840,   252,252,    252),
            new MapRecord(3841, 3904,   253,253,    253),
            new MapRecord(3905, 3968,   254,254,    254),
            new MapRecord(3969, 4032,   255,255,    255),
            new MapRecord(4033, 8806,   255,255,    255),
        };
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 27, 2019, 04:16:12 AM
Added option to edit a loaded project

Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 28, 2019, 01:13:47 AM
Started code to generate map_t

So far I have got a map that is 0.1 degrees of latitude and longitude and contains the types ....

Code: [Select]
LandTypeRecord[] LandTypes = new LandTypeRecord[]
        {
            new LandTypeRecord(24, 24, 128, "water"),
            new LandTypeRecord(50, 205, 49, "jungle"),
            new LandTypeRecord(33, 138, 33, "forest"),
            new LandTypeRecord(255, 255, 249, "snow"),
            new LandTypeRecord(189, 189, 189, "desert"),
            new LandTypeRecord(245, 222, 180, "dryscrub"),
            new LandTypeRecord(254, 0, 0, "city"),
            new LandTypeRecord(249, 237, 115, "grassland"),
            new LandTypeRecord(144, 187, 142, "hill"),
            new LandTypeRecord(240, 183, 104, "farmland"),
            new LandTypeRecord(255, 214, 0, "tropical savana"),
            new LandTypeRecord(70, 131, 178, "lake"),
            new LandTypeRecord(255, 214, 0, "swamp"),
            new LandTypeRecord(154, 205, 50, "steppe"),
            new LandTypeRecord(153, 249, 151, "mixed scrub"),
            new LandTypeRecord(218, 235, 157, "desert scrub"),
            new LandTypeRecord(151, 147, 84, "mountain"),
            new LandTypeRecord(188, 142, 144, "sand scrub")

        };

I sample this to create a type map that matches the height map

(https://i.postimg.cc/bwwJRWs9/Desktop-Screenshot-2019-11-28-08-06-59-48.png) (https://postimg.cc/LnG29ykJ)

You can see the limits of accuracy in the image.

Next stage is to combine height values and this type map to generate a base map_t


Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 28, 2019, 02:18:53 AM
Okay looking a bit better,


(https://i.postimg.cc/jdz9Tpp6/Desktop-Screenshot-2019-11-28-09-13-54-72.png) (https://postimg.cc/vcZXLNHD)

I have used my own texture mapping which is not very good but will do for now

Code: [Select]
// My mapping
    // 0    Lowland near water
    // 1    Desert
    // 2    Dry scrub
    // 3    Grass
    // 4    Hill
    // 5    Farmland
    // 6    Tropical savannah
    // 7    Swamp
    // 8    Snow
    // 9    Mountain
    // 10
    // 11
    // 12   Steppe
    // 13   Mixed scrub
    // 14   Desert scrub
    // 15   Sand scrub
    // 16   City
    // 17
    // 18
    // 19
    // 20
    // 21
    // 22
    // 23
    // 24   Forest
    // 25
    // 26
    // 27   Jungle
    // 28   Sea
    // 29   Water in land
    // 30   Lake
    // 31
    //

Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 28, 2019, 05:38:22 AM
Seems to work, though you may have to invert the TGA file in an art package.

Sometimes it is upside down, not every time... don't know why

Checked into github
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on November 28, 2019, 02:46:37 PM
Cloned :)
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on November 29, 2019, 05:56:34 AM
I am working on importing SHP (shape) files.

This will allow us to add rivers, roads, railways, place names etc to the map.

Wish me luck.
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on November 29, 2019, 02:14:07 PM
Good luck  ;)

I got the app running in a vm.
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on November 30, 2019, 04:33:33 PM
I've also looked into making it cross platform. It's feasible, though a little more work than I had hoped.
On the other hand it would be an opportunity to familiarize myself with C# and Qt Quick (for the GUI).

Edit: I started moving portable methods to class Core:  https://gitlab.com/vrresto/il2tools/commits/cross-platform
Edit2: This this probably creates merge conflicts with your current work - so I guess I should wait for you to finish that, before I continue on this.

Edit3: I'm not so sure anymore about Qt Quick - currently having a look at Avalonia, which is more similar to WPF.
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 02, 2019, 05:22:59 AM
QT is shit.

And once you download it you get spam emails constantly inviting you to various events
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 03, 2019, 03:14:33 AM
Damn not quite correct.

M27/A27 just about correct, but I don't think there are roads in the english channel... :o


(https://i.postimg.cc/152jJR2q/Desktop-Screenshot-2019-12-03-10-09-45-04.png) (https://postimg.cc/XpKLvWVj)
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 04, 2019, 12:30:36 AM
Figured that out, it includes ferries.

Still not quite right.


(https://i.postimg.cc/9X4XZQ6k/Desktop-Screenshot-2019-12-04-07-28-43-94.png) (https://postimg.cc/jCbrrtd6)
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on December 05, 2019, 07:16:25 AM
QT is shit.

And once you download it you get spam emails constantly inviting you to various events

Having some years of experience with Qt (but not Qt Quick) I wouldn't call it shit. Can't say that I love it either ;)
Hmm, I've only ever used the (L)GPL version, which doesn't require your email address.


Damn not quite correct.

M27/A27 just about correct, but I don't think there are roads in the english channel... :o



Figured that out, it includes ferries.

Still not quite right.


 ;D


I've got an Avalonia based GUI working (mostly):
(https://i.postimg.cc/d1fGnw12/mapmaker.png) (https://postimg.cc/ZBr95k6n)


Hmm ...
(https://i.postimg.cc/13gXcwFj/mapmaker2.png) (https://postimg.cc/RWBvv3X7)


I've got a division by zero before I added this check: https://gitlab.com/vrresto/il2tools/blob/469a7493cdc97ebee80e5591dc9cd0e54de11244/MapMaker/MapMaker/Classes/SRTM.cs#L193

Maybe related?
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 05, 2019, 09:01:06 AM
ummm how have you got a division by zero error there when it clearly says

Code: [Select]
     if (count != 0)
              h /= count;

 ;D
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on December 05, 2019, 09:27:34 AM
Code: [Select]
if (count != 0)
was added by me.
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 06, 2019, 04:02:48 AM
Ahh okay.

The fact that you are getting a division by zero error there is very bad news.

It basically means that the whole area you are looking at has no satellite data. A big hole in the data.

 
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on December 08, 2019, 09:31:10 AM
Hoping that you're not in the middle of changing something, I've created a pull request for some portability changes:
https://github.com/PaulBlythe/IL2Tools/pull/1
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 09, 2019, 02:57:24 AM
Merged
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on December 10, 2019, 09:02:07 AM
Thanks :)
I opened two more small pull requests.
Title: Re: Terrain height map generator for slibenli
Post by: slibenli on December 15, 2019, 06:54:04 AM
A generated height map blended together with the the Slovakia map (not yet aligned properly):


(https://i.postimg.cc/dVt59zTs/slovakia-screenshot.png) (https://postimg.cc/WhCmNYnC)


(https://i.postimg.cc/zBmw4M3R/slovakia-screenshot2.png) (https://postimg.cc/670GvMr9)
Title: Re: Terrain height map generator for slibenli
Post by: Stainless on December 17, 2019, 07:21:58 AM
Added optional road database (included in git) which allows me to ignore ferries.


(https://i.postimg.cc/qvXLyn06/Desktop-Screenshot-2019-12-17-14-09-56-53.png) (https://postimg.cc/w1MLd119)