In computer graphics, shading is the rendering of photorealistic or stylized surfaces on a mathematically-defined object. Software written specifically for this purpose, called a shader, is executed by the CPU or GPU to compute the color and brightness of each pixel in the final image. The benefit of a shader is that detail can be defined procedurally, rather than geometrically. This procedural approach can enhance the photorealism of the final image, and increase efficiency of the modeling and rendering process.
Shaders take many factors into consideration, including the lights and camera, to create the illusion of depth and texture on an object. In the example pictured here, the surfaces of an rectangular solid appear shiny, and indicate the position of an unseen light source. The shader creates the illusion of three-dimensionality by computing each pixel's brightness. This type of shader is called a pixel shader.