Skip to content

Add option to compress vertex normal tangent to axis angle#24535

Open
beicause wants to merge 1 commit into
bevyengine:mainfrom
beicause:vertex-compression-axis-angle
Open

Add option to compress vertex normal tangent to axis angle#24535
beicause wants to merge 1 commit into
bevyengine:mainfrom
beicause:vertex-compression-axis-angle

Conversation

@beicause
Copy link
Copy Markdown
Member

@beicause beicause commented Jun 5, 2026

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_TBN flag. 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_rendering example to use axis-angle compression for the cube with parallax mapping.

@beicause beicause force-pushed the vertex-compression-axis-angle branch from e8ca3c0 to 2b8020e Compare June 5, 2026 09:27
@beicause beicause force-pushed the vertex-compression-axis-angle branch from 2b8020e to 951b232 Compare June 5, 2026 09:32
@ickshonpe ickshonpe added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times labels Jun 5, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Jun 5, 2026
@ickshonpe ickshonpe added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

2 participants