Shader
Also known as: shaders, shader program, GPU shader
A shader is a small program that runs on a graphics card (GPU) to calculate how things look on screen: the colour of each pixel, how light hits a surface, or how a shape moves.
Thousands of copies of a shader run in parallel every frame. While the name suggests they only handle shading, shaders now power nearly everything a GPU does, from water effects to AI calculations.
Shader, explained at three levels
At home
Think of a shader as a recipe card handed to thousands of cooks at once. Each cook gets one tiny dot of your screen and follows the same recipe to decide its colour, using the light, the surface, and the time. Because they all work at the same moment, the whole picture is ready in a fraction of a second. One recipe makes water shimmer; another makes metal shine.
At work
A shader is a small program that runs on the graphics card (GPU) and calculates how something looks: where a shape's corners go, what colour each pixel is, or how light hits a surface. Shaders define a product's visual style, from realistic materials to cartoon outlines. Because they run millions of times per frame, their efficiency decides whether an app or game runs smoothly on target devices.
At home
A frame passes through several kinds of shaders. Vertex shaders move the corners of 3D shapes into position, which is how grass sways in the wind. Pixel shaders, also called fragment shaders, then colour every pixel those shapes cover, using textures and lighting. Compute shaders handle general maths, such as particle physics. In engines like Unity and Unreal, artists can build shaders by wiring nodes together instead of writing code.
At work
Developers write shaders in languages such as HLSL for DirectX, GLSL for OpenGL and Vulkan, MSL for Apple's Metal, or WGSL for WebGPU. The code is compiled to an intermediate form, then the graphics driver compiles it again for the exact GPU. Each combination of material, lighting, and setting can create a separate variant, so large games have tens of thousands. Compiling them during play causes stutter, which is why studios precompile or cache them.
At home
A GPU doesn't run one shader at a time. It groups pixels into batches of 32 or 64 that execute the same instruction together. If an if-statement sends some pixels one way and their neighbours another, the batch has to run both paths while half its workers wait. Memory reads also matter more than arithmetic. While the syntax looks like ordinary code, in my opinion learning to think in parallel is the real hurdle in shader programming.
At work
On PC, shaders are compiled to an intermediate form such as DXIL or SPIR-V, then the driver builds pipeline state objects for each GPU, which is where hitches come from. Permutation explosion is managed by trimming variants, sharing pipeline caches, and precompiling during loading screens. Profilers such as PIX, Nsight, and Radeon GPU Profiler expose costly instructions and memory stalls. Ray tracing adds ray generation, hit, and miss shaders, and machine learning increasingly runs as compute shaders.
Real-world examples
At home
Thomas downloaded a shader pack for a block-building game, and suddenly the water rippled, sunlight streamed through trees, and shadows moved realistically, though his laptop fan worked much harder.
At work
Carlos is a technical artist at a Quebec game studio. Players complained about stuttering, so he set up shader precompilation during loading screens, which removed most of the hitches.
How it compares
| feature | Vertex shader | Pixel shader | Compute shader |
|---|---|---|---|
| Job | Positions 3D points | Colours pixels | General calculations |
| Runs for | Each vertex | Each pixel | Each work item |
| Example effect | Waving grass | Shiny metal | Particle physics |
| Used for AI | No | Rarely | Yes |
Different shader types handle shape, colour, and general GPU work.
For analysts
Shader stutter damages reviews and refund rates for PC games. I'd treat shader compilation as a release requirement, with testing on low-end hardware, rather than a post-launch fix.
History & origin
Pixar's RenderMan introduced a shading language in 1988 for film rendering. Early consumer graphics cards used fixed-function pipelines with limited effects. Nvidia's GeForce 3 in 2001 and DirectX 8 brought programmable vertex and pixel shaders to PCs, followed by high-level languages such as HLSL and GLSL. Unified shader architectures, which let any GPU core run any shader type, arrived around 2006. Compute shaders and frameworks like CUDA then extended GPUs to general calculations, setting the stage for GPUs powering AI. Players know shaders mostly through 'shader compilation stutter,' a common complaint about PC games in the 2020s. In my view, shaders are the reason graphics cards became general-purpose computers.