Multiple lights in a scene (more than 8). Lights ala Unreal.

What can I do to have more than 8 lights in my scene? Games like Unreal or Quake can have lots of lights at the same time, how?


Either you use pre-rendered light-maps, or just enable the light that affects the current part of the scene you are rendering. Think of a small town with blocks. Lights on one block is not likely to add any light to another block (houses blocking the sight, or whatever). Therefore you enable only the lights affecting the current block.

Or you can do your own lighting engine, which can support as many lights as you want/need.

Games like Quake3 and Unreal Tournament don’t enumerate as many lights as one would think by looking at a scene. There are other techniques to fool the user into seeing bright lights and various light sources, without them actually being a GL_LIGHT0-8. If you have the opportunity, check out some map building tools which allow you to place lights in the scene for a Quake or Unreal map. Try a range of lights, from 1 to 8. Then, make a room with 9 lights. Notice the framerate difference as the 9th light causes the context to fall back to software.

More to the point of your question, try using texturing and sprite effects, as well as blending to achieve your goals within a particular world, and stick to “fire and forget” lighting.

Just my 2 cents.


Hmm, it almost seems like you are suggesting that Quake3 uses GL_LIGHT or some such thing? If this is the case, I think you might be mistaken. I’m pretty sure it’s mostly pre-calculated lightmaps…and then any dynamic lights have lightmaps created and applied on the fly. I could check in the code base, but I’ve never seen such a thing in there yet…probably because having only 8 lights just isn’t flexible enough.

[This message has been edited by El Jefe (edited 11-28-2000).]


Exactly. Lightmaps are used to approximate actual light sources, and avoid the use of actual light definitions.


But quake3 is AFAIK also limited to 8 dynamical lights. And these lights look damn ugly… A pro is, that they don’t need any additional tesselation.

By default, the Quake3 engine is limited to 32 dynamic lights. And I would agree, they are absolutely horrible. I wouldn’t even call them lights, as they only brighten areas that are already lit. In a dark area, the dynamic lights add next to no light to the scene.

[This message has been edited by DFrey (edited 11-28-2000).]

Agreed, but if you look at Elite Force, which uses Quake3, ( at least in single player )…it uses additive blending instead of multiplicative. So, it will actually light up dark areas, but at the cost of washing things out.

Anyway, I’m assuming that Unreal does something a bit more sophisticated because completely dark areas can actually be lit properly. Perhaps it actually does temporary processing to the lightmaps before they are applied? One reason this would be better is that, once you darken a surface completely, there is no way to apply another pass to lighten it back up and regain the inevitable loss of color data you’ll get.

Back to Quake3 lighting though, I’m assuming that it’s done the way it is because it’s probably faster, and with lots of action going on ( in a deathmatch environment ), it’s probably just a lot less noticeable. Also, you are correct, it currently supports up to 32 dynamic lights–probably more than enough for most cases.

[This message has been edited by El Jefe (edited 11-29-2000).]

Changing the lightmaps would be ugly slow, I think. You need to get the value for any texel, and guess how many lightmaps lie in the radius of a dynamic light…

I do wonder though…I thought Unreal had procedural textures which were generated and uploaded on the fly, which is why their water effects look pretty amazing. If that’s true, then creating/altering lightmaps realtime wouldn’t be any slower. It’d be interesting if someone knows exactly how it’s done and is willing to explain it…sigh.

Might be that it isn’t too slow if they are small enough.

UT’s water effects do look nice but i doubt they are generated realtime cause the ripples are the same pattern over and over and over. and when u stand in the water this horrible (like q3) decal splash is blended over the water surface. it sort of destroys the effect

I think I should play games again… Has been a long time, I don’t know the actual state of the art.
Well, gonna play monkey4 when I get out my right knowledge-teeth (OR tooth?).
Well anyway, my father’s keyboard batteries are empty, I think… Gonna go sleepin’

It is VERY posible to change the lightmaps in realtime. It was posible in the days of quake I where everything was on the CPU…
Quake 3 on the other hand changed the way
it handles dynamic lights and traded the lightmap manipulation for an extra rendering pass…