negate
negate
Inverts the sign of an input value (a number or a vector), equivalent to multiplying by -1.
Core Advantages
Provides a clear, highly readable, and potentially more performant way to express negation, which is superior to using `mul(-1)`.
Common Uses
Inverting model normal vectors for correct two-sided lighting
Flipping coordinate axes when converting between coordinate systems
Creating symmetrical or opposing motion contrary to a source animation
How to adjust
Adjust the effect by changing its input node. For example, negating a light direction vector will visually move the light source to the opposite position, inverting the scene's highlights and shadows.
Code Examples
1// Create an animation that moves in the exact opposite direction of sin(time)
2const oppositeMovement = negate( sin( time() ) );