IT lexicon › Programming › Fragment shader

Fragment shader

Programming På svenska → Updated: 2026-07-31

The program run once per candidate pixel that decides what colour it gets.

After the geometry has been rasterised, the graphics card knows which fragments each triangle covers. For every one the fragment shader is invoked, computing the colour from textures, light sources, normals and whatever else the developer devised. In DirectX the same thing is called a pixel shader.

Scale makes it performance-critical: at 4K that is eight million invocations per frame, more where objects overlap. An expensive computation that is harmless in a vertex shader becomes ruinous here. It is also where nearly all visual richness lives — shadows, reflections, fog and every post-processing effect is written as a fragment shader.

← Back to the lexicon