vec3
vec3 is the most central node in 3D graphics, used to create and represent a vector of three floating-point numbers. It's the foundation for defining 3D spatial data like object positions, directions, and normals, as well as the standard way to define RGB colors.
Core Advantages
Serves as the universal representation for 3D data and colors. vec3 provides a standardized data container for nearly all 3D math operations (like vertex transformations) and color processing (like blending and grading), making it the cornerstone for building any complex shader effect.
Common Uses
Defining Colors
Vertex Displacement & Deformation
Lighting Calculations
How to adjust
Adjusting the constructor arguments of a `vec3` directly changes its three component values. The final effect is determined by its usage. For instance, when a `vec3` is used as a color, changing it from `vec3(1, 0, 0)` to `vec3(0, 1, 0)` will change the object's color from pure red to pure green.
Code Examples
1// Used as an RGB color
2const red = vec3( 1.0, 0.0, 0.0 );
3
4// Combine a vec2 and a float to construct a 3D vector
5const position = vec3( xyCoords_node, zHeight_node );