Jump to content
  • Advertisement
Sign in to follow this  
datalurkur

Large number of lights

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

So I'm working on an isometric tile-based RTS, and I'd like to have certain tiles with light sources. Now, I'm aware that the minimum number of light sources GL supports is 8, which is rather low. On the other hand, most tutorials I've read on virtual lighting shift lots of the computation from the GPU to the CPU (software lighting, essentially). I expect most of my light to be at least relatively static - the tiles themselves will be almost constantly lit - but as units pass by light sources, I would prefer they be affected by the lights as well. At this point, I'm looking for some basic suggestions and perhaps some starter code. I'm familiar with GL lighting, but....yeah, 8 just isn't enough.

Share this post


Link to post
Share on other sites
Advertisement
You would have to do light management. In general, 3 lights lighting a single triangle is enough cause if there is more, you won't visually see a difference.

And of course, with shaders and a SM 3 capable GPU, you can have MANY lights.

Share this post


Link to post
Share on other sites
There are methods out there to create more "lights", but most require a pixel-shader and I assume you're not into that.

I have three methods for you:

1 - recycling.
Use the lights seen. Example, your level has 10 light posts, obviously higher than 8. However, your "camera" only shows you 3 ( isometric view ) of the 10. Only use three lights. Then when you're at light "8, 9, and 10; use LIGHT6, LIGHT7, and LIGHT8. In a nutshell, you just re-use what you're currently not using.

2 - billboard images
Create a textured quad that is parallel to the "camera" of your level. There are tons of examples on billboarded images in OpenGL. One you might want to take a look at would be at Lighthouse3D's Billboard Tutorial. ( Google )

3 - both 1 + 2
By using the light recycling mentioned above and the billboarded images, you can pull of a really good illusion for light sources. I'd prefer this method.

I hope I set your on the right track. :]

~Maverick

Share this post


Link to post
Share on other sites
Actually, I would not rule out vertex shaders. Certainly those solutions will be more complex, but I've had some minimal experience with vertex and fragment shaders before, so I'm not entirely new to them.

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!