glsl
Allows for the seamless embedding and execution of native GLSL code snippets within the TSL node graph, providing ultimate flexibility and extensibility.
Core Advantages
Its core advantage is the ability to seamlessly integrate other TSL nodes as inputs, easily reuse existing GLSL code libraries (like those from Shadertoy), and act as an 'escape hatch' for the TSL system, ensuring developers can always implement any complex logic with native GLSL when existing nodes are insufficient.
Common Uses
Implementing custom noise functions (e.g., Worley noise)
Integrating existing color correction or image filtering algorithms
Writing complex procedural geometric patterns or fractals
Calling specific built-in GLSL functions not yet wrapped by TSL
How to adjust
Adjusted in two main ways: 1. Directly modify the GLSL code string in its `src` parameter to fundamentally change its logic. 2. Change the TSL nodes connected to its inputs (e.g., `${intensity}`). For instance, replacing a fixed `uniform(2.0)` input with a time-varying `timerLocal()` can turn a static effect into a dynamic one.
Code Examples
1// Define inputs using template literals and return the processed color
2const myEffect = glsl( 'return ${color}.rgb * ${intensity};' );
3
4// Connect other TSL nodes as inputs via the .inputs property
5myEffect.inputs.color = texture( map );
6myEffect.inputs.intensity = uniform( 2.0 );