anselm/aterrain

map - gudermannian projection to reverse mercator

Closed this issue · 1 comments

Gudermannian implementation needs more thought. Right now it can be turned off and on with a parameter such as http://localhost:8000/?name=asdf&guder=1 .

In general rendering tiles consists of layering an image-tile on top of a terrain-tile. As a test I distort the linear vertex position of the tile latitude to correctly match the mercator distortion such that everything looks normal on a globe. This is fine and it works but it has some serious side effects and this needs to be done better. Side effects include:

  1. tiles are not equal size to each other; it is a bit harder to predict which tile is going to be visible for a given camera POV.

  2. the poles appear to have a higher resolution of detail that the main continents.

  3. terrain may be stretched in fact; it depends if the terrain tiles are also a mercator format ( this needs some study ).

It would be better to write some WASM to create an idealized 256x256 image-tile to complement any given terrain-tile... but this means a bit of work. It requires fetching image tiles that overlap the projected region and then reading into those tiles while building up an idealized surface.

The way this is done in Cesium is with a shader.

Some notes for reference:

https://en.wikipedia.org/wiki/Mercator_projection#Small_element_geometry -> https://en.wikipedia.org/wiki/Web_Mercator https://en.wikipedia.org/wiki/Gudermannian_function http://aperturetiles.com/docs/development/api/jsdocs/binning_WebMercatorTilePyramid.js.html https://stackoverflow.com/questions/1166059/how-can-i-get-latitude-longitude-from-x-y-on-a-mercator-map-jpeg https://msdn.microsoft.com/en-us/library/bb259689.aspx describes how pixels map to latitude and longitude https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/ImageryLayer.js#L1026 discusses how cesium does it https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/Ellipsoid.js#L85 https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/Ellipsoid.js#L386

"For Mercator, check out Slide 39-43 of Rendering the Whole Wide World on the World Wide Web for some background and reprojectToGeographic() in ImageryLayer.js for how Cesium currently does it. Note that you only have to reproject once, not per frame, and over the long-term, we can push this server-side. I seem to recall that deep in the tree, e.g., level 16+, Mercator basically becomes WGS84 and that Cesium stops reprojecting – we did this at one point, but I don’t know if we stayed with it.

For vertex transform precision, Cesium’s implementation is in:

EncodedCartesian3.js
translateRelativeToEye.glsl

fixed