Skip to content
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 - symbols & symbol bugfixes #4067

Merged
merged 22 commits into from
May 20, 2024

Conversation

kubapelc
Copy link
Contributor

@kubapelc kubapelc commented May 2, 2024

Symbol layer adaptation + symbol bugfixes

Issue & discussion of globe:

maplibre/maplibre#190
maplibre/maplibre#161

Additions and changes since the previous PR:

  • Adapted symbol layer type for globe.
  • Fixed another source of tiny seams in the fill layer when globe is enabled (the draw_fill and painter changes are related to this).
  • Symbol bugfixes:
    • Fixed symbol collision debug view (showCollisionBoxes) not showing the actual bounding boxes used for collision and click areas. The displayed boxes now match actual collision boxes exactly. Displayed collision boxes will react to map motion with some latency. (Just as the actual collision boxes do.)
    • Fixed symbol collisions using inaccurate and sometimes entirely wrong collision boxes when the map is pitched or rotated. (#210)
    • Fixed symbol collision boxes not being accurate for variable-anchor symbols.
    • Fixed icon collision boxes using text-translate property for translation instead of the correct icon-translate.
    • Fixed text-translate and icon-translate behaving weirdly and inconsistently with other -translate properties. (#3456)
    • Updated some old render tests to reflect new symbol & collision box behaviour, added several new render tests (in addition to render tests for symbols on a globe).

I've updated the public globe demo with MapLibre build from this PR:

https://kvaleya.gitlab.io/maplibre/globe/globedemo.html

Main vector globe branch with all changes

Screenshot of a globe with symbols and debug collisions enabled.

Screenshot of a globe with symbols and debug collisions, with many test texts.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
    • Most changes and new functionality is covered by render tests.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@codecov-commenter
Copy link

codecov-commenter commented May 2, 2024

Codecov Report

Attention: Patch coverage is 80.21390% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 86.94%. Comparing base (d2d8f75) to head (66b7891).

Files Patch % Lines
src/geo/projection/globe.ts 67.85% 15 Missing and 3 partials ⚠️
src/symbol/symbol_layout.ts 29.41% 11 Missing and 1 partial ⚠️
src/geo/projection/mercator.ts 66.66% 4 Missing and 1 partial ⚠️
src/render/draw_collision_debug.ts 83.33% 0 Missing and 1 partial ⚠️
src/render/draw_symbol.ts 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            globe    #4067       +/-   ##
===========================================
+ Coverage   70.12%   86.94%   +16.82%     
===========================================
  Files         249      250        +1     
  Lines       34756    34854       +98     
  Branches     1326     2122      +796     
===========================================
+ Hits        24371    30303     +5932     
+ Misses       9059     3548     -5511     
+ Partials     1326     1003      -323     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kubapelc
Copy link
Contributor Author

kubapelc commented May 2, 2024

Globe render tests for symbols are duplicated - each test has two variants, one with collision box debug disabled, and one with enabled. In base MapLibre, collision tests are separate, so I separated them here as well. But I'm wondering if I could keep just the variant with collisions for globe render tests, since it also inherently tests regular symbol rendering.

@kubapelc
Copy link
Contributor Author

kubapelc commented May 2, 2024

Also, in the second screenshot on the left side you can notice the pitch-alignment: map texts having their bounding box slightly off. I have no idea why that happens. I've decided to go ahead with the PR anyway, since it is a minor offset and only happens on pitch-alignment: map texts that are "planetary scale", which is probably an edge case in real maps.

@HarelM
Copy link
Member

HarelM commented May 3, 2024

I'll review this in the coming days, thanks for this!
I thought I already asked, but I prefer to ask again, just to be on the safe side:
Is it possible to fix the collision boxes in the main branch and not only here?
It would be beneficial to people using the production version until this branch is merged.

@kubapelc
Copy link
Contributor Author

kubapelc commented May 3, 2024

Is it possible to fix the collision boxes in the main branch and not only here?

I know I've previously said that the changes are too deeply rooted into globe, but after taking another look at the actual diffs of the files, I think it might not be too much work to port it over to main. The easiest approach is to create a greatly reduced version of the Projection interface from globe and use that in symbols. Is that an ok approach?

@HarelM
Copy link
Member

HarelM commented May 3, 2024

I believe so, as long as we keep the changes minimal I think it will be a good way forward.

@HarelM
Copy link
Member

HarelM commented May 3, 2024

Let's focus on the following PR first:

Once merged to main and to globe branch and to globe-pr-symbol I'll review this PR.
Thanks for your patience.

@HarelM
Copy link
Member

HarelM commented May 15, 2024

There's a need to resolve conflict I suppose.
Let me know if there's anything I can do to help.

…symbols

# Conflicts:
#	CHANGELOG.md
#	src/data/bucket/symbol_bucket.test.ts
#	src/geo/projection/globe.ts
#	src/geo/projection/mercator.ts
#	src/geo/projection/projection.ts
#	src/render/draw_collision_debug.ts
#	src/render/draw_symbol.ts
#	src/render/program/collision_program.ts
#	src/shaders/collision_box.vertex.glsl
#	src/shaders/symbol_icon.vertex.glsl
#	src/shaders/symbol_sdf.vertex.glsl
#	src/shaders/symbol_text_and_icon.vertex.glsl
#	src/style/pauseable_placement.ts
#	src/symbol/collision_index.test.ts
#	src/symbol/collision_index.ts
#	src/symbol/placement.ts
#	src/symbol/projection.test.ts
#	src/symbol/projection.ts
#	src/symbol/symbol_layout.ts
#	test/build/min.test.ts
#	test/integration/render/tests/debug/collision-text-translate/rotation-alignment-map/pitch-alignment-map/text-translate-anchor-map/expected.png
#	test/integration/render/tests/debug/collision-text-translate/rotation-alignment-map/pitch-alignment-map/text-translate-anchor-viewport/expected.png
#	test/integration/render/tests/debug/collision-text-translate/rotation-alignment-viewport/pitch-alignment-map/text-translate-anchor-map/expected.png
#	test/integration/render/tests/debug/collision-text-translate/rotation-alignment-viewport/pitch-alignment-map/text-translate-anchor-viewport/expected.png
The 10 kb size increase seems to come from the main branch
…symbols

# Conflicts:
#	test/build/min.test.ts
src/render/draw_symbol.ts Outdated Show resolved Hide resolved
src/render/draw_symbol.ts Outdated Show resolved Hide resolved
@HarelM HarelM merged commit 759606a into maplibre:globe May 20, 2024
13 checks passed
@kubapelc
Copy link
Contributor Author

I've managed to remove useSpecialProjectionForSymbols altogether in my dev branch, as discussed in this thread: #4067 (comment)

@HarelM
Copy link
Member

HarelM commented May 22, 2024

GREAT! Thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants