We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Hardware

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is per-Pixel Lighting?

By Eugene P.
Updated: May 16, 2024
Views: 7,770
Share

"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.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Discussion Comments
Share
https://www.easytechjunkie.com/what-is-per-pixel-lighting.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.