Repository navigation
expose context antialiasing and draw 3d things into main framebuffer - #7821
Merged
Merged
Conversation
kkaefer
approved these changes
Jan 30, 2019
| StencilMode.disabled, | ||
| ColorMode.disabled); | ||
|
|
||
| // Then draw all the extrusions a second type, only coloring fragments if they have the |
Previously, both fill-extrusions and custom layers were drawn into a offscreen framebuffer before being copied over to the main framebuffer. Drawing directly into the main frame buffer is better because: - it avoids fragment-expensive copies - it unblocks using msaa antialiasing (which only works in the main Drawing opaque extrusions and custom layers involved few changes. Transparent extrusions needed to be implemented differently. They now use a two pass approach: - the first pass only draws depth - the second pass only colors a sufrace if it's depth matches Some tweaks were made to how we draw stencil masks so that we could use the stencil buffer in the second pass to prevent double-shading. The changes should reduce the amount of stencil clears that happen. The way fill-extrusion-opacity works across layers was already kind of weird. This pr makes no attempt to change any of that behaviour. It should be completely backwards compatible.
ansis
force-pushed
the
fill-extrusions-main-framebuffer
branch
from
February 25, 2019 18:07
6cba5b9 to
6ee5daf
Compare
astojilj
added a commit
to mapbox/mapbox-gl-native
that referenced
this pull request
Jul 7, 2019
This fixes following issues: * Fix some false passing combinations/fill-extrusion-translucent--XXXX tests * Fix and enable other, failing but ignored, combinations/fill-extrusion-translucent--XXXX tests * Fix rendering of layers that are on top of fill-extrusion layers state.getProjMatrix(nearClippedProjMatrix, 100) caused that tests with size 64x64 were not rendering fill extrusions: far plane calculated as 96.9 and near plane set to 100 was the cause. near plane is changed from hardcoded 100 to depend on state.getCameraToCenterDistance() - producing similar value but one that follows max zoom. This caused that e.g. combinations/fill-extrusion-translucent--fill-opaque was falsely passing as only fill-opaque layer got rendered. combinations/fill-extrusion-translucent--XXXX tests expose regression #14844 (comment) in #14844, #14779. Fix (opaquePassCutoff, is3D) is ported from mapbox/mapbox-gl-js#7821 Fixes: #14844, #14779, #15039
astojilj
added a commit
to mapbox/mapbox-gl-native
that referenced
this pull request
Jul 9, 2019
This fixes following issues: * Fix some false passing combinations/fill-extrusion-translucent--XXXX tests * Fix and enable other, failing but ignored, combinations/fill-extrusion-translucent--XXXX tests * Fix rendering of layers that are on top of fill-extrusion layers state.getProjMatrix(nearClippedProjMatrix, 100) caused that tests with size 64x64 were not rendering fill extrusions: far plane calculated as 96.9 and near plane set to 100 was the cause. near plane is changed from hardcoded 100 to depend on state.getCameraToCenterDistance() - producing similar value but one that follows max zoom. This caused that e.g. combinations/fill-extrusion-translucent--fill-opaque was falsely passing as only fill-opaque layer got rendered. combinations/fill-extrusion-translucent--XXXX tests expose regression #14844 (comment) in #14844, #14779. Fix (opaquePassCutoff, is3D) is ported from mapbox/mapbox-gl-js#7821 Fixes: #14844, #14779, #15039
astojilj
added a commit
to mapbox/mapbox-gl-native
that referenced
this pull request
Jul 9, 2019
This fixes following issues: * Fix some false passing combinations/fill-extrusion-translucent--XXXX tests * Fix and enable other, failing but ignored, combinations/fill-extrusion-translucent--XXXX tests * Fix rendering of layers that are on top of fill-extrusion layers state.getProjMatrix(nearClippedProjMatrix, 100) caused that tests with size 64x64 were not rendering fill extrusions: far plane calculated as 96.9 and near plane set to 100 was the cause. near plane is changed from hardcoded 100 to depend on state.getCameraToCenterDistance() - producing similar value but one that follows max zoom. This caused that e.g. combinations/fill-extrusion-translucent--fill-opaque was falsely passing as only fill-opaque layer got rendered. combinations/fill-extrusion-translucent--XXXX tests expose regression #14844 (comment) in #14844, #14779. Fix (opaquePassCutoff, is3D) is ported from mapbox/mapbox-gl-js#7821 Fixes: #14844, #14779, #15039
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The primary goal is to support antialiasing for custom layers (#7543) by exposing an option to use the context-provided msaa antialiasing. This only works in the main framebuffer so we first need to switch to drawing custom layers an buildings into the main framebuffer. Previously they were drawn into an offscreen framebuffer.
Drawing into the main framebuffer
Drawing directly into the main frame buffer is better because:
New method for transparent fill-extrusions
Drawing opaque extrusions and custom layers involved few changes. Transparent extrusions needed to be implemented differently. They now use a two pass approach:
The way fill-extrusion-opacity works across layers was already kind of weird. This pr makes no attempt to change any of that behaviour. It should be completely backwards compatible.
Stencil buffer changes
I made some tweaks to how we use the stencil buffer so that we could do this. The changes should improve performance as well because we avoid doing expensive stencil clears.
Antialiasing
This fixes #7543 by exposing a new
antialiasmap option that is used during gl context creation.Launch Checklist
@kkaefer can you review the first commit with two-pass extrusion rendering and stencil buffer changes?
@mourner can you review the second commit that adds the antialias option