screenUV
In a TSL fragment shader, provides a resolution-independent, normalized screen coordinate that is always in the [0, 1] range.
Core Advantages
Its resolution-independence ensures visual effects appear consistent on any screen, and as the standard coordinate system for post-processing, it greatly simplifies sampling and manipulating the screen texture.
Common Uses
As the standard coordinate for sampling the screen texture in post-processing effects (e.g., blur, color correction).
Generating procedural screen-space patterns like gradients, stripes, or distortion effects.
Visualizing UV coordinates for debugging by outputting them directly as color.
How to adjust
This node itself is not adjustable. Its effect is altered by performing math operations on its output `vec2` coordinate. For example: multiplying by a constant can achieve tiling/zooming; adding a time-based value can create a scrolling effect; and using `oneMinus()` can flip the coordinate system vertically or horizontally.
Code Examples
1// Move the coordinate system's origin from the bottom-left to the center
2const centeredUV = screenUV.sub( 0.5 );
3
4// Calculate the distance from the current pixel to the screen's center
5const dist = length( centeredUV );
6
7// Output this distance as a color, creating a radial gradient from the center (black) outwards
8material.colorNode = color( dist.mul( 2.0 ) );