What it does
A Fragment Shader calculates color and other outputs for fragments produced when geometry is rasterized. It samples textures and evaluates lighting or transparency. A fragment is a candidate surface contribution to the rendered image.
How to use it
The fragment stage uses interpolated UVs, normals and other inputs to compute color and opacity. Overlapping shapes can cause more evaluations than the final screen-pixel count.
A concrete example
Several noise samples on large translucent smoke cards add sampling and blending work even when geometry is simple. Mostly transparent padding can also be processed.
How to check it
- Compare constant color, one texture and the complete shader.
Inspect per-pixel values, thresholds and coverage - Inspect GPU changes with resolution and coverage to separate pixel work from vertex cost.
Inspect per-pixel values, thresholds and coverage
Limitations
Fragment count can exceed final pixels due to overdraw.