Game Development Community

Too many Lights

by Howard Dortch · in Torque Game Engine · 11/28/2005 (5:45 am) · 12 replies

I have an interior with about 20 universal static lights and 8 volume lights and one of my computers (ati 9600) gives me an error message in the log file :

LightManager::setMaxGLLights: too many lights!

Any clue why this would happen?

#1
11/28/2005 (7:35 am)
Have you fiddled around with the global in prefs.cs, possibly?
#2
11/28/2005 (8:12 am)
It sounds like you set the maximum number of hardware lights to > 8. Setting it back will get rid of the error.

All video cards only support 8 lights, it was a standard imposed (more or less) by OpenGL, and even today the latest cards only support 8 (even workstation cards, which I find slightly odd), so 8 is a great max value - lower values are really good for higher performance on older cards.
#3
11/28/2005 (8:30 am)
You mean this?
$pref::OpenGL::maxHardwareLights = "3";
#4
11/28/2005 (1:31 pm)
Hi Howard, that's the one. To make sure you changed the right prefs file open Torque enter in the console:

$pref::OpenGL::maxHardwareLights = "3";

(or whatever value you want)

and exit out of Torque (this resaves the prefs files).
#5
11/28/2005 (1:45 pm)
It was set to 3 in all instances (find in files) for the whole project.
/ponder
#6
11/30/2005 (11:00 am)
That's odd, try setting a break point in LightManager::setMaxGLLights to see what the requested and max values are. I can't imagine that your video driver is only supplying 2 lights, even the TGE dx wrapper supplies 8.
#7
11/30/2005 (11:31 am)
Yeah I agree. I would think it's isolated incident but had 2 testers report the same thing with XP systems. All the DTS objects are black. Wierd part is once they log out of the game and back in it's ok after that. .../ponder
#8
11/30/2005 (1:13 pm)
What are their specs?
#9
11/30/2005 (1:45 pm)
One was 2.4 ghz Intel, GF-3 64meg and the other was FX53 AMD, ATI 9600 128 meg both XP Pro

No common thread there except for XP pop up on the firewall blocker. Im looking into that popup getting focus but it shouldn't muck with Open GL
#10
12/02/2005 (4:04 pm)
That's very odd, try adding custom code in that method to capture the returned value when it errors out. I'm just curious what's the value is. Also try calling glGetError to see if something bad happened.
#11
12/20/2005 (11:44 am)
The eight light limit is that for the whole scene or only the maximum that can be drawn in the viewing frustrum?

EG: If I have a long corridor with 20 lights along it, the lights at the far end will not be lit, but as I move down the corridor the the lights will 'switch on' the keep the maximum of eight lights....

If this is incorrect I think I'm going to have to re-think my lightmapping and level design a bit.
#12
12/21/2005 (6:55 am)
I don't know how the lighting kit does it, but typically that is not the way it works.
It's quite all right to have 20 lights in your level, and all the shadows (etc) will still work, because those come from lightmaps. The 8 light limit is for how many lights can be affecting a single object (such as a dts object) at one time. Typically, the closest 8 lights (or the strongest, or whatever) lights are gathered, and used to determine lighting on the object, and the rest are just discarded. If you think about it, having more than 8 lights shading a single object seems kind of like overkill anyway.

I believe the original posters are seeing a bug that results from the window being switched out by the Windows Firewall. To get around this, they can always do the initial startup in windowed mode (and then switch to full screen after the communication layer is up)