defaultShaderStages
A CPU-side configuration constant array that specifies which shader programs (e.g., 'vertex', 'fragment', 'compute') a TSL material should generate.
Core Advantages
It defines the final output for TSL's unified node graph and offers excellent extensibility. This allows TSL to be used not only for standard rendering (vertex + fragment) but also as a powerful General-Purpose GPU (GPGPU) tool by switching to the 'compute' stage.
Common Uses
Standard 3D object rendering (uses ['vertex', 'fragment'] by default).
Creating compute shaders for GPU particle systems or physics simulations (uses ['compute']).
Implementing post-processing effects (logic is primarily in the 'fragment' stage).
Performing vertex-only special calculations (theoretically possible with ['vertex']).
How to adjust
Adjusting this array fundamentally changes the GPU's job. For example, switching from `['vertex', 'fragment']` to `['compute']` turns a visible 'painter' material into an invisible 'calculator' for tasks like physics simulation. Removing a stage (e.g., 'vertex') will disable all effects associated with it, such as vertex animations.
Code Examples
1// Create a material that only generates a compute shader
2const computeMaterial = new ComputeNodeMaterial();
3computeMaterial.shaderStages = [ 'compute' ];