Archived

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

Per-Pixel lighting

This topic is 5582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can perform per-pixel lighting by overriding OpenGL's standard lighting and by using a cube map texture in order to interpolate vectors instead of interpolating colors.
This method uses the ARB_texture_cube_map and ARB_texture_env_dot3 extensions that are also part of the OpenGL1.3 kernel.

It's not vary hard to implement, but obviously slower than standard OpenGL lighting, even though you can minimize alot of that loss thanks to vertex programs (ARB) and register combiners (NV) or fragment shaders (ATI).


I've got a demo with source code if you want. I can send it to you by email (or to anyone else, of course).

[edited by - vincoof on August 29, 2002 2:05:49 PM]

Share this post


Link to post
Share on other sites
hey Crispy, you must be reading in my mind

The original version is uploaded here (70kbytes).
And the same file without glext.h (for those of you who already have downloaded it from the OpenGL® Extension Registry) is uploaded here (40kbytes).

I still can send it by email to ppl who can't download, of course.

Edit For those of you who can't download from remote sites, try this page.

[edited by - vincoof on August 30, 2002 12:09:58 PM]

Share this post


Link to post
Share on other sites
Thanks, vincoof. A thought just occured to me: as a way to speed up the rendering process, couldn''t per-pixel be replaced by vertex shading if the polys were REALLY small? (giving enough polys so that each is almost as small as a pixel)

Share this post


Link to post
Share on other sites
of course, and that''s what is done in the right tori : they have so many polygons that they look like per-pixel shaded.
The thing is, that eats alot of the vertex bandwidth. You have to make so many calls to glVertex that the pipeline is overloaded and it''s a big performance hit.
The other problem is simply that it''s not possible to increase the polygon count of all models. For procedural models such as spheres, cones and tori it''s very simple to say "I want 100 polygons" or "I want 50% more polygons". But for complex characters such as animals or vehicles, it''s no so easy to say that.

The ideal deal is to have a medium polygon count (accelerated with vertex arrays or display lists) with a medium lighting model (accelerated with multitexturing or register combiners). For a long time, ''medium lighting model'' as been interpreted as Gouraud shading (which is quite good and very fast). Now GPUs can perform per-pixel lighting with decent performance, thus taking over Gouraud sometimes.

Share this post


Link to post
Share on other sites