maplibre / maplibre-gl-js

MapLibre GL JS - Interactive vector tile maps in the browser
https://maplibre.org/maplibre-gl-js/docs/
Other
6.62k stars 714 forks source link

closest terrain tile detail level seems incorrect when camera pitch is too high #4703

Open maxmueh opened 2 months ago

maxmueh commented 2 months ago

-->

maplibre-gl-js version: 4.5.2 and also in the maplibre 3d terrain example

browser: chrome

Steps to Trigger Behavior

  1. incline camera as much as possible
  2. fly slowly over a mountain top
  3. might need a few tries

Link to Demonstration

Reproducable in the 3d terrain example: https://maplibre.org/maplibre-gl-js/docs/examples/3d-terrain/

Expected Behavior

The closer you get, the higher the detail of the tile

Actual Behavior

While moving slowly over the peak of a mountain with an inclined camera, the closer you get, the higher gets the resolution of the tile.

When reaching the peak, a tile with a lower resolution is loaded though, instead of the highest resolution.

It seems that since the tile is 'under' the camera and not in camera direction, it is not recognized as being close. This is also reproducable in regions without mountains, but the effect gets more obvious here.

https://github.com/user-attachments/assets/fe589c80-4f9b-4aa7-9466-665ddaecaeb1

HarelM commented 2 months ago

I believe that level of details is calculated for the camera center and not for every part of the scene separately. Feel free to dig into this, a PR would be welcomed!