-
-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raster tiles are much lower detail when terrain is enabled #3983
Comments
Yes, this was by design, I don't remember exactly why, probably related to render to texture performance. |
FYI I found the most visible difference between the two is in this line in transform.ts: When that's switched to always be I'm suspicious of whether this is a performance change - there's no comments, so I can only guess, but it doesn't look anything like "if terrain is on then reduce detail by x%" - instead it is "if terrain is on then use a different center-point for the following calculation". That could still be for performance reasons but it's not obvious to me that it is |
I do see this change as part of the terrain 3D change here: From what I remember in the discussions around the terrain, this change is towards performance, to allow loading less details for the terrain mesh, making the terrain smoother. I don't know why center point is the reference point. |
Any updates on this @prozessor13 ? |
I have also encountered this issue; we are unable to use high-resolution tiles for our applications. |
I think @msbarry is looking into improving that by splitting the logic of which tiles to fetch according to the source cache and underlying source as part of the contour source implementation. |
I am looking into some weird behavior in deciding which tiles to load - but it should only affect crosstalk when a raster-dem source is shared between hillshading and terrain. This issue seems to be on any source when terrain is enabled. This issue might be related to this code block which is the only thing in source_cache that affects other sources when terrain is present: maplibre-gl-js/src/source/source_cache.ts Lines 600 to 635 in db7e027
|
If I can save some time - the PR I linked #3994 fixes this behaviour, by making the tiles loading logic when terrain is enabled more similar to when the logic when it is disabled. Since the logic is currently switched from one behaviour to the other depending on whether terrain is enabled or not, and switching the logic back fixes it, I don't think we need to investigate any crosstalk between layers etc (or if so, that's a separate issue). Anyway, all this to say that there is already a fix. Of course, if that entire piece of code is being rewritten anyway, that's fine too. This is basically blocked on anyone (@prozessor13?) being able to explain what the purpose for the two different logics is (possibly performance?), or alternatively waiting until someone signs off on switching it so that it always uses the apparently superior logic, even if we don't understand what the purpose was previously. |
Because tiles in terrain renders to a texture, and because the textures are cached, this logic is needed to not render raster tiles of different zoomlevels (because of race-conditions during tile-loading) into on render-to-texture tile. |
Yes, it was some kind of performance decision, but either it is too agressive, or there is a bug for rastertiles. The Problem is the following scenario: You are in heavy terrain, and you tilt the camera from Pos A to Pos B than you are behind a mountain. The distance to the centerPoint decreases radically and you have to render tiles in very high zoomlevel, but you still have a very wide view behind the mountain, because of camera altitude. So because there is no visibility check of the tiles behind the mountain a ton of tiles will be loaded. I cannot remember on all the details, but i think changing this is an issue to test very well. |
@prozessor13 thanks for the info! |
Anything that can get this moving forward? I would love to drop our fork of maplibre which exists solely to change this one line of code. Even just adding an option to change this would be fine. |
As far as I understand, this is not the right solution when it comes to terrain performance. |
### Motivation As a Basemaps developer, I want to view the following features introduced in the latest maplibre release: - Fix level of detail at high pitch angle by changing which tiles to load ([#3983]) ### Modifications - Upgrade maplibre to the latest version ([v5.0.0]) [#3983]: maplibre/maplibre-gl-js#3983 [v5.0.0]: https://github.com/maplibre/maplibre-gl-js/releases/tag/v5.0.0 ### Verification When running Basemaps locally, we can see that the level of detail at a high pitch angle is much better. | Before | After | | - | - | | ![][img_before] | ![][img_after] | Reference: https://basemaps.linz.govt.nz/@-39.3036538,174.0583781,z14.65,b27,p60?terrain=LINZ-Terrain [img_before]: https://github.com/user-attachments/assets/aac70a0a-4d88-4809-a6ac-30a428d5d756 [img_after]: https://github.com/user-attachments/assets/be498a91-584f-4955-bcbe-634a8633ed4d
(This may not be a bug - if that's the case, I am just looking for info about how to control this behaviour).
Adding terrain to a map viewer causes it to load raster tiles at lower zoom, that is, load the lower detail rasters with a lower "z" value. Also, the zoom drops away much quicker when terrain is enabled, so that one end of the screen is noticeably lower detail than the other even for a reasonably small camera pitch, and worse for extreme pitches. Maps without terrain, by contrast, do a good job of maintaining the illusion that all tiles change zoom at once.
maplibre-gl-js version: 4.1.2
browser: Brave
Steps to Trigger Behavior
Link to Demonstration
Map with terrain disabled:
https://jsbin.com/mesowukici/1/edit?html,output
Identical map with terrain enabled:
https://jsbin.com/rigisawuze/1/edit?html,output
Expected Behavior
Adding terrain shouldn't affect raster tile zoom - maybe?
This may be by design for performance reasons. If so, do you know if it can be tweaked?
Actual Behavior
Adding terrain has a large and obvious impact on raster tile zoom.
The text was updated successfully, but these errors were encountered: