Shader
Related terms: vertex shader, fragment shader, pixel shader, GLSL, HLSL
A small program that runs on the GPU. The vertex shader runs once per vertex and outputs where that vertex lands on screen. The fragment shader (or pixel shader) runs once per covered pixel and outputs its color.
Lighting, water, outlines, dissolve effects: all of it is shader code. Shaders run in parallel for millions of pixels, so each one must be short and self-contained.
// fragment shader: basic lighting float light = max(dot(normal, lightDir), 0.0); color = texture(albedo, uv) * light;
- Further reading
- LearnOpenGL: shaders