-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
Globe covering tiles optimization #4937
Globe covering tiles optimization #4937
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4937 +/- ##
==========================================
- Coverage 89.13% 89.08% -0.06%
==========================================
Files 267 269 +2
Lines 38234 38268 +34
Branches 2347 2356 +9
==========================================
+ Hits 34081 34090 +9
- Misses 3151 3174 +23
- Partials 1002 1004 +2 ☔ View full report in Codecov by Sentry. |
The following PR is nearing its merge: If you need, I can create a branch in this repo for collaboration, so you could open this PR against the updates made in the above PR, but otherwise, I prefer to have the above PR merged first to avoid conflicts on the hard work @NathanMOlson did. |
Lets wait for #4779 to be merged first. |
@kubapelc , does this affect tile loading of the globe when the terrain3d is active too? |
It should not, this PR does not change functionality of tile culling, just makes it faster. But globe coveringTiles so far assumes that there is no terrain and does not take tile min/max elevation into account when generating AABBs. I think it should not be an issue for the purposes of porting terrain to globe. I'd like to redo globe coveringTiles to not use AABBs, since they do not approximate tiles on a sphere very well, and use oriented bounding boxes instead. I would add support for tile min/max elevation along with this. |
Converting tiles have been merged, this can now proceed. |
…/globe-coveringtiles-opt
# Conflicts: # src/geo/projection/globe_covering_tiles.test.ts # src/geo/projection/globe_covering_tiles.ts # src/geo/projection/globe_transform.ts
Can you add some tests and a changelog entry? |
I've added both. Most of the changes were already covered by existing tests, I've added tests for aabb-plane intersection and for the aabb cache. |
…ringtiles-opt # Conflicts: # CHANGELOG.md
This looks straight forward and good, thanks! |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [maplibre-gl](https://maplibre.org/) ([source](https://github.com/maplibre/maplibre-gl-js)) | dependencies | major | [`4.7.1` -> `5.1.0`](https://renovatebot.com/diffs/npm/maplibre-gl/4.7.1/5.1.0) | --- ### Release Notes <details> <summary>maplibre/maplibre-gl-js (maplibre-gl)</summary> ### [`v5.1.0`](https://github.com/maplibre/maplibre-gl-js/blob/HEAD/CHANGELOG.md#510) [Compare Source](maplibre/maplibre-gl-js@v5.0.1...v5.1.0) ##### ✨ Features and improvements - Add support for `vertical-align` in `format` expression ([specification](https://maplibre.org/maplibre-style-spec/expressions/#format))([#​5043](https://github.com/maplibre/maplibre-gl-js/pull/5043)). ##### 🐞 Bug fixes - Render frame synchronized again in requestAnimationFrame callback ([#​4535](maplibre/maplibre-gl-js#4535)) ### [`v5.0.1`](https://github.com/maplibre/maplibre-gl-js/blob/HEAD/CHANGELOG.md#501) [Compare Source](maplibre/maplibre-gl-js@v5.0.0...v5.0.1) ##### ✨ Features and improvements -⚠️ Revert changes made in `geometry-type` ([#​5285](maplibre/maplibre-gl-js#5331)). This change was causing issues in a [large number of styles](maplibre/maplibre-style-spec#965) and thus reverted. ##### 🐞 Bug fixes - Skip control button css hover effects on touch devices ([#​5285](maplibre/maplibre-gl-js#5285)) ### [`v5.0.0`](https://github.com/maplibre/maplibre-gl-js/blob/HEAD/CHANGELOG.md#500) [Compare Source](maplibre/maplibre-gl-js@v4.7.1...v5.0.0) ##### ✨ Features and improvements - \~~⚠️ Changed `geometry-type` to identify "Multi-" features ([#​4877](maplibre/maplibre-gl-js#4877)). Use `$type` which has no "Multi-" support or use `in` expression to get the previous behavior.~~ -⚠️ `StyleLayer`'s `queryIntersectsFeature` method parameters were moved to `QueryIntersectsFeatureParams`. ([#​5276](maplibre/maplibre-gl-js#5276)) Wrap the method parameters with `{}` to solve this -⚠️ Support setting WebGL context options on map creation ([#​5196](maplibre/maplibre-gl-js#5196)). Previously supported WebGL context options like `antialias`, `preserveDrawingBuffer` and `failIfMajorPerformanceCaveat` must now be defined inside the `canvasContextAttributes` object on `MapOptions`. -⚠️ Change the return type of `on` method to return a `Subscription` to allow for easy unsubscribe ([#​5080](maplibre/maplibre-gl-js#5080)). `map.on('x').on('y')` => `map.on('x'); map.on('y');`. -⚠️ Change drag rotate behavior to be around the center of the screen ([#​5074](maplibre/maplibre-gl-js#5074)) -⚠️ Return actual altitude from queryTerrainElevation + Pass non-translated matrices to custom layer on mercator map ([#​3854](maplibre/maplibre-gl-js#3854)) -⚠️ Remove unminified prod build ([#​4906](maplibre/maplibre-gl-js#4906)). You'll need to use a different build. - Allows setting the desired WebGL version to use ([#​5236](maplibre/maplibre-gl-js#5236)). You can now use `contextType` inside `canvasContextAttributes` to choose which WebGL version to use - Dual-Stack WebGL Runtime with WebGL2 to WebGL1 Fallback ([#​5198](maplibre/maplibre-gl-js#5198)) - Add support for projection type expression as part of a refactoring of the transfrom and projection classes ([#​5139](maplibre/maplibre-gl-js#5139)) - Export `Event` class ([#​5016](maplibre/maplibre-gl-js#5016)) - Support Vertical Perspective projection ([#​5023](maplibre/maplibre-gl-js#5023)) - When clustering circles and the promoteId is set to some parameter, the promoted ID is used on non-clustered features and the cluster_id is used on clustered features. Previously the ID was undefined for non-clustered features ([#​4899](maplibre/maplibre-gl-js#4899)) - Support Terrain in Globe projection ([#​4976](maplibre/maplibre-gl-js#4976)) - Improved performance of the `coveringTiles` (tile culling) function for globe ([#​4937](maplibre/maplibre-gl-js#4937)) - Catches network fetching errors such as CORS, DNS or malformed URL as actual `AJAXError` to expose HTTP request details to the `"error"` event (maplibre/maplibre-gl-js#4822) - Add setVerticalFieldOfView() to public API ([#​4717](maplibre/maplibre-gl-js#4717)) - Disable sky when using globe and blend it in when changing to mercator ([#​4853](maplibre/maplibre-gl-js#4853)) - New GlobeControl ([#​4960](maplibre/maplibre-gl-js#4960)) - Add support for pitch > 90 degrees ([#​4717](maplibre/maplibre-gl-js#4717)) - Add support for camera roll angle ([#​4717](maplibre/maplibre-gl-js#4717)) - Improve performance of `queryRenderedFeatures` by using JavaScript `Set`s to assess layer membership internally ([#​4777](maplibre/maplibre-gl-js#4777)) - Support globe mode ([#​3963](maplibre/maplibre-gl-js#3963)) - Merge atmosphere and sky implementation ([#​3888](maplibre/maplibre-gl-js#3888)) - Add option to display a realistic atmosphere when using a Globe projection ([#​3888](maplibre/maplibre-gl-js#3888)) ##### 🐞 Bug fixes -⚠️ Fix level of detail at high pitch angle by changing which tiles to load ([#​3983](maplibre/maplibre-gl-js#3983)) - Fix holes at the poles when terrain is used with globe ([#​5232](maplibre/maplibre-gl-js#5232)) - Fix geometry artifacts when globe terrain is zoomed out too much ([#​5232](maplibre/maplibre-gl-js#5232)) - Fix center being incorrectly constrained when using globe ([#​5186](maplibre/maplibre-gl-js#5186)) - Fix atmosphere improperly blending into the background ([#​5235](maplibre/maplibre-gl-js#5235)) - Fix parsing wrong hash location ([#​5131](maplibre/maplibre-gl-js#5131)) - Fix swallowing of errors ([#​4532](maplibre/maplibre-gl-js#4532)) - Fix erroring requests not reported on `error` handler ([#​4613](maplibre/maplibre-gl-js#4613)) - Fix children not retained when using globe ([#​5271](maplibre/maplibre-gl-js#5271)) - Fix symbol size increasing when looking from poles ([#​5275](maplibre/maplibre-gl-js#5275)) - Fix globe custom layers being supplied incorrect matrices after projection transition to mercator ([#​5150](maplibre/maplibre-gl-js#5150)) - Fix custom 3D models disappearing during projection transition ([#​5150](maplibre/maplibre-gl-js#5150)) - Fix regression in NavigationControl compass on Firefox and Safari browsers ([#​5205](maplibre/maplibre-gl-js#5205)) - Fix smooth mouse wheel zooming ([#​5154](maplibre/maplibre-gl-js#5154)) - Change drag rotate behavior to be less abrupt around the center ([#​5104](maplibre/maplibre-gl-js#5104)) - Fix regression in render world copies ([#​5101](maplibre/maplibre-gl-js#5101)) - Fix unwanted roll when motion is interrupted ([#​5083](maplibre/maplibre-gl-js#5083)) - Fix `geometry-type` filter expression results ([#​5132](maplibre/maplibre-gl-js#5132)) - Fix easeTo not applying padding in globe projection ([#​5134](maplibre/maplibre-gl-js#5134)) - Convert WebGL1 shaders to WebGL2 ([#​5166](maplibre/maplibre-gl-js#5166)) - Fixes line flickering problem ([#​5094](maplibre/maplibre-gl-js#5094)) - Fix poor performance in Chrome related to passing matrices to WebGL ([#​5072](maplibre/maplibre-gl-js#5072)) - Fixes scale control for globe on zoom out ([#​4897](maplibre/maplibre-gl-js#4897)) - Fixes cooperative gestures displaying the mobile help text when screen width is smaller than 480px on non-touch devices ([#​5053](maplibre/maplibre-gl-js#5053)) - Fixes incorrect cluster radius scaling in `GeoJSONSource.setClusterOptions()` ([#​5055](maplibre/maplibre-gl-js#5055)) - Improve innerHTML handling in code ([#​5057](maplibre/maplibre-gl-js#5057))) - Fix geometry beyond tile borders being rendered ([#​4868](maplibre/maplibre-gl-js#4868)) - Fix line-placed map-pitch-aligned texts being too large when viewed from some latitudes on a globe ([#​4786](maplibre/maplibre-gl-js#4786)) - Disabled unsupported Fog rendering, for Terrain3D on Globe ([#​4963](maplibre/maplibre-gl-js#4963)) - Fix issue where raster tile source won't fetch updates following request error ([#​4890](maplibre/maplibre-gl-js#4890)) - Fix 3D models in custom layers not being properly occluded by the globe ([#​4817](maplibre/maplibre-gl-js#4817)) - Fix issue where raster tiles were not rendered correctly when using globe and terrain ([#​4912](maplibre/maplibre-gl-js#4912)) - Fix text not being hidden behind the globe when overlap mode was set to `always` ([#​4802](maplibre/maplibre-gl-js#4802)) - Fix a single white frame being displayed when the map internally transitions from mercator to globe projection ([#​4816](maplibre/maplibre-gl-js#4816)) - Fix loading of RTL plugin version 0.3.0 ([#​4860](maplibre/maplibre-gl-js#4860)) - Fix a memory leak due to missing removal of event listener registration ([#​4824](maplibre/maplibre-gl-js#4824)) - Improve symbol collision performance for both mercator and globe projections ([#​4778](maplibre/maplibre-gl-js#4778)) - Fix bad line scaling near the poles under globe projection ([#​4778](maplibre/maplibre-gl-js#4778)) - Fix globe loading many tiles at an unnecessarily high zoom level when the camera is pitched ([#​4778](maplibre/maplibre-gl-js#4778)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45OS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTU5LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==--> Reviewed-on: https://git.tristess.app/alexandresoro/ouca-web/pulls/5 Reviewed-by: Alexandre Soro <code@soro.dev> Co-authored-by: renovate <renovate@git.tristess.app> Co-committed-by: renovate <renovate@git.tristess.app>
Improves the performance of globe's
coveringTiles
function, adds benchmarks to measure globecoveringTiles
performance, also likely slightly improves mercator'scoveringTiles
performance (not measured, but some of the changes should help there too).Improvements:
Performance
There are two benchmarks, one with the camera looking at the globe from above, one with a pitched camera. The camera slowly pans to the east during the benchmark. Here are the rough contributions of individual changes: