[FIX] Correct vertex format mismatch when decoding Draco meshes#8394
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a critical bug in the rendering of Draco-compressed GLB files caused by vertex format mismatches between the Draco worker and GLB parser. The issue occurred when Draco meshes contained additional attributes not listed in the glTF primitive.attributes, leading to incorrect stride calculations and vertex data interpretation.
Changes:
- Draco worker now returns detailed attribute metadata (data type, component count, offset) and the actual vertex buffer stride
- GLB parser builds vertex descriptions from worker-provided metadata instead of glTF accessor data
- Added validation to prevent crashes when primitive.indices is undefined
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/framework/parsers/draco-worker.js | Added toEngineDataType() function and modified attribute metadata to include data types, offsets, and stride; improved handling of generated normals |
| src/framework/parsers/glb-parser.js | Refactored vertex description building to use worker metadata; fixed vertex count calculation using worker stride; added defensive check for undefined indices |
| src/framework/parsers/draco-decoder.js | Added stride field passthrough from worker to callback |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
mvaligursky
approved these changes
Jan 21, 2026
willeastcott
added a commit
that referenced
this pull request
Jan 26, 2026
* [FIX] Correct vertex format mismatch when decoding Draco compressed meshes * Update src/framework/parsers/draco-worker.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Summary
Technical Details
The root cause was a mismatch between how the Draco worker produces vertex data and how the GLB parser interprets it:
Stride mismatch: The Draco worker processes ALL attributes from the mesh and calculates stride based on all of them. The GLB parser only knew about attributes listed in
primitive.attributes, causing incorrect vertex count calculations when extra attributes existed.Data type mismatch: The parser was using glTF accessor
componentTypewhich may differ from Draco's actual decoded data type.Changes
draco-worker.js:
toEngineDataType()to convert Draco types to PlayCanvas TYPE_* constants{ id, dataType, numComponents, offset }for each attributestride(actual vertex buffer stride) in the resultdraco-decoder.js:
stridefield through the callbackglb-parser.js:
numVertices = vertices.byteLength / strideFixed #7370
Checklist