Creates a new InstancedMesh property for use on a Node.
Disables and removes the extension from the Document.
Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.
Lists all ExtensionProperty instances associated with, or created by, this extension. Includes only instances that are attached to the Document's graph; detached instances will be excluded.
Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.
Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.
EXT_mesh_gpu_instancing
prepares mesh data for efficient GPU instancing.GPU instancing allows engines to render many copies of a single mesh at once using a small number of draw calls. Instancing is particularly useful for things like trees, grass, road signs, etc. Keep in mind that predefined batches, as used in this extension, may prevent frustum culling within a batch. Dividing batches into collocated cells may be preferable to using a single large batch.
Properties:
Example
The
EXTMeshGPUInstancing
class provides a single ExtensionProperty type,InstancedMesh
, which may be attached to any Node instance. For example:import { EXTMeshGPUInstancing } from '@gltf-transform/extensions'; // Create standard mesh, node, and scene hierarchy. // ... // Assign positions for each instance. const batchPositions = doc.createAccessor('instance_positions') .setArray(new Float32Array([ 0, 0, 0, 1, 0, 0, 2, 0, 0, ])) .setType(Accessor.Type.VEC3) .setBuffer(buffer); // Assign IDs for each instance. const batchIDs = doc.createAccessor('instance_ids') .setArray(new Uint8Array([0, 1, 2])) .setType(Accessor.Type.SCALAR) .setBuffer(buffer); // Create an Extension attached to the Document. const batchExtension = document.createExtension(EXTMeshGPUInstancing) .setRequired(true); const batch = batchExtension.createInstancedMesh() .setAttribute('TRANSLATION', batchPositions) .setAttribute('_ID', batchIDs); node .setMesh(mesh) .setExtension('EXT_mesh_gpu_instancing', batch);
Standard instance attributes are
TRANSLATION
,ROTATION
, andSCALE
, and support the accessor types allowed by the extension specification. Custom instance attributes are allowed, and should be prefixed with an underscore (_*
).