materialLineDashSize
Provides access to the `dashSize` property on the current `LineDashedMaterial`, which represents the length of the solid segments in a dashed line.
Core Advantages
Completely abstracts underlying Uniform management and seamlessly integrates with the `material.dashSize` property, allowing developers to use the dash length parameter directly in the TSL node graph in a standard and safe way.
Common Uses
As a core parameter in a dashed line shader to calculate fragment visibility.
As a base value multiplied by a time node to animate the dash length, creating 'growing' or 'shrinking' effects.
Dynamically adjusting based on camera distance to implement Level of Detail (LOD) for dashed lines.
As an input parameter for procedural pattern generation algorithms, like Morse code.
How to adjust
Adjust by modifying the `dashSize` property (a number) of the `LineDashedMaterial` in JavaScript. Increasing the value makes the solid segments of the dash longer; decreasing it makes them shorter. In TSL, this node can be multiplied with others (e.g., `timer`) to programmatically alter its effect.
Code Examples
1// In a dashed line shader, vLineDistance is the distance along the line.
2// Render the fragment if it's in the 'dash' part of the pattern.
3if ( mod( vLineDistance, materialLineDashSize.add( materialLineGapSize ) ).lessThan( materialLineDashSize ) ) {
4
5 // ... render fragment
6
7}