Skip to content

gltfpack: Implement support for half-precision positions/UVs#1004

Draft
zeux wants to merge 4 commits intomasterfrom
gltf-half
Draft

gltfpack: Implement support for half-precision positions/UVs#1004
zeux wants to merge 4 commits intomasterfrom
gltf-half

Conversation

@zeux
Copy link
Owner

@zeux zeux commented Jan 16, 2026

When -vph or -vth flag is specified, similarly to -vpf or -vtf, we now use
half-precision floating-point attribute storage via KHR_accessor_float16 extension.

Note that the extension is still in draft, and doesn't appear to have support by existing renderers yet. If it does get added, it will be an interesting alternative to other options gltfpack provides, as it results in the same VRAM cost and a similar resulting file size compared to the default 16-bit integer quantization, albeit at a slightly lower (butmore adaptive) precision.

Extension: KhronosGroup/glTF#2397

zeux added 4 commits January 16, 2026 09:49
When -vph or -vth is specified, similarly to -vpf or -vtf, we use
half-precision floating-point attribute storage. This results in the
same scene or material structure without extra transform nodes, but
unlike -vpf/-vtf the resulting asset uses the same amount of memory as
it does by default when using integer quantization.

Half-precision floats have ~11 bits of relative precision (10 + implied
1); this is lower precision than either position or texture coordinates
use by default. As such, some assets might see excessive deformation -
however, unlike integer quantization, individual meshes do not have to
fit the same coordinate grid, so in practice it may be fine.
Half-precision encoding will use infinity to represent values above 65504;
we now detect this and warn, suggesting -vpf which has a much larger
range.
Mention KHR_accessor_float16 support.
This avoids GCC warning for enum switches; this does mean we'll need to
carry a cgltf.h patch around across version updates, but maybe this can
be upstreamed in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant