Pixel shader
A pixel shader is a type of shader program, often executed on a graphics processing unit. These programs are typically used to perform complex per-pixel effects. Microsoft's Direct3D and Silicon Graphics' OpenGL support shaders. (Note: In OpenGL parlance a pixel is called a fragment, so OpenGL calls these fragment shaders).
Function
A pixel shader is a computation kernel function that computes color and other attributes of each pixel. Pixel shaders range from always outputting the same color, to applying a lighting value, to doing bump mapping, shadows, specular highlights, translucency and other phenomena. They can alter the depth of the pixel (for Z-buffering), or output more than one color if multiple render targets are active. A pixel shader alone cannot produce very complex effects, because it operates only on a single pixel, without knowledge of a scene's geometry.
History
The term "Shader" originated with Pixar's RenderMan - a program that takes an entire description of a scene including camera positions, object geometry and renders the final output. RenderMan was introduced in 1989, but it wasn't until the 1995 release of Pixar's movie "Toy Story" that the general public was introduced to the power of RenderMan. Such computer-generated imagery (CGI) became more and more popular in movies and television.
Consumer-level computer graphics hardware was also evolving rapidly and new features were implemented on "commodity" boards that rivaled expensive dedicated graphics workstations. The video game industry began to utilize newly-created powerful-yet-cheap 3D graphics hardware in PCs and game consoles. Light maps in particular were soon finding their way into games, followed by bump maps and procedural vertex generation. The continuing desire for more complex visual effects pushed the computing industry forward and previously fixed-function graphics processors received ever more programmable designs as manufacturing technology progressed. These more programmable GPUs allowed more complex effects, including pixel and vertex shader programs.
Programming
Pixel shaders use different languages depending on which API they use. Popular APIs include DirectX and OpenGL.
Compatibility
Hardware
This chart describes the maximum supported Shader Model for various graphics processors. GPUs are usually backwards compatible as well.
See also
References
- OpenGL Shading Language – Documentation of Shader in OpenGL
- GLSL Tutorial (engl.)
- OpenGL Shading Language examples
- Fundamentals of Pixel Shaders at Gamedev.net