-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Use GetAttribute
to enable Draco quantization when possible
#9904
Conversation
Thanks for the pull request @ebogo1!
Reviewers, don't forget to make sure that:
|
var attributesToSkip = ["POSITION", "NORMAL"]; | ||
var compressedAttributes = parameters.compressedAttributes; | ||
if (!defined(compressedAttributes["COLOR_1"])) { | ||
attributesToSkip.push("COLOR"); | ||
} | ||
if (!defined(compressedAttributes["TEXCOORD_1"])) { | ||
attributesToSkip.push("TEX_COORD"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glTF does allow for TEXCOORD_2
, TEXCOORD_3
, etc so some of this glTF attribute name -> draco name mapping could be organized in a more general way. Though to be fair, TEXCOORD_2
and higher are only used in ModelExperimental
and if we're expecting a bug fix in draco soon then maybe we don't have to worry about it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was that if there were more than one TEXCOORD, the numbering would go in order, meaning that at least TEXCOORD_1
would exist - in which case, we would not call SkipAttributeTransform()
. Is it possible to just have one TEXCOORD and call it TEXCOORD_2
? I'm not sure I'm following your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's true, never mind then. From the glTF spec:
All indices for indexed attribute semantics MUST start with 0 and be consecutive positive integers
Thanks for the quick turnaround @ebogo1. For 99% of cases we can use quantization again! |
Forgot to mention, I tested all the 3D models and 3D Tiles related sandcastles and ran the unit tests locally. |
Thanks @lilleyse. I tested microcosm-draco.gltf.zip (converted from https://github.com/CesiumGS/cesium/tree/main/Specs/Data/Models/GltfLoader/Microcosm/glTF with gltf-pipeline), which has multiple TEXCOORD attributes and all seems to work as expected. |
This is a temporary workaround for #9847. See google/draco#742 (comment) for more info. Since
SkipAttributeTransform
breaks lookups withGetAttributeByUniqueId
, this PR uses the alternative approach withGetAttributeId
andGetAttribute
to preserve quantization when possible.The downside is that this might not work when there are multiple sets of an attribute, i.e.
TEXCOORD_0
andTEXCOORD_1
. Because of this, we only callSkipAttributeTransform
with the newGetAttribute
approach for "single" attributes. Otherwise, we continue without quantization and use theGetAttributeByUniqueId
call as before.I'm working on adding back some of the specs that were removed previously, but the core change is all in decodeDraco.js.