Skip to content

quantizeColor #293

Answered by zeux
pasu asked this question in Q&A
May 24, 2021 · 2 comments
Discussion options

You must be logged in to vote

Imagine that we're using 16 bit colors to serialize in the glTF file. As per glTF spec, the only two fixed-point widths are 8 bit and 16 bit, and you have to store the value in 0..1 range, so you can't e.g. use 12 bits for storage. However, 16 bits is usually overkill from the precision perspective - as such, even for high quality color storage something like 12 bits is enough.

It's possible to simply round the bit count to the next multiple of 8 (12 -> 16) and use that for storage. That's what meshopt_quantizeUnorm does (when bits is 12, bytebits is 16). However, gltfpack tries to remove extra noise from the lower bits of the color by masking them out, which results in higher compression…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pasu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants