Fixes model-billboard depth interactions #13018
Open
+37
−11
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.
Description
In #12821, I turned off automatic depth testing for billboards / labels, and implemented it manually in the shaders. This was to give us more control over how these entities clip against the globe at various distance scales. (We've done a similar thing in the past, this was supposed to improve / build on those techniques)
That PR introduced a regression: the outlines or transparent parts of billboards and labels will now clip through models no matter what. This is because:
Moreover, in digging into this bug, I realized that there's another bug: opaque billboards / labels also do not respect the depth of other opaque billboards / labels, since the opaque billboard pass only reads from the globe depth, but doesn't write back to it (and you can't read-from and write-to the same depth texture in webgl2, in the same pass).
Solution
This gets us the best of both worlds - more depth testing control but also we still utilize the standard depth testing pipeline and thus get proper clipping against models and other billboards, without poor clipping against the globe.
Issue number and link
#13012
Testing plan
Same testing plan as in #12821, but with an additional regression test per the linked issue:
Test this sandcastle, and confirm that, on this branch, it looks the way it does in the Cesium 1.134 picture of the linked issue.
Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my change