Inspired by @Jacky_Liuforum post, I’ve honed my modifications of his original code to provide a dynamic loading of TMS tiles from OpenMapServer onto a sphere in Babylon.
Features include:
Dynamic loading of tiles in view
Single texture
Zoom using fov allows close view of globe without zooming through the mesh/sphere
Because only a single texture is used, the useful TMS zoom level is limited. When the texture size would otherwise grow to be bigger than the max specified (or aauto detected by the engine) the scale of tiles is reduced. When the scale is 1/4 or 1/8, it becomes uselessly blurry. You can play around with texture properties (anisotropic filtering, sample mode, etc) and canvas context properties (imageSmoothingEnabled, imageSmoothingQuality) but I haven’t really found any particularly crisp combinations.
Turn on boundaries and text mode 1 to watch the dynamic loading sequences as zoom level changes.
options in code: show text none, xyzoom, or distance from camera
An update to get the projection correct. Now, continents don’t shift around when crossing a zoom level. And added zoom levels 0 and 1.
Uses UV mapping on the sphere, which means decreasing the segments too much on the sphere results in visible distortion of the map. 256 segments on the sphere seems to be good enough, 16 is too low.
I’ll hook up my mouse and see what it does. I modified camera control for fov zooming, but maybe that’s only for pinch? The modified function is near or at the bottom of the code.
Edit: confirmed I didn’t change mouse wheel zoom. Mouse wheel still changes radius and not fov.
Interestingly I was looking at tiling the other day too but as a way to make PhotoDomes load faster. I only got as far as clicking on a “tile” making it go high res though was going to look at how to make it work based on zoom and position too.
I don’t know if anything I did would be helpful for you but feel free to have a look and take anything you want