What Is per-Pixel Lighting?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 09 August 2019
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Expected to open in Manhattan's Lower East Side in 2021, the Lowline will be the world's first underground park.  more...

August 25 ,  1944 :  Paris was liberated from Nazi occupation.  more...

"Per-pixel lighting" is a term used in computer graphics to indicate that a three-dimensional (3D) scene will determine the color of objects on a pixel-by-pixel basis instead of on a vertex-by-vertex basis. The use of per-pixel lighting instead of per-vertex lighting usually creates a finished image or frame that has a more realistic and often sharper, more defined appearance, especially when bump mapping is being employed. In general, per-pixel lighting is implemented through the use of pixel shaders that can use a number of ways to calculate how the light in a scene is hitting a particular area of the scene, and what color the resulting surface should be. In 3D applications in which the speed of rendering is important, such as a dynamic animation, per-pixel shading might not be practical because it can require multiple passes through a scene or can simply take too long and make an acceptable framerate impossible to achieve.


One of the more common forms of applying light to a 3D scene is to use a method known as per-vertex lighting. This technique takes the vertices of an object — the points where the lines of an object meet — and determines what the surface of an object should look like at that single location. When all the vertices in a scene have lighting information attached, the renderer will use interpolation or other types of algorithms to estimate the appearance of the surface of the object between the vertices. This generally results in areas that are reliant on a high density of vertices in an object to attain sharp lighting effects, such as a phong highlight, while a shape such as a cube with only six vertices will have broad, gradated lighting across the surfaces, regardless of the texture or lighting position.

In contrast, a program can implement per-pixel lighting. This involves passing through each of the pixels in a rasterized scene and determining the individual color and lighting for each pixel, regardless of its proximity to a vertex. The results are usually sharp, accurate lighting, especially with specular effects. The tradeoff for better image quality is a longer rendering time, because each pixel must be processed by a pixel shader, although this is not always a concern with 3D modeling and graphics and rendering programs that do not have to maintain a particular framerate.

The dramatic effects of per-pixel lighting when properly applied can actually enhance the appearance of an object that has intricate bump mapping applied and the minute details might be lost with per-vertex lighting. Procedural textures also can benefit from a per-pixel lighting approach. Additionally, special effects such as shadow volumes require the use of per-pixel lighting, as do complex lighting reflections, particle systems or even halos in some instances.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?