materialLineGapSize
Provides access to the `gapSize` property on the current `LineDashedMaterial`, which represents the length of the empty gaps in a dashed line.
Core Advantages
Completely abstracts underlying Uniform management and seamlessly integrates with the `material.gapSize` property, allowing developers to use the dash gap parameter directly in the TSL node graph in a standard and safe way.
Common Uses
Defining standard dashed or dotted line patterns in tandem with `materialLineDashSize`.
As a base value multiplied by a time node to animate the gap size, creating 'breathing' or 'pulsing' effects.
Animating its value to 0 to create a smooth transition from a dashed to a solid line.
As an input parameter for procedural pattern generation algorithms, like Morse code.
How to adjust
Adjust by modifying the `gapSize` property (a number) of the `LineDashedMaterial` in JavaScript. Increasing the value makes the dashed line sparser; decreasing it makes it denser. Setting it to 0 turns the dashed line into a solid line. In TSL, this node can be multiplied with others (e.g., `noise`) to programmatically alter its effect.
Code Examples
1// In a dashed line shader, vLineDistance is the distance along the line.
2// Discard the fragment if it's in the 'gap' part of the pattern.
3if ( mod( vLineDistance, materialLineDashSize.add( materialLineGapSize ) ).greaterThan( materialLineDashSize ) ) {
4
5 discard;
6
7}