Mask non-opaque
proxy tiles with stencil buffer
#704
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR eliminates a long-standing, nasty artifact that occurs with features rendered with non-
opaque
blend modes when zooming -- as one or more levels of proxy tiles are rendered on top of each other (and/or with the new tile that is loading to replace them), the compounding alpha causes a flickering effect.This PR avoids these artifacts using the stencil buffer: proxy tiles are drawn from front to back, with the stencil buffer adjusted for each level (e.g. zoom ancestor or descendant level) such that proxies will only draw pixels not previously covered by a previous level. Note, it's important that pixels from proxies are allowed to overwrite other pixels from the same proxy level, for overlapping geometries to render properly; we just want to mask out pixels from other, previously draw proxy tile levels.
(The
translucent
blend mode already avoided this problem, also by using the stencil buffer, though tailored for the particular "x-ray" effect of that blend mode, where backfaces are eliminated from translucent geometry.)Before 😭
After 😌
Note: this PR builds on the commits of #703 for convenience (changed similar code). The specific changes for this feature are f7a10c1...8bfc5d0.