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[edit | edit source]
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[edit | edit source]
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. This technology is used by Windows Vista Aero effect.
Programming[edit | edit source]
Pixel shaders use different languages depending on which API the graphics renderer uses. Originally they were written in various forms of assembly language, but as time grew on and shaders became more complex it became clear that a higher-level solution was needed. Popular high-level shader languages include DirectX's HLSL and OpenGL's GLSL, along with Cg, which can compile to both OpenGL and DirectX shader instructions.
Compatibility[edit | edit source]
Hardware[edit | edit source]
This chart describes the maximum supported Shader Model for various graphics processors. GPUs are usually backwards compatible as well.