Lighting in OpenGl....

OpenGl have a fixed number of lights, usualy 8. How I can make more then 8? How this problem deciding in difrent games (quake2 or 3 for example)?

Originally posted by swap:
OpenGl have a fixed number of lights, usualy 8. How I can make more then 8? How this problem deciding in difrent games (quake2 or 3 for example)?

i think you can only increase it by making your own OpenGL implementation

as i know quake and other 3d games dont use opengl lighting. instead they calculate lighting for static geometry (level) while building the level (the task that takes tiiimmeee)using lightmaps.
i’m not sure if Unreal engine uses OpenGL lighting. for example if you look at a dispersion pistols shoot flying you recognize a lightmap floating on all surrounding walls.
but i get confused how they calc (un UT) the dynamic lighting for your 1.perosn weapon model?
does anyone else knows something new (or correct)?

OpenGL only HAS to support 8 lights. Vendors may support more.

If you go to nvidia’s web site->developer relations->demos->lights demo you will see a program that uses 300 hardware accelerated opengl lights. There is also a demo gf3 vertex program with like 17 lights.

You can also do tricks - probably all lights will not be hitting all polygons - when you draw each polygon, only enable the lights that are hitting it (up to 8 per polygon if you want to stick to OGL spec, but you COULD have thousands of different lights per scene this way, so long as their extent was very limited). There’s also the lightmap trick as described above.

– Zeno

You should never really have more than about 4 lights on at any particular point anyway as it slows things down too much.

You simulate light by giving materials emissive properties. A human won’t really be able to tell the difference between a scene lit by 4 lights and one lit by 8 lights except for the specular highlights.

You also move existing lights when you change rooms etc. so that there are never any more than 8 lights. This way even if you’ve got 2000 lighting points on a level; you just take the light that’s currently making the least effect on your scene and move it instantaneously to the new location that you think will need to be lit now. If you have more then not only will the program run slower but you’ll find it very hard to manage your code.

Stephen