arrayBuffer
A node for hard-coding a static, immutable binary data block (from a TypedArray) directly into the shader as a compile-time constant, ensuring maximum performance.
Core Advantages
Its core advantage is providing the highest possible performance by embedding data as a compile-time constant, eliminating all runtime overhead. It also offers convenience by automatically converting a JavaScript `TypedArray` into the necessary GLSL code, avoiding tedious and error-prone manual string formatting.
Common Uses
Fixed color space conversion matrices
High-performance, static lookup tables (LUTs) for effects like tonemapping
Static algorithm resources like permutation tables for noise functions
Hard-coded static geometric data (e.g., SDF sphere parameters)
How to adjust
This node is immutable after creation and cannot be adjusted at runtime. To change its value, you must create a new `arrayBuffer` node with a different `TypedArray` and recompile the material. The effect is a static change in the shader's behavior, for example, switching from a correct color correction matrix to an identity matrix will permanently alter the rendered output's color profile.
Code Examples
1
2// A fixed matrix for color space conversion, hard-coded into the shader
3const srgbToLinearMatrix = arrayBuffer( new Float32Array([
4 2.2, 0.0, 0.0,
5 0.0, 2.2, 0.0,
6 0.0, 0.0, 2.2
7]));
8