createInstanceNodes

  • createInstanceNodes(batchNode: Node): Node[]
  • Given a Node with an InstancedMesh extension, returns a list containing one Node per instance in the InstancedMesh. Each Node will have the transform (translation/rotation/scale) of the corresponding instance, and will be assigned to the same Mesh.

    May be used to unpack instancing previously applied with instance and EXTMeshGPUInstancing. For a transform that applies this operation to the entire Document, see uninstance.

    Example:

    import { createInstanceNodes } from '@gltf-transform/functions';
    
    for (const instanceNode of createInstanceNodes(batchNode)) {
     batchNode.addChild(instanceNode);
    }
    
    batchNode.setMesh(null).setExtension('EXTMeshGPUInstancing', null);
    
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.