A shader is a small program the GPU runs many times in parallel. Two kinds matter for most art work.
Vertex shaders
Run once per vertex. Their job is to decide where each vertex ends up on screen — applying the object's transform, the camera, and the projection. They can also move vertices deliberately: wind on foliage, water waves, vertex-animated crowds.
Cost scales with vertex count. This is why polygon budgets exist.
Fragment (pixel) shaders
Run once per pixel covered by the geometry. Their job is to decide the colour of that pixel — sampling textures, evaluating lighting, applying effects.
Cost scales with pixels covered, which is why a large object close to camera is expensive regardless of its triangle count, and why overdraw matters.
Overdraw
When several surfaces cover the same pixel, the fragment shader may run for each. Transparent objects are the usual culprit because they cannot be depth-rejected — a screen full of overlapping particles can run the fragment shader dozens of times per pixel.
This is the single biggest performance difference between opaque and transparent rendering.
What this means for art decisions
- Dense geometry costs vertex shading. Bad on low-end hardware, mostly fine on modern desktop GPUs.
- Large transparent surfaces cost fragment shading, badly, on everything.
- Complex materials cost per pixel, so an expensive shader on a small object is cheap and the same shader on a skybox is not.
- Texture samples are individually cheap and add up; a material sampling twelve textures costs more than one sampling four.
Why materials get instanced
Each unique shader configuration is compiled separately, and switching between them costs. Master materials with parameters exist so a project has a handful of compiled shaders rather than hundreds.