sparse

  • Scans all Accessors in the Document, detecting whether each Accessor would benefit from sparse data storage. Currently, sparse data storage is used only when many values (>= ratio) are zeroes. Particularly for assets using morph target ("shape key") animation, sparse data storage may significantly reduce file sizes.

    Example:

    import { sparse } from '@gltf-transform/functions';
    
    accessor.getArray(); // → [ 0, 0, 0, 0, 0, 25.0, 0, 0, ... ]
    accessor.getSparse(); // → false
    
    await document.transform(sparse({ratio: 1 / 10}));
    
    accessor.getSparse(); // → true
    
Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.