Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

HappyMiel

OpenGL Question about Lights in OpenGL

This topic is 5667 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

Ive got a question about lights in OpenGL. There is a limit of a total of 8 Lights in OpenGL. This seems a very small amount of lights. Aren''t 8 lights too few lights for use in a game, for example. Is this truly the maximum number of lights you can use? Or are there any workarounds for this? Or are 8 lights enough for most scenes in a game, leaving out all lights that do not affect the scene. Thanks in advance. HappyMiel

Share this post


Link to post
Share on other sites
Advertisement
8 lights is definetly not enough for every game/level but given that you can determine which lights will effect your scene at each moment, or at least which ones will be most significant you can render each frame with with the light sources that matter. That way you should be able to do pretty nifty things with 8 light sources at a time and probably wont even need them all (obviously depending on the game/level you are designing).
For scenes with alot of lamp posts or headlights or, or, etc. you'll probably have to make do with bright sprites with no actual light source connected to them ("make do" is maybe not the right phrase since you can do very cool stuff that way too).

Hope this answered some of your questions, or brought up new interesting ones for that matter.

[edited by - skeitaridaudans on February 7, 2003 5:49:41 AM]

Share this post


Link to post
Share on other sites
I thinking. If you use per pixel shading techniques can''t u effectively have infinite number of lights???

I''m not a pro with per pixel shaders but I''ve read a bit about it and it looks like it would replace how lighting is traditionally performed in real-time graphics environments.

Share this post


Link to post
Share on other sites
You can certainly have an infinite number of lights whether you are using per pixel or per vertex shading. OpenGL has decided not to. I''m no pro either but I''d guess it has mostly to do with the way their interface works, with the constants (GL_LIGHT0, GL_LIGHT1, GL_MATERIAL, etc.) used to determine what the variables into the functions are applied to. Besides, if you''re gonna make a per pixel shading engine with tens of simultaneous light sources you''re also gonna have to do a hell of a lot of optimization for anyone to be able to run your game.

Share this post


Link to post
Share on other sites
remember that is 8 lights per triangle (not the whole scene)
in KEA (im using perpixel lighting not gl lights but the principle is the same)
for each mesh i only let the 16 closest/brightest lights affect it all others are ignored

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites

  • 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!