pointWidth
In a TSL vertex shader, programmatically sets the screen-space pixel size for each point in a `Points` object, abstracting the underlying `gl_PointSize`.
Core Advantages
It abstracts the low-level `gl_PointSize` setting and seamlessly integrates with the node system. This allows point size to be dynamically driven by any float node (e.g., distance, noise), enabling complex, per-point visual effects with ease.
Common Uses
In particle systems, to dynamically change particle size based on lifetime or velocity.
In data visualization, to use point size to represent a fourth data dimension (e.g., population, temperature).
Implementing Level of Detail (LOD) based on camera distance to enhance depth or ensure visibility.
How to adjust
Adjust by assigning different TSL nodes to the material's `pointWidth` property. You can assign a static float (e.g., `10.0`) for a uniform size, connect a network of `distance` and `remap` nodes for distance-based LOD, or link a `noise` node to create random, organic size variations.
Code Examples
1// Use a noise function to generate a random size for each point
2// Base size is 5px, with a random variation of 10px
3const randomSize = add(5.0, mul(noise(positionWorld.mul(2.0)), 10.0));
4
5// Assign this result to the material's pointWidth property