buffer
Accesses any custom per-vertex data (BufferAttribute) attached to a geometry within TSL, a key node for creating data-driven rendering effects.
Core Advantages
Fully automates the underlying GLSL attribute and varying declarations, allowing developers to seamlessly use any custom vertex data within the TSL node-based workflow, greatly enhancing material extensibility and data-driven capabilities.
Common Uses
Instanced Rendering (reading instance color/matrix)
Procedural Animation (e.g., wind-blown grass)
Data Visualization (e.g., heatmaps)
Pre-baked Lighting/AO (reading vertex colors)
How to adjust
Adjustments are primarily made by modifying the referenced BufferAttribute's array data in JavaScript and setting `.needsUpdate = true`. For example, changing the data in a 'customColor' attribute will directly update the corresponding vertex colors on the model, enabling dynamic, data-driven visual changes.
Code Examples
1// Get the per-vertex color data named 'customColor'
2const vtxColor = buffer( 'customColor', 'color' );
3
4// Directly use this color as the material's final color
5// TSL automatically handles passing it from vertex to fragment shader
6material.colorNode = vtxColor;