label
A pure developer tool that assigns a meaningful variable name to a node's result in the final generated shader code (GLSL/WGSL), dramatically improving its readability and debuggability.
Core Advantages
It makes machine-generated shader code human-readable. By replacing cryptic auto-generated variable names (e.g., `_nodeVar_5`) with clear, developer-defined labels, it creates a direct link between your TSL logic and the final shader, which is essential for efficient debugging, optimization, and learning.
Common Uses
Naming the results of complex calculations to make them easily identifiable in the GLSL code.
Distinguishing between multiple nodes with similar functions, e.g., labeling different noise functions as 'largeWarpNoise' and 'fineDetailNoise'.
Providing clear purpose for Uniforms or Attributes, such as `uniform(0.5).label('metalness')`.
Serving as a code commenting and communication tool in team collaborations to improve code maintainability.
How to adjust
This node has zero visual impact on the final render. Its only effect is on the generated shader code. For example, without a label, the code might be `float _nodeVar_12 = ...;`, but after using `.label('myValue')`, it becomes `float myValue = ...;`, making the code easier to understand and debug.
Code Examples
1const fresnelEffect = pow( dot( viewDirection, normalWorld ).add( 1 ), 5 ).label('fresnelFactor');