Open Pomax opened 1 year ago
working on this in https://github.com/Pomax/are-we-flying/tree/alos-server
MSFS has no way for you to ask it for elevation other than by first placing a thing there, and then asking for the thing's elevation, which is a really annoying way of getting elevation data. So using external data (and it doesn't have to be ALOS, any DEM source will technically work, I just used ALOS because it's 30m resolution so you have a lot of freedom in what you do with that) that you run out-of-game will be both less work, and run faster.
My initial attempt used the open-elevation API, so you can totally do this using a server. In order to serve up XYZ tiles you kinda need one anyway since leaflet needs a URL it request the tile PNGs from, so adding an extra route (or more) for getting elevation at one or more lat/long coords is pretty trivial. E.g. https://github.com/Pomax/are-we-flying/blob/main/src/elevation/alos-server.js
That said, ALOS is 450GB, but you could also use the SRTM data (which is 20GBish), and you can always convert the horribly inefficient GeoTIFF files into monochrome PNG instead, which gives you much better compression. What I'm doing atm is converting the ALOS data from 3600x3600 GeoTIFF to 360x360 PNG (which makes it 300m resolution rather than 30m, but it uses a "preserve highest altitude" scaling so for the purposes of this work that's fine) and that turns it into ~1.5GB which is incredibly reasonable for full-planet coverage.
You need elevation data if you're going to serve elevation data =)
it doesn't technically need to be a plane, you could just spawn a ball or ground crew or something else small and move it around, but that's still way more work than it should have to be. I've seen some folks work directly with MSFS's own DEM data (so, out-of-game but tapping into the game's CGL files), but I figured I have good internet, and I have plenty of disk space, might as well dive into 3rd party DEM
ah, yeah fair.
possibly overkill, but always good to add to a book-sized tutorial: adding isolines to XYZ tiles by using something like http://paulbourke.net/papers/conrec
current hillshading experiment: https://glitch.com/edit/#!/testing-hill-shading
Tiling works, but this palette is way too dark.
Compare to gterrain:
It has all the elevation information already anyway, should be able to make this an XYZ tile source for Leaflet to tap into.
Optimizations: