Thread: [WIP] Lighthouses mod View Single Post 07-25-2017, 09:35 PM   #364
gap
Navy Seal Join Date: Jan 2011
Location: CJ8937
Posts: 7,616 Quote:
 Originally Posted by Kendras I would like to correct all the sea depth of the area which is on the map I've posted. This is the right time to do it, before we start placing lighthouses around the Atlantic coast of France Quote:
 Originally Posted by Kendras How can you modifiy the sea depth / terrain altitude with terrain editor ? I've never used it. Do you have to just change the color ? Is it a grey scale ?
Exactly, 256 shades of grey, each shade being a different height. Indeed, we need to know how many meters below the sea level each shade corresponds to. We don't have this information, all I can say righ away is that sea areas are marked with values from 0 to 47, and land areas go from 48 to 255 (0 being the deepest trench and 0 the highest peak) but...

Knowing that the globe is divided in 180 x 360 = 64,800 elevation squares having a resolution of 126 sq. pixels each, and that the three most external pixels on each side of each square are 'redundant' (i.e. they are overlapped with the outer border of the neighbouring squares), it is a matter of simple math deducing that each pixel on those squares is equal to 1 deg / (126 - 3 x 2) = 1/120 deg = 0.5 min = 30 sec = 1 km in the SHIII world. With those equations in mind, we can easily locate any set of SHIII-world coordinates on the height map.
Knowing how deep is that point in game, we can build our own chart with grey values on a column and depths in meters on the other column. I can imagine that there is a linear correlation between grey values and height values, so we don't have to repeat the process 256 times: two or three well space measures, maybe four to stay on the safe side, will be enough to plot a line which will tell us what is the right grey value for the (approximate) depth we want Let's do an example with La Plate's position. Our lighthouse lies between 48 and 49 deg of latitude N, and 4 and 5 deg of longitude W. When we select a set of coordinates in SHIII extractor and we load a grid, SH3 TE will show a matrix of 3x3 squares, the central square having as top left coordinates the coordinates we have selected, so we should look for 49°N and 5°W if we want the square which actually encompasses La Plate's location to be loaded at the center of the 3x3 matrix: The square higlighted in red is the one we are actually interested in, and the double green lines show the overlappings with surrounding squares.
When we export our square, again, it will be saved on file together with its neighbours in a raw file whose pixel resolution is 366 pixels (=120 pixels per square x 3 squares + 3 overlapping pixels per side x 2 sides). This is how it looks in PS, after converting it into a greyscale indexed image: Note that I have added guidelines to it: the central area marked by the guidelines measures exactly 120 x 120 pixels, and it corresponds to the 1 deg x 1 deg quadrant that La Plate lies in.
Let's look for the exact position of our lighthouse now: we know that the bottom guideline marks 48 deg of latitude north. In SH metric units, that's 48 deg x 120,000 m/deg = 5,760,000 m. La Plate's position, from the mis file, is 5,764,737: a bit to the north of the line; 5,764,737 - 5,760,000 = 4,737: that's the metric distance between the top guidline on the elevation map and the lighthouse. Before, we had concluded that 1 pixel on that map was equal to 1,000 m, so if we want the distance from the bottom guideline in pixels we calculate 4,737 m / 1,000 m/pixel = 5 pixels. The calculation is similar for the longitude: the right guidline marks 5 deg of longitude west, -600,000 m in metric units. The lighthouse is placed at -571,143 m. -571,143 - (-600,000) = 28,857; 28,857 / 1,000 = 29 pixels from the right guidline. This is the pixel we were looking for, on the haight map: For better readability I have zoomed in the map so only the zone comprised between the guidelines is visible (48-49°N, 5-4°W), and I have marked 'our' pixel with a selection mark. Its greyscale value is 46 by the way so, unless I made some gross mistake, we know now that a value of 46 on that indexed map, corresponds to an in-game depth of -17 m, and we also know that, if we want, we can do it shallower by one 'step', if we change that value from 46 to 47. Beyond that value, I think the area would still be submerged (the coastline map takes the priority for deciding what is sea and what land), but the area would probably be marked on the in-game navigation map as a brown pixel, as if it was land __________________
_____________________
|May the Force be with you!|
...\/   