In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as shading. Shaders have evolved to perform a variety of specialized functions in computer graphics special effects and video post-processing, as well as general-purpose computing on graphics processing units.
Traditional shaders calculate rendering effects on graphics hardware with a high degree of flexibility. Most shaders are coded for (and run on) a graphics processing unit (GPU), though this is not a strict requirement. Shading languages are used to program the GPU's rendering pipeline, which has mostly superseded the fixed-function pipeline of the past that only allowed for common geometry transforming and pixel-shading functions; with shaders, customized effects can be used. The position and color (hue, saturation, brightness, and contrast) of all pixels, vertices, and/or textures used to construct a final rendered image can be altered using algorithms defined in a shader, and can be modified by external variables or textures introduced by the computer program calling the shader.
Shaders are used widely in cinema , , and video games to produce a range of effects. Beyond simple lighting models, more complex uses of shaders include: altering the hue, saturation, brightness (HSL/HSV) or contrast of an image; producing blur, light bloom, volumetric lighting, normal mapping (for depth effects), bokeh, cel shading, posterization, bump mapping, distortion, chroma keying (for so-called "bluescreen/greenscreen" effects), edge and motion detection, as well as psychedelic effects such as those seen in the demoscene.
This use of the term "shader" was introduced to the public by Pixar with version 3.0 of their RenderMan Interface Specification, originally published in May 1988.
As graphics processing units evolved, major graphics software libraries such as OpenGL and Direct3D began to support shaders.