noob question

onesvenus

Newcomer
I've taken a very basic opengl course in my University two or three months ago and since then there is something that I can't understand so I thought I'd better ask here with all the amazing people :p
How do you guys have so much lights?? In my course they told us opengl only supports 8 lights but I was looking to the Humus demo (the latest one I think) and I was thinking how I would do some things but then I started to fire and there were lights everywhere.
I suppose that this is because you use pixel/vertex shaders (we didn't touch the shaders :'( ) to calculate the lightning isn't it? If so, how many lights you'd thing could be possible??
Thank you!
 
Lets ignore Pixel/Fragment and Vertex shaders for now and just focus on the standard OpenGL lighting system. When it's said it supports only 8 lights, that means it's supports 8 lights per draw call. Between Draw calls you can change your lighting settings to get as many lights as you need. If you want 9 lights shining on an object, you first draw it with 8 lights on it, then you draw it a second time with an additive blend for the 9th light. Alternatively, since more lights means slower rendering, often what is done is people choose the most important/influential lights that are affecting an object and only use those, rather than multipass the lighting.


As for using shaders it's not all that different. There are only finite resources in shaders so there is still a maximum number of lights you can shade at once. If you want to shade more, you need to multipass. If you are using a complex shadowing system this can get worse since they often mean you can only render a single light at a time, so you need to multipass if you want to have 2 lights!
 
Back
Top