instancedBufferAttribute
Creates a node in TSL that directly represents an InstancedBufferAttribute from JavaScript, serving as the entry point for per-instance data from the CPU to the GPU.
Core Advantages
Eliminates the risks of manual declarations and name matching by directly associating a JavaScript data array with a TSL node, providing type safety and a unified programming model that greatly simplifies the instanced rendering workflow.
Common Uses
Large-scale static scenes (instance transform matrices)
High-performance particle systems (initial velocity, lifetime)
Data visualization (bar chart height, color)
Procedural material variations (random color, roughness)
How to adjust
Primarily by modifying its referenced TypedArray data in JavaScript, and then you must set `.needsUpdate = true` to push the update to the GPU. For example, interactively changing an instance's scale value in the array will cause the corresponding cube to visually change size in real-time.
Code Examples
1// In JS: Create a node representing instance scale data
2const scaleNode = instancedBufferAttribute( scalesArray, 'vec3' );
3
4// In TSL (Vertex Shader): Use the node to scale vertices
5position.mulAssign( scaleNode );