Lighting the World

With the general shape of the background world in place, I started working on lighting it.  Most modern hardware (according to Irrlicht) supports eight dynamic lights, which just isn’t enough.  So, programmers use lots of tricks to support more than eight lights.  I decided to allow any number of lights, but only turn on eight at a time, based on what is currently being rendered.  For each object in the scene, the distance to each light is calculated.  The eight closest lights are turned on and the others are turned off.  The result is that only eight lights are ever actually “on” at any given time.  The result looks really nice in my test scene, I think.  If this approach doesn’t look right or isn’t fast enough as the scenes get more and more complex, I’ll have to investigate more complicated techniques, like, possibly, deferred lighting.

Leave a Reply

Your email address will not be published.