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

Query quantization bits in JavaScript API #573

Closed
lilleyse opened this issue Jan 23, 2020 · 1 comment
Closed

Query quantization bits in JavaScript API #573

lilleyse opened this issue Jan 23, 2020 · 1 comment
Assignees

Comments

@lilleyse
Copy link

Is it possible to query the quantization bits used by an attribute without going through the process of skipping the attribute transform, initializing an AttributeQuantizationTransform, and getting the quantization bits from the transform?

Basically we want to decode to a float array if quantization bits is greater than 16, otherwise, decode to a uint16 array and dequantize in the shader. It's not clear if this is possible using the JavaScript API since we can't query the quantization bits until we have already called SkipAttributeTransform and initialized a AttributeQuantizationTransform.

Existing code looks something like this:

var dracoDecoder = new draco.Decoder();
dracoDecoder.SkipAttributeTransform(draco[attributeType]);
var dracoAttribute = dracoDecoder.GetAttributeByUniqueId(dracoGeometry, compressedAttribute);
var transform = new draco.AttributeQuantizationTransform();
if (transform.InitFromAttribute(dracoAttribute)) {
    console.log(transform.quantization_bits());
}
@ondys
Copy link
Collaborator

ondys commented Oct 8, 2020

This workflow would require to get the quantization settings before the decoding step which is not really feasible for the current decoder design (quantization settings are not stored in any predefined byte position). I would recommend sending the quantization settings separately from the encoded data. This should allow you to implement the behavior that you want without modifying the decoder.

@ondys ondys closed this as completed Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@lilleyse @ondys and others