property
Declares a named, typed property in the node graph, which serves as a public interface for passing parameters from JavaScript to the material.
Core Advantages
By automating uniform management, it creates a clean public API for custom materials, allowing developers to intuitively control shaders via `material.propertyName = value` in JavaScript, greatly improving usability.
Common Uses
Building configurable input parameters for custom materials
Creating real-time debuggable shaders
Defining the input interface for reusable shader modules
How to adjust
By modifying the corresponding property value on the material in JavaScript (e.g., `material.glowIntensity = 2.5`), the value output by the property node in the shader is changed in real-time. For instance, changing a property that controls UV scroll speed from 1.0 to 10.0 will instantly make the texture scroll ten times faster, without recompiling the shader.
Code Examples
1// Declare a color property and a float property
2const mainColor = property( 'color', 'mainColor' );
3const glowIntensity = property( 'float', 'glowIntensity' );