Pixel shader
Pixel shaders (also called pixel shaders , fragment shaders , abbr. PS ) are programs that are executed by the graphics processor of a 3D graphics card in the course of the graphics pipeline (in what are known as shader units ).
function
Pixel shaders are used to change the fragments to be rendered, for example to achieve a more realistic representation of surface and material properties or to change the texture representation . The pixels of the final image may result from several fragments, for example when several objects can be seen at the same time due to transparency. The shaders process these objects independently of each other, so the term fragment shader is actually the correct name, but the term pixel shader has become established in the Direct3D environment; in OpenGL, fragment shaders are correctly used.
Pixel shaders differ from vertex shaders , which change the vertices (corner points of three-dimensional objects) in order to manipulate the shape or position of the 3D objects. Examples of the use of pixel shaders are phong shading , reflections , shading , falloff , blooming and lens flares ; and HDR rendering is programmed with their help (using frame buffers that are more than 8 bits per subpixel support).
Since the shader units that execute the pixel shaders are part of the GPU , these programs do not have to run on the system's CPU , which relieves the load and can be used for other tasks. As a rule, several shader units are built into GPUs so that they do not become a bottleneck in the graphics pipeline.
Additional information on the processing chain and the programming of shaders can be found in the article Shader .
compatibility
hardware
The following table gives an overview of which graphics cards or processors with which DirectX version support which pixel shader version. It should be noted here that graphics processors usually also support older versions, for example pixel shader 3.0 processors can also work with version 2.0 pixel shaders (which is less due to the graphics processor than the graphics card driver).
software
Because the range of functions and the programmability can vary greatly depending on the shader version, a developer is basically faced with the choice:
- support many pixel shader versions by choosing the common denominator, version 1.0. All graphics cards are supported that have this minimum level of pixel shader capability. This option is rarely chosen because many effects can only be used efficiently from certain versions.
- to support many pixel shader versions by writing its own, optimized shader for each version to be supported (so-called render paths ). All graphics cards that are compatible with the targeted versions are supported. A prominent example of this is Far Cry (released in 2004, support since 2005).
- only support pixel shader versions from a certain version. Examples are Europa Universalis III from Paradox Interactive or Virtua Tennis 3 from Sega (requires Pixel-Shader 2.0) and Splinter Cell: Double Agent from Ubisoft (requires 3.0).
See also
Web links
- OpenGL Shading Language - Documentation for programming shaders in OpenGL
- OGSL Tutorial (English)
- ZFX Graphics Series - Another tutorial on adding shaders to a DX application
- Shader Concept - Article introducing various shader techniques