Add option to compress vertex normal tangent to axis angle#24535
Open
beicause wants to merge 1 commit into
Open
Add option to compress vertex normal tangent to axis angle#24535beicause wants to merge 1 commit into
beicause wants to merge 1 commit into
Conversation
e8ca3c0 to
2b8020e
Compare
2b8020e to
951b232
Compare
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.
Objective
Followup to #21926. Adds option to compress vertex normal tangent into axis angle which saves 4 bytes per vertex.
Solution
Add a new
MeshAttributeCompressionFlags::PACKED_AXIS_ANGLE_TBNflag. If it's enabled and position, normal and tangent are all need to be compressed, we convert TBN to axis angle representation - octahedral encoded Snorm16x2 axis in normal location + Snorm16 angle in position.w.Compared to oct encoded normal + oct encoded tangent, byte usage is reduced by 2, but it utilizes the unused w component in compressed position so the actual reduction is 4 bytes, considering most users don't fill position.w with custom data.
Testing
I modified the
deferred_renderingexample to use axis-angle compression for the cube with parallax mapping.