What’s per-pixel lighting?

Print anything with Printful



Per-pixel illumination in computer graphics determines color of objects pixel by pixel, creating a more realistic and defined look. It is implemented through pixel shaders, but may not be practical for dynamic animations. Vertex lighting determines surface appearance at vertices, resulting in gradual lighting across surfaces. Per-pixel lighting provides sharp and accurate lighting, enhancing complex bump mapping and procedural textures, and is necessary for special effects such as shadow volumes and complex light reflections.

“Per-pixel illumination” is a term used in computer graphics to mean that a three-dimensional (3D) scene will determine the color of objects pixel by pixel rather than vertex by vertex. Using per-pixel lighting instead of per-vertex lighting usually creates a finished image or frame that has a more realistic and often sharper and more defined look, especially when bump mapping is used. In general, per-pixel lighting is implemented through the use of pixel shaders which can use different ways to calculate how the light in a scene hits a particular area of ​​the scene and what color the resulting surface should be. In 3D applications where rendering speed is important, such as a dynamic animation, per-pixel shading may not be practical because it can require multiple passes through a scene or it can simply take too long and make it impossible to get an acceptable framerate.

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

Conversely, a program can implement per-pixel lighting. This involves going 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 generally sharp and accurate lighting, especially with specular effects. The trade-off for better image quality is longer rendering time, because each pixel must be processed by a pixel shader, although this isn’t always a problem with 3D modeling, graphics, and rendering programs that don’t have to. maintain a particular framerate.

The dramatic effects of per-pixel lighting, when applied correctly, can actually enhance the appearance of an object that has had complex bump mapping applied to it, and fine detail may be lost with per-vertex lighting. Procedural textures can also benefit from a per-pixel lighting approach. Additionally, special effects such as shadow volumes require the use of per-pixel lighting, as do complex light reflections, particle systems, or even halos in some cases.




Protect your devices with Threat Protection by NordVPN


Skip to content