-
-
Notifications
You must be signed in to change notification settings - Fork 688
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 - basic infrastructure, raster layer adaptation for globe #3783
Conversation
Fix minor issues so that it compiles.
Minor changes (remove terrain, set initial zoom 0, change title and description)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## globe #3783 +/- ##
==========================================
- Coverage 86.56% 86.35% -0.22%
==========================================
Files 240 247 +7
Lines 32273 33098 +825
Branches 1956 2024 +68
==========================================
+ Hits 27937 28581 +644
- Misses 3416 3560 +144
- Partials 920 957 +37 ☔ View full report in Codecov by Sentry. |
Thanks a lot for opening this PR!! |
…stroy method to projection
Warning fixed by changing ring buffer size to 1, making ring buffer pointless, so I removed it.
I fixed the issue with Chrome warning related to FenceSync and pixel readback. |
@kubapelc do you think you can create a PR only for the |
For now I copied the |
I think I resolved all the current implemented review comments, I left those that are still relevant I believe. |
Change parseRGBA8float to a private static function, use isWebGL2 function instead of instanceof
… getProjectionData(null, null)
I think most code review comments were resolved. |
@HarelM I've added some render tests in a previous commit, and now I've added unit tests for globe and mercator as well, although they don't test too much functionality. I'll think about what else I can cover with unit tests. I've fixed the bundle size in build test. |
Great, seems like a recent change caused tests to fail. |
This is now merged to globe branch, I'll do my best to keep this brach up-to-date with main. |
This is the first PR of the implementation of vector globe view for MapLibre. It is a selection of changes from my main vector globe branch as well as interface and changes from @Pheonor's globe implementation. More PRs will follow with more of the globe rendering implementation. I plan to split PRs into smaller ones for easier reviewing, as requested.
Issue & discussion of globe:
maplibre/maplibre#190
maplibre/maplibre#161
Additions and changes
map.ts
and Map constructor to include projectionsrc/shaders/_projection_mercator.vertex.glsl
for an exampleprojectTile()
projects a point in local tile coordinates (0..EXTENT) to screenu_matrix * vec4(a_pos, 0.0, 1.0)
in shaders)ProjectionBase
class, and its implementations for Mercator and Globe projectionsmap.ts
to allow custom layers to implement globe view using shader projection preludestest/examples/globe.html
)tilesAfterTime
implementation interrain_source_cache.ts
Example
See
test/examples/globe.html
for a web page that displays a satellite map projected onto a globe. Note that only the raster layer is currently adapted for globe projection, so lines and symbols will still display as if on a mercator map.The projection will automatically transition to mercator at high zoom levels. The transition is animated and happens at a point when globe is already almost indistinguishable from mercator projection, so it is nearly unnoticeable.
Changes compared to Pheonor's repo
@Pheonor please also review this PR, especially the following changes and adaptations from your branch:
project
andunproject
methods from the projection classes for now, as they are not used by anything (yet).transform.ts
intomap.ts
, as transform might exist in multiple instances, but map should (as far as I know) only ever exist in one single instance.Problem: where to place granularity settings?
Granularity determines how much subdivision is applied to tile geometry. For example, a subdivision granularity of 4 will "split" all geometry in a tile as if it was cut by the edges of a 4x4 grid. Different zoom levels have different granularities. Granularity for a given zoom level is determined by a simple function.
It is relatively clear how to set granularity levels for globe projection, and thus, if MapLibre only ever used globe view, those values could be static. But what if the user wants a map that will always use mercator? Then there is no need for subdivision to slow down tile parsing and rendering. Or what if a different projection in the future needs different granularities?
Subdivision functions are used in
*_bucket.ts
(fill, fill-extrusion and line buckets), right before generating vertex buffers. The bucket functions run in a separate web worker which has no access to the map or transform instance, as far as I know. Furthermore, the granularity doesn't depend only on zoom level, but also on what type of geometry is getting subdivided - for example line layers use higher granularity than fill layers.Currently, granularity settings are static, both in the sense that they cannot change eg. with projection and that they use the
static
keyword to be accessible from anywhere.I have no idea how to solve this. The data about which tiles need to be loaded (data which ultimately ends up in the bucket) passes through complex machinery and it is hard for me to even navigate through it.
In this PR, subdivision is only used for stencil masks, but following PRs will utilize it for fill, fill extrusion and line geometry as well.
Failing tests & other issues
As far as I know, about 300 render tests fail in my branch. After consulting with @wipfli I decided to publish the PR anyway, but I will continue debugging the tests and I'll try to find a fix. I don't know about the state of unit tests, I haven't managed to even run those yet. But using this branch of MapLibre for displaying a map in a web browser should work without any issues.
On Chrome, you may notice a warning about a GPU buffer guarded by a FenceSync object being read before the fence is signaled. I know about this issue and will attempt to fix it. It is related to globe projection (see classThis is now fixed.ProjectionErrorMeasurement
insrc/geo/projection/globe.ts
).Checklist
CHANGELOG.md
under the## main
section.