reference
Creates a dynamic link in the node graph to reference and read the value of an existing property on a JavaScript object (e.g., a material).
Core Advantages
By automatically synchronizing JavaScript property values to the GPU, it greatly simplifies creating interactive and configurable materials, serving as the core bridge between dynamic JS data and the shader.
Common Uses
Creating JS-controllable properties for custom materials
Driving shader animations (e.g., dissolve, vertex displacement)
Using mesh or scene data for data visualization
How to adjust
By continuously modifying the property value referenced by `reference` in a JavaScript animation loop (e.g., `material.dissolveLevel = value`), you can smoothly change the shader's visual effect in real-time, for instance, to implement a periodic dissolve animation.
Code Examples
1// Links the 'myColor' JS property on the material to the shader
2material.colorNode = reference( 'myColor', 'color' );