Archived

This topic is now archived and is closed to further replies.

Leyder Dylan

Per Vertex Lighting or Per Pixel Lighting ?

Recommended Posts

I was asking me if I use the correct word for my lighting demos. In fact, I calcul the attenuation light with the vertices not the pixel. My code is based on this : http://www.ronfrazier.net/apparition/research/per_pixel_lighting.html Is it correct ? Wich word I need to use ? Per Pixel or Per Vertex ? ======================== Leyder Dylan (dylan.leyder@slug-production.be.tf http://www.slug-production.be.tf/

Share this post


Link to post
Share on other sites
This describes how to attenuate the light contribution in the distance on a pixel basis. So, it should be called "Per-Pixel Attenuation".

Explanations

In OpenGL, the lighting stage computes various things and uses them all to produce the final color. These "things" include :
- ambient contribution
- diffuse contribution
- specular contribution
- distance attenuation
- spot cutoff
and maybe others...

In white papers, you have certainly read terms like "Per-Pixel Diffuse", "Per-Pixel Specular", etc.
In fact, when you mean "Per-Pixel Lighting", it means that all of those contributions are performed at the pixel level. In your case, only the distance attenuation is computed on the pixel basis, so the term "Per-Pixel Attenuation" is more appropriate.

With that said, some engines sometimes claim to perform Per-Pixel Lighting without supporting all of the Per-Pixel Stuff listed above. And in that case, they''re not really lying when they mean to support PPL, because with certain conditions you can simplify equations. For instance, if an engine does not provide spot lights, there''s no need to compute "Per-Pixel Cutoff". If the lights never fade in the distance, there''s no need to compute "Per-Pixel Attenuation". If the materials are all mate, there''s no need to compute "Per-Pixel Specular". In general, the very least required for PPL is "Per-Pixel Diffuse" : many engines that claim to support PPL do only support Per-Pixel Diffuse.

Share this post


Link to post
Share on other sites