Skip to content

Fix fill outline rendering - #10456

Merged
mpulkki-mapbox merged 4 commits into
mainfrom
mpulkki-fix-fill-outline
Mar 16, 2021
Merged

mpulkki-mapbox merged 4 commits into
mainfrom
mpulkki-fix-fill-outline

Conversation

@mpulkki-mapbox

@mpulkki-mapbox mpulkki-mapbox commented Mar 11, 2021 •

Copy link
Copy Markdown
Contributor

Anti-aliasing implementation used in fill outline shader is erroneously comparing coordinates with different interpolation modes. gl_FragCoord is interpolated linearly in screen space whereas varyings are using perspective correct interpolation. This results in lines disappearing when map pitch is set to > 0 as seen in following animations:

bug_0
bug_1

This can be fixed by either using noperspective qualifier with varying variables or doing it by hand in the shader code. The latter approach is used in this PR as noperspective is not supported in webgl 1 & 2.

fix

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • manually test the debug page
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Fixed disappearing fill outlines when map pitch angle was greater than 0</changelog>

@mpulkki-mapbox mpulkki-mapbox self-assigned this Mar 11, 2021
@mpulkki-mapbox
mpulkki-mapbox force-pushed the mpulkki-fix-fill-outline branch from 175c86c to 5d0801c Compare March 11, 2021 09:00
@mpulkki-mapbox
mpulkki-mapbox marked this pull request as ready for review March 11, 2021 09:03

@karimnaaji karimnaaji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice find! One nit on the changelog entry before we can merge.

Comment thread CHANGELOG.md Outdated
### 🐞 Bug fixes

- Fixed a font glyphs performance regression on Firefox. ([10363](https://github.com/mapbox/mapbox-gl-js/pull/10363))
- Fixed disappearing fill outlines when map pitch angle was greater than 0. ([10456](https://github.com/mapbox/mapbox-gl-js/pull/10456))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move that directly in the PR description as this is the changelog for 2.1.1, we compile the changelog only prior to the release.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great! I'll move the changelog entry to the PR description 👍

Comment thread src/shaders/fill_outline.vertex.glsl Resolved
mpulkki-mapbox and others added 3 commits March 12, 2021 09:08
 - Anti-aliasing implementation used in fill outline shader is
erroneously comparing coordinates with different interpolation modes.
gl_FragCoord is interpolated linearly in screen space whereas vayrings
are using perspective correct interpolation. This results in lines
disappearing when map pitch is set to > 0.
@mpulkki-mapbox
mpulkki-mapbox force-pushed the mpulkki-fix-fill-outline branch from 60c279a to 5b40a26 Compare March 12, 2021 07:18
@mpulkki-mapbox

Copy link
Copy Markdown
Contributor Author

Render test text-pitch-alignment/viewport-text-depthtest has started failing as part of this pull request. After further investigation the test seems to be already broken but subtle changes introduced in this PR if enough to throw the image diff over the threshold value.

Actual and expected images using origin/main branch.
actual
expected

@karimnaaji karimnaaji added this to the v2.3 milestone Mar 12, 2021

@karimnaaji karimnaaji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good, for #10456 (comment), I think you can rebaseline the test for this PR and open a separate ticket for follow up, as it's not a regression introduced here.

@mpulkki-mapbox
mpulkki-mapbox merged commit 32ceb58 into main Mar 16, 2021
@mpulkki-mapbox
mpulkki-mapbox deleted the mpulkki-fix-fill-outline branch March 16, 2021 07:38
astojilj added a commit that referenced this pull request Apr 13, 2021
Reverting because of change in behavior with no pitch on mobile.

This reverts commit 32ceb58.
astojilj added a commit that referenced this pull request Apr 14, 2021
Reverting because of change in behavior with no pitch on mobile.

This reverts commit 32ceb58.
@karimnaaji karimnaaji removed this from the v2.3 milestone May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants