velocity
Provides the per-pixel screen-space velocity vector, which is fundamental for advanced post-processing effects like Motion Blur and Temporal Anti-Aliasing (TAA).
Core Advantages
Greatly simplifies the development of advanced dynamic effects. Developers can directly access core motion data automatically calculated by the renderer in TSL, without needing to manually track and compute complex frame-to-frame matrix transformations.
Common Uses
Post-processing Motion Blur
Temporal Anti-Aliasing (TAA)
Debugging and Visualizing Motion
How to adjust
This node has no parameters itself. Its effect is adjusted in two ways: 1. By changing the actual movement speed of objects or the camera in the scene. 2. By applying mathematical operations to its output vector in the shader (e.g., `velocity.mul(2.0)`) to artistically enhance or reduce the sense of motion.
Code Examples
1// The velocity node outputs a vec2 representing the screen-space motion vector
2const motion = velocity.xy;
3
4// Offset and scale the range to [0, 1] for color visualization
5const vizColor = motion.mul(0.5).add(0.5);
6
7// Map horizontal motion (x) to the red channel
8// Map vertical motion (y) to the green channel
9return vec3(vizColor.x, vizColor.y, 0);