instancedDynamicBufferAttribute
Provides a performance-optimized data channel for per-instance data that is frequently updated from the CPU (JavaScript).
Core Advantages
Provides a clear 'usage hint' (DynamicDrawUsage) to the graphics driver for better performance when data is updated every frame, while abstracting away low-level details and simplifying code.
Common Uses
CPU-driven physics simulations
Real-time high-frequency data visualization (e.g., audio spectrum)
Direct manipulation via UI interaction (e.g., mouse dragging)
CPU-calculated procedural animations
How to adjust
Visually identical to instancedBufferAttribute, but differs in performance. With a large number of instances or on low-performance devices, it prevents stuttering from high-frequency updates, leading to a smoother animation experience. Its effect is primarily observed as a more stable frame rate.
Code Examples
1// In JS animate() loop:
2// ... loop to calculate and update positionsArray ...
3// Crucial: notify Three.js that data has been updated
4positionAttribute.needsUpdate = true;
5
6// In TSL (Vertex Shader):
7// Apply the per-frame offset calculated on the CPU
8position.addAssign( positionAttribute );