vectorComponents
vectorComponents
Provides an intuitive, GLSL-like dot notation (e.g., .x, .r) to access and extract a single component from a vector node.
Core Advantages
Greatly enhances code readability and conciseness, providing the foundation for operating on individual vector components for tasks like procedural pattern generation or conditional logic.
Common Uses
Creating procedural gradients
Generating procedural patterns and masks
Implementing conditional logic based on a component
How to adjust
The accessor itself isn't adjustable. To change its output, you must adjust or transform the source vector node it's applied to, e.g., `uv().mul(5).x` first scales the UVs by 5, then extracts the x component.
Code Examples
1// Access the x and y components of the UV coordinates
2const u = uv().x;
3const v = uv().y;
4
5// Use these components to build a new color vector
6const uvDebugColor = vec3( u, v, 0 );