bvec2
Converts a vector (e.g., `vec2`) into a boolean vector (`bvec2`) component-wise, where 0 becomes `false` and any non-zero value becomes `true`.
Core Advantages
Abstracts the low-level, multi-step comparison and construction (e.g., `bvec2(v.x != 0.0, v.y != 0.0)`) into a single, clean node, greatly simplifying the node graph and improving readability.
Common Uses
As a mask for the `mix` function to perform component-wise selection
For logical checks in procedural textures (e.g., checkerboards, stripes)
Visualizing non-zero components of vector data for debugging
How to adjust
The effect of this node is entirely determined by its input node. To change the output boolean pattern, you must change the input vector. For example, you can input a dynamic vector that changes with time (`timerLocal()`) to create an animated mask, or input `uv()` coordinates to generate a static, position-based pattern.
Code Examples
1// Convert a vec2 to a bvec2 (non-zero components become true)
2const condition = someVec2Node.bvec2();
3
4// Use the bvec2 to select component-wise between two vectors
5const result = mix( vecA, vecB, condition );