Minimizing glTF Morph Target Memory Footprint

Morph targets—commonly known as blend shapes—allow for complex skeletal-free animations such as facial expressions, but they can quickly inflate memory consumption because each target duplicate portions of the base mesh data. This article explores practical technical strategies to significantly reduce the runtime and storage footprint of glTF morph targets, including the use of sparse accessors, attribute quantization, vertex stream stripping, texture-based deformation, and distance-based level of detail (LOD) management.

Utilize Sparse Accessors

By default, morph targets store displacement data for every single vertex in the base mesh. However, most morphs—such as a raised eyebrow or a lip curl—only deform a localized cluster of vertices. The glTF 2.0 specification natively supports sparse accessors, which store only the indices and displacement vectors of the vertices that actually move. Converting full morph arrays into sparse accessors eliminates redundant zero-displacement values, dramatically lowering both file size and memory requirements.

Quantize Morph Target Attributes

Morph target vectors (positions, normals, tangents) are typically authored using full 32-bit floating-point numbers (FLOAT). Using the KHR_mesh_quantization extension, these can be quantized down to normalized integers:

  • Positions: Compress to 16-bit signed normalized integers (SHORT).
  • Normals and Tangents: Compress to 8-bit signed normalized integers (BYTE).

This conversion cuts the memory required for vertex attribute buffers by 50% to 75% while maintaining visual fidelity within typical tolerance thresholds.

Apply KHR_meshopt_compression

For transmission and initial load memory, applying the KHR_meshopt_compression extension optimizes vertex attribute streams for fast hardware-assisted decompression. It arranges the data layout sequentially to maximize cache efficiency and significantly reduces download size without imposing heavy runtime decoding penalties.

Strip Unnecessary Morph Attributes

Not all morph targets require displacement data for positions, normals, and tangents simultaneously:

  • Drop Tangents: If your shader computes tangents analytically in the fragment shader (e.g., using screen-space derivatives), omit morph tangents completely.
  • Recalculate Normals: If shading artifacts are minimal or computing normals via shaders dynamically is feasible, eliminate morph normal attributes and only store position deltas.
  • Remove Low-Influence Morphs: Cull minor targets that move vertices by sub-pixel distances during standard viewing conditions.

Adopt Texture-Based Morph Targets (VAT)

Hardware vertex attribute limits (often limited to 8 or 16 active vertex attributes on mobile GPUs) make high-count morph setups difficult to load natively. Storing vertex offsets inside 2D high-dynamic-range (HDR) data textures (Vertex Animation Textures) moves the memory footprint from vertex buffer memory to standard texture memory. Textures can be loaded, mipmapped, compressed, and sampled directly in vertex shaders, bypassing vertex attribute buffer limits entirely.

Implement Dynamic Morph Target LODs

Distance-based Level of Detail (LOD) techniques should govern morph target usage at runtime:

  • Far LODs: Disable morph targets entirely when an object is far from the camera, falling back to basic skeletal or rigid animation.
  • Mid LODs: Strip high-frequency targets (micro-expressions, minor wrinkles) and keep only dominant shapes (mouth open, eyes closed).
  • Near LODs: Render the full complement of morph targets only during close-up shots or cinematic views.