Dequantize WEB3D_quantized_attributes
#154
Open
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.
When the
upgrade
command encounters tile content (like B3DM) that still contains glTF 1.0 data, then this is first converted into glTF 2.0 usinggltf-pipeline
. Any other update steps are then performed based on this glTF 2.0 data.When the glTF 1.0 content used the
WEB3D_quantized_attributes
extension, thengltf-pipeline
will not handle this: It will upgrade most of the glTF to 2.0, but does not know what to do with this extension. It therefore leaves the extension objects in the accessors, and keeps the extension in theextensionsRequired
declaration. Subsequent upgrade steps (mostly based on glTF-Transform) could then not be performed, because glTF-Transform bailed out due to the unsupported (but required) extension.There could be different ways of addressing this.
gltf-pipeline
. But dequantizing and replacing an accessor requires a bit of manual fiddling (adding accessors and buffer views, removing old accessors and buffer views...)WEB3D_quantized_attributes
extension is used. If it is used, then thedecodeMatrix
arrays from the extension objects of the accessor are extracted, and the extension declaration is removed. The resulting document is read with glTF-Transform, and the accessors that contained the extension object are replaced with dequantized ones.This is a bit "sneaky": At some point, the whole thing is a glTF 2.0 document that still contains the quantized accessors, and they are decoded "manually" based on the knowledge from its original representation. The reason for this approach is... mainly that juggling around with the accessors is so convenient in the glTF-Transform document...
There are currently zero tests and examples. It's hard to find B3DM data that still contains glTF 1.0, and even more to find such data that additionally contains
WEB3D_quantized_attributes
(this wasn't really widely used). So this is just a draft PR, considered to be a "preview" or "workaround". Feedback is still appreciated.