View Full Version : More than 8 lights
12-22-2005, 04:44 AM
Help me, please!
I need more than 8 lights in my project, but OpenGL can use not more GL_MAX_LIGHTS (=8). :confused:
(Sorry, my English is not well...)
12-22-2005, 05:11 AM
If your lights are properly distributed in the scene (no more than 8 lights affect a single object), you can activate the 8 most important lights per object (or any other subdivision of your scene) before rendering it. Say, for example, you have a scene with a lot of rooms, each room containing one or more lights. As the rooms are separated by walls, the rooms' interior isn't really affected by the lights from any other room. So you don't need to enable the other room's lights while rendering the interior.
If your objects are affected by more than GL_MAX_LIGHTS, you can use a multipass approach. Render the scene with the first 8 lights enabled, then enable the next 8 lights, enable GL_BLEND with glBlendFunc(GL_ONE, GL_ONE), set glDepthFunc(GL_EQUAL) (or GL_LEQUAL), and render the whole scene again. As this approach uses the blend unit, doesn't work too well with semi-transparent objects.
12-22-2005, 06:33 AM
use vertex shaders to simulate opengl vertex lighting so that using more than 8 lights.
but if all of your 8 light is not visible at one scene just change the gllight parameters at runtime, or select the most effective 8 lights and use them in the scene.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.