← Back to Blog Devlog

Adding Animated Skinned Meshes to gdx-gltf

When I started the gdx-gltf-KHR fork the aim was narrow: add the missing compression extensions EXT_meshopt_compression and KHR_mesh_quantization so large asset counts stay viable on mobile. Static scenery worked. But games move, so the next step was supporting rigged, skinned animation.

The blockers: interleaved strides and byte order

Loading animated assets from gltfpack made the mesh vanish. The raw bytes showed two problems:

  • Endianness. Bulk copies set byte order for you, but the manual fallback loops defaulted to BIG_ENDIAN. Since glTF is little-endian, bone weights read reversed and turned into near-zero noise, making the mesh invisible.

  • Drifting strides. Aggressive compression packs geometry and skin data tightly together. Relative pointers slipped out of alignment, so bone indices ended up reading weight or texture bytes.

What I changed

A focused rewrite to the repository, handling rigged attributes without breaking existing static meshes:

  1. Force byte order. Read paths like readBufferFloat now set LITTLE_ENDIAN explicitly.

  2. Use absolute offsets. Replaced relative pointer math with fixed absolute offsets (bytes.get(index)) in the data resolver, so however tightly attributes are packed, it reads the exact slot.

  3. Scale weights separately. Updated MeshLoader.java to detect bone use and dequantize 16-bit weights into clean 0.0–1.0 floats, leaving static attributes alone.

The result

With this merged, the fork handles static scenery and animated characters under compression at the same time. Texture memory stays low through GPU compression, and rigged models now animate correctly on mobile.