Pixel shader

From Codex Gamicus
Jump to: navigation, search

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.

PS version Direct3D version OpenGL version 3DLabs ATI Intel Matrox NVIDIA S3 Graphics SiS XGI
1.0/1.1 8.0 2.0 GeForce 3 series Xabre-Series
1.2 8.0a 2.1 Wildcat VP
1.3 8.0a Parhelia series GeForce 4 Ti / 4200Go series Mirage 2
1.4 8.1 Radeon R200 (8500–9250) Volari V3 series (except V3XT)
2.0 9.0 Wildcat Realizm Radeon R300 (9500–9800, X300–X600), X1200–X1250 Intel GMA 900, 950, 3000, 3100 DeltaChrome, GammaChrome, Chrome S2x series Mirage 3, Mirage 3+ Volari V3XT, Volari V5 series, Volari V8 series, Volari 8300, Volari XP10
2.0a 9.0a GeForce FX series
2.0b 9.0b Radeon R420 (X700–X850)
3.0 9.0c Radeon R520 (X1300–X1950) Intel GMA X3000 G965 GeForce 6 series, GeForce 7 series
4.0 10 3.3 Radeon R600 (HD 2400 – HD 2900) Intel GMA X3100, X3500 GeForce 8 series, GeForce 9 Series, Quadro FX 1700, GeForce 200 Series (G92 and G200 chip), GeForce 300 Series (GT330) Mirage 4
4.1 10.1 3.3 Radeon R600 (HD 3xxx), Radeon R700 (HD 4xxx) Intel GMA 500 GeForce 200 Series (GT215/GT216/GT218 chips), GeForce 300 Series (Except GT330) Chrome 400 Series
5.0 11 4.1 Radeon R800 (HD 5xxx) GeForce 400 Series

See also[edit | edit source]

References[edit | edit source]