Skip to main content
GameDev.net gamedev.net
🔒 Locked

per-pixel lighting

Started by _biobrain_ Oct 29, 2004 at 4:48 PM 5 replies 1k views
Original Post
_biobrain_
_biobrain_
Hi guys, I have a question about per-pixel lighting. I'vre read some theory about it, and I saw some demos. My question is: per-pixel lighting is only the work of the normal-map, or I must use with normal map the openGL lights? For example: In my little engine I use the openGL lights (I use it for my volume shadow) in this mode glEnable(Light0) Draw() If I want use per-pixel light, I can do somethings like this? glEnable(Normal-Map) Draw() without using openGL lights? Thanks for the reply :P
Brandlnator
Brandlnator
nope, it is not that easy.

per vertex lighting is a standard opengl feature, per pixel lighting is not. if you want to implement it, you have to do some texturing tricks (at least attenuation mapping and dot product mapping) or write your own pixel shaders (fragment programs). you can use the standard lighting features (for attenuation e.g.) in combination with bump mapping, but you do not have to.

by the way, per pixel lighting and normal mapping is not the same. you can have per pixel lighting without bump mapping. but if you use dot3-bumpmapping, you almost have per pixel lighting and therefore it is quite easy to use it together.

you might find some useful papers concerning both topics at developer.nvidia.com!
_biobrain_
_biobrain_
thanks for the reply!!!
For use a per-pixel attenuation I should use the normalized cube-map, multitexturing...etc?
I saw some code...but I'm studing it!!!Thanks again!!!
snisarenko
snisarenko
To understand some basic concepts about per-pixel lightning read Ron Frazier's articles
http://www.ronfrazier.net/apparition/index.asp?appmain=research/per_pixel_lighting.html


Technically, basic per-pixel lighting can be implemented with just multipass rendering and texture coordiante look up algorithms (without any GPU help). However this will obviously not be very fast if you have complex scenes and multiple lights. Thats why there are extensions that have been implemented in graphics cards that can speed up the process. (Nvidia Texture Combiners for example, dot3 product). Additionally now with pixel shaders per-pixel light looks even better because calculations can actually be done per fragement (pixel) instead of just texture lookups, and also you can even do per-pixel material effects, such as normal maps, and specular maps, etc.
_biobrain_
_biobrain_
This is the same article I've read!!!
If I would a per-pixel light indipendent from the video card, I should use a pixel shader,right?
iNsAn1tY
iNsAn1tY
Quote:
Original post by _biobrain_
This is the same article I've read!!!
If I would a per-pixel light indipendent from the video card, I should use a pixel shader,right?

Yes, but remember that graphics cards vary widely in the features you can expect. To implement per-pixel lighting, you're probably better off using a type of shader language, like NVIDIA's Cg (which is Microsoft's HLSL). Cg works on a wide variety of graphics cards, and abstracts a lot of the complexity of working with different types of graphics cards. You can find a lot of information on basic lighting at NVIDIA's website, and with the Cg runtime, which has a heap of example programs. OpenGL 2.0 will have it's own shader language, GLSL. You can use it now, but you will need a very up-to-date graphics card, as it's not compatible with old hardware (someone correct me if I'm wrong on this; I don't have much experience with GLSL)...
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
_the_phantom_
_the_phantom_
you're correct about GLSL, it requires at least a DX9 class graphics card (ATI R300 and GFFX series of cards)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.