Intermediate Topic 24 of 49 Graphics, Vision & Media
Shaders
Small GPU programs controlling vertex and pixel processing.
How it works
Shaders are small programs that run on the GPU to control stages of the graphics pipeline. Vertex shaders transform and process each vertex, fragment or pixel shaders compute the color of each pixel, geometry and tessellation shaders create or refine primitives, and compute shaders run general-purpose parallel work. They are written in languages such as GLSL, HLSL, WGSL and Metal Shading Language and compiled by the driver or into intermediate formats such as SPIR-V. Inputs include attributes, uniforms and textures, and outputs flow to later stages.
Where it is used
Lighting and materials, water and fog effects, post-processing such as bloom and blur, skinning animation, particle systems and general GPU computing use shaders.
Common pitfall
Branching and divergence between threads reduce performance, and heavy texture sampling limits bandwidth. Precision differences across devices, such as half precision on mobile, cause artifacts. Shader compile stutter happens when compiled at runtime, so precompile. Debugging is hard; use graphics debuggers and output intermediate values as colors.
Where it fits in the course
Shaders is topic 24 of 49 in Graphics, Vision & Media, rated Intermediate. It follows Texture Mapping. The next topic is Ray Tracing.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Graphics, Vision & Media quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Graphics, Vision & Media quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Shaders?
Where do people use Shaders?
What is the most common mistake with Shaders?
What should I learn before this topic?
How can I practice it?
Is Shaders hard to learn?
How long does it take to learn Shaders?
Which topics are related to Shaders?
What should I study after Shaders?
Related topics
- Texture Mapping (Graphics, Vision & Media)
- Ray Tracing (Graphics, Vision & Media)
- Shading Models (Graphics, Vision & Media)
- Global Illumination (Graphics, Vision & Media)