materialLineWidth
Provides access to the `linewidth` property on a `LineMaterial`, which defines the visual thickness of a "fat" line.
Core Advantages
Completely encapsulates the underlying implementation of "fat" line width calculation and seamlessly integrates with the `material.linewidth` property, allowing developers to get and control line thickness in TSL in a standard and convenient way.
Common Uses
Drawing lines or outlines thicker than the standard 1 pixel.
Dynamically changing line thickness based on user input (like mouse speed) to simulate brush pressure.
Highlighting selected objects by making their lines thicker.
In data visualization, using line thickness to represent data weight or traffic flow.
As a base value for creating tapered lines in a custom shader.
How to adjust
Adjust by modifying the `linewidth` property (a number) of the `LineMaterial` in JavaScript. Increasing the value makes the line thicker; decreasing it makes it thinner. In TSL, this node can be used as a base value and combined with other nodes (e.g., `timer`) for dynamic effects.
Code Examples
1// In a custom line material, multiply the base width by a dynamic factor
2const blinkFactor = step( 0.5, timerLocal( 10 ).sin().abs() ); // Fast blink
3const finalWidth = materialLineWidth.mul( blinkFactor );
4
5// finalWidth is then used in vertex offset calculations