PDA

View Full Version : GL_LIGHT999



TS++
05-28-2003, 04:47 AM
Hello everyone!

Just one probably absurd question:
Every OpenGL-beginner knows that there are obviously maximal 8 standard light sources, provided by OpenGL. To my mind using one or more of these light sources isn't too difficult!

But, and now the question, what would i have to do if i liked to use more than these 8 standard light sources. Well, i just can't believe this should be impossible. But unfortunately up to now i am not an expert in OpenGL!
So, would you, as the real experts, be so kind and help me?
What do i have to do? Where can i get more Info?

Thank you very much!

Greetings,
TS++

Relic
05-28-2003, 05:29 AM
First, 8 is the minimum which must be supported, there are implementations with more (like 24).
For a software implementation it's pretty simple, just increase your arrays and bitfields holding all the light's state and loop over all those lights (that is, it should be pretty simple to change MESA to support almost arbitrary numbers of lights.
Hardware doesn't have the luxury of adjustable state arrays, they have to live with the numbers of transistors which are on the chip.
On the other hand, programmable vertex pipes with subroutines and loops are about to solve this.

PS: Other than that, the current way to use more lights is to render multipass, or use only those 8 lights which contribute most to the nearby geometry dynamically. (There's a demo about this floating around.), or encode lights in cubemaps in a preprocessing step.

[This message has been edited by Relic (edited 05-28-2003).]

TS++
05-28-2003, 06:59 AM
@Relic:
Thank you for your help!

There's just one more thing i'd like to know:
Concerning the topic 'multiple lighting' i have often read the words 'projective texturing'. Would it be more advantageous to use this technic?
What do you think?

Thanks,
TS++

Relic
05-28-2003, 07:47 AM
Pretty general question. Depends on how your lights are arranged and if they are static or dynamic.
Look at the famous cube maps of the Palo Alto bar interior (Anybody knows that place? I'd like to visit it sometime. ;-)) http://developer.nvidia.com/view.asp?IO=IO_20010830_4778
to see how a lit environment can be projected on your geometry with texturing. Doing this cleverly will sometimes allow to have unlimited numbers of lights emulated with one cubemap.
Do a seach on "projective texture" while you're on that site for projection of 2D textures.

If you have textured geometry, these methods use multitexturing. Currently there are not more texture units available than hardware accelerated lights, so you might end up with multpass algorithms again.

05-31-2003, 09:35 PM
You can have 8 different lights affecting every polygon if you want. This is 8 million lights for a million polygon scene, is that enough? If you need more then 8 lights on a triangle, you are probably more concerned with look then speed so should just do all the lighting calculations yourself.