Fix intermittent z-fighting issue in DepthPlaneVS #12385
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.
Description
#12188 included a change to
DepthPlaneVS
, to use a pre-composedmodelViewProjection
matrix for the vertex position. This was a misguided attempt to improve precision.When multiplying by a vector by two matrices, we will usually get better precision (and performance) if we pre-multiply the matrices on the CPU. However, the projection matrix is a notable exception to this rule, as noted in #4250 (comment) based on a paper by Upchurch and Desbrun. For the view and projection matrices, sequential multiplication on the GPU side actually cancels some of the precision errors.
This PR reverts the change, to again use sequential multiplication of the
modelView
andprojection
matrices.Issue number and link
Fixes #12337
Testing plan
Testing is somewhat challenging due to the intermittent nature of the bug.
main
branch, and allow the animation to play for a few seconds until paths that should be behind the globe momentarily flash into view.Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change