Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Draco decoding for vertex colors that are normalized UNSIGNED_BYTE or UNSIGNED_SHORT #12417

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Jan 8, 2025

Description

The draco decoder incorrectly decodes vertex colors that are normalized UNSIGNED_BYTE or UNSIGNED_SHORT.

The fix is to not hardcode attributesToSkip in decodeDraco. If vertex colors were originally normalized UNSIGNED_BYTE or UNSIGNED_SHORT and the attribute transform is skipped they will be read as an unnormalized INT instead of normalized UNSIGNED_BYTE or UNSIGNED_SHORT. So the fix is to only skip the attribute transform if the vertex colors were quantized from FLOAT.

Most of the other changes are passing primitive to GltfDracoDecoder.

Before After
image image

Issue number and link

Testing plan

See this sandcastle that loads two tilesets, one with normalized UNSIGNED_BYTE vertex colors, and another with FLOAT vertex colors. The first tileset looks incorrect in main and correct on this branch. The second tileset looks correct on both.

I spot checked a few other sandcastle that have Draco compressed models like Google 3D Tiles and the Montreal Point Cloud and those still seem fine.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

github-actions bot commented Jan 8, 2025

Thank you for the pull request, @lilleyse!

✅ We can confirm we have a CLA on file for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant