frameId
Provides an auto-incrementing unsigned integer (frame counter) for each render within a TSL shader, used for implementing discrete, frame-by-frame logic.
Core Advantages
Fully automates the frame counting process, providing a reliable integer in the shader without any manual uniform updates. This makes implementing effects that require precise frame-to-frame state changes (like dithering or stop-motion) simple, performant, and deterministic.
Common Uses
In Temporal Anti-Aliasing (TAA), to switch sampling patterns by checking for odd or even frames.
As a seed for procedural noise to generate a different static pattern each frame, simulating flicker or old-film static.
Creating stop-motion or stepped effects by quantizing time with integer division.
As a conditional trigger for debugging, changing an object's appearance on a specific frame to capture its state.
How to adjust
This node's value is not adjustable; it is an auto-incrementing counter provided by the renderer. Its effect is determined by how you use it to drive logic, especially via modulo (mod) or comparison operations, to trigger discrete, frame-by-frame state changes.
Code Examples
1// Check if the current frame number is even
2const isEvenFrame = equal( mod( frameId, uint(2) ), uint(0) );
3
4// Instantly switch between two colors based on the frame's parity
5outputNode.color = cond( isEvenFrame, color('red'), color('blue') );