alphaT
Creates a float parameter "channel" named `AlphaT` in the TSL shader, allowing you to directly and dynamically pass a numerical value from JavaScript to the GPU via `material.alphaT = value`.
Core Advantages
Provides an extremely simple `material.propertyName = value` API, completely hiding the complexity of manually declaring and updating `uniforms` found in traditional ShaderMaterial, making external parameter control intuitive and easy.
Common Uses
Controlling the alpha test threshold for cutout or clipping effects.
Driving the progress of custom animations (e.g., dissolve, burn).
Exposing material parameters in a UI for real-time user adjustment.
Acting as a shader debugging switch to display intermediate calculation results.
How to adjust
Modify the `material.alphaT` value in JavaScript. For an alpha test, increasing the `alphaT` value (e.g., to 0.8) will discard more semi-transparent areas, making the object appear more "eroded". Decreasing the value (e.g., to 0.1) will preserve more areas, making the object's silhouette more "solid".
Code Examples
1// Discard fragment based on the alphaT threshold
2opacity = step( alphaT, texture.a );