unwrap

  • experimental
  • Generate new texture coordinates (“UV mappings”) for Primitives. Useful for adding texture coordinates in scenes without existing UVs, or for creating a second set of texture coordinates for baked textures such as ambient occlusion maps and lightmaps. Operation may increase vertex count to accommodate UV seams.

    UV layouts may be grouped, reducing the number of textures required. Available groupings:

    • "primitive": Each primitive is given it's own texcoord atlas.
    • "mesh": All primitives in a mesh share a texcoord atlas. (default)
    • "scene": All primitives in the scene share a texcoord atlas.

    Example:

    import * as watlas from 'watlas';
    import { unwrap } from '@gltf-transform/functions';
    
    // Generate a TEXCOORD_1 attribute for all primitives.
    await document.transform(
      unwrap({ watlas, texcoord: 1, overwrite: true, groupBy: 'scene' })
    );
    

    For more control and customization, see unwrapPrimitives.

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.