equal
Performs an 'equal to' (==) comparison between two inputs, A and B. It is a fundamental node for implementing conditional logic and branching in TSL.
Core Advantages
As a cornerstone of logical operations, it provides a declarative, highly readable, and type-safe way to compare different data types, freeing developers from handling underlying GLSL syntax details and enabling the easy construction of complex logic networks.
Common Uses
Generating precise geometric pattern masks, like stripes or checkerboards, by comparing UV coordinates to specific values.
In object picking or highlighting effects, comparing a pixel's ID color to a target ID color to identify and filter the target object.
Creating stepped or quantized effects, like cel-shading, by checking which discrete level a continuous value (e.g., light intensity) falls into.
Determining which animation logic to execute (e.g., idle, walk, attack) based on an incoming animation state variable.
How to adjust
Changing the values of input A or B alters the condition under which the node returns 'true' (typically 1.0 or white). For instance, in the moving scanline example, reducing the multiplier in `timer().mul(5)` will slow down the line's movement, while changing `uv().y` to `uv().x` will make the scanline move horizontally instead of vertically.
Code Examples
1// Creates a scanning line moving vertically
2equal( floor(uv().y.mul(20)), timer().mul(5).floor().mod(20) )