Jump to content
  • Advertisement
Sign in to follow this  
deepthought

OpenGL more than 8 lights in opengl

This topic is 2655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

what is the best way to have more than 8 lights in opengl without shaders? lightmapping? vertex lighting with a color array? using the built in lights over and over again? would shadow mapping be compatible with these?

:)thanks :)

Share this post


Link to post
Share on other sites
Advertisement
I'd probably just go with custom shaders, the built in lights are deprecated anyway. You can do whatever you want inside a shader.

Though I'm hard pressed to imagine a situation where you really need more than 8 emitting lights, seems like that's going to kill your performance.

Share this post


Link to post
Share on other sites
1. of course i'm going to cull off lights that don't affect anything in the viewport, but there might still be more than 8 lights.

2. i'm trying to make the engine compatible with older cards. but, however, i plan to make a more advanced version using shaders for lighting.

3. I've just realized that with lightmapping, i can also make projectors.

Share this post


Link to post
Share on other sites
If you want them to be dynamic, then the only option is to use some form of scene graph (Kd based etc) that determines the proximity of the lights to the objects being rendered. Pick the closest 8, and render that object.

Ideally though, if you can avoid the additional overhead of the lights (by baking lighting down to lightmaps) then that is preferable...

Share this post


Link to post
Share on other sites
seperate the lights into groups of 8, draw the objects with the first 8 the usual way, draw all additional passes with blending set to additive (that means, blend func "add" and "ONE" for destination and source).

Share this post


Link to post
Share on other sites
You should probably look at deffered rendering and Light pre-pass rendering if you are going to have 8 or more active lights in your scene.

Share this post


Link to post
Share on other sites

Though I'm hard pressed to imagine a situation where you really need more than 8 emitting lights, seems like that's going to kill your performance.


Minecraft

Share this post


Link to post
Share on other sites
I've been experimenting with the idea of not only sorting the N closest lights to an object, but also coalescing some of the more distant lights together. What does this mean? Suppose there are many lights in a room. For a given object, cluster the lights in the room into the 8 'most important' directions, and then render with that. For instance, if a red light and a green light are within a certain angle threshold from the point-of-view of the object being lit, do a weighted average of these two lights into a yellow light in a direction somewhere between where the green and red lights were. What advantage does this have? You can have many lights acting on an object, only need 1 render pass and suppose you move any 1 light, the lighting intensity/angle seen on the object itself will change.




What's the disadvantage? I don't quite have it working properly yet :) (lights 'popping') Maybe someone can a)take this idea and run with it, b)suggest whats wrong or c) tell my why it will never work :)

Share this post


Link to post
Share on other sites
Ideally though, if you can avoid the additional overhead of the lights (by baking lighting down to lightmaps) then that is preferable...[/quote]




that's what i'll do

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!