increment
A function node that simulates the post-increment operator (a++). It returns the input variable's current value and then adds 1 to it, fundamental for iterative algorithms.
Core Advantages
Provides an atomic and concise 'get-then-increment' operation, mimicking the familiar `i++` paradigm from other languages. This greatly simplifies code, improves readability, and reduces errors when implementing loops or sequential operations.
Common Uses
Acting as an iterator in custom loops, such as for ray marching.
Generating unique, sequential IDs for each instance in instanced rendering.
Advancing the frame index for sprite sheet or frame-based animations.
Systematically modifying parameters in procedural pattern generation, like incrementally changing a radius or offset.
How to adjust
The node's behavior is fixed. Its visual effect depends on how its returned sequence of values (0, 1, 2...) is used. For example, by triggering `increment` at discrete steps across the screen's UV coordinates and using the return value to set brightness, you can create a pattern of vertical stripes where each is progressively brighter, demonstrating a stepped or quantized visual effect.
Code Examples
1// myCounter is a mutable node, e.g., VarNode(0)
2const currentValue = increment( myCounter );
3
4// At this point, currentValue holds 0, but myCounter's internal value is now 1.