and
Performs a logical AND operation, returning true if and only if all input conditions are true. Used to combine multiple independent judgments.
Core Advantages
Combines multiple logical conditions in a flat, natural-language-like way, greatly improving the readability of complex logic. Its support for multiple (variadic) arguments simplifies the construction of long conditional chains.
Common Uses
Combining geometric and pattern-based masks, e.g., applying an effect only to noisy areas on the lower half of an object.
Creating the intersection of procedural patterns, such as generating a grid by combining vertical and horizontal stripes.
Triggering effects based on multiple game states, like 'isPoisoned' AND 'timerIsActive'.
Building custom lighting models, where an object is lit only when hit by multiple specific light directions simultaneously.
How to adjust
Adjust by changing any of its boolean inputs. In the rusty ball example, the `and` node acts as a gatekeeper; a pixel is colored as rust only if it satisfies both 'is in the lower hemisphere' AND 'is a rust patch'. Changing either condition (e.g., animating the noise) affects the outcome, but the result is always confined to the intersection of all conditions.
Code Examples
1// Condition A: Lower half of the object
2const isLowerHalf = position.y.lessThan( 0.0 );
3// Condition B: Patches defined by noise
4const isRustyPatch = noise( position.mul(10) ).greaterThan( 0.7 );
5
6// Combine the conditions to get the final mask
7const rustMask = and( isLowerHalf, isRustyPatch );