Fast lighting with multple lights

Posted by codymanix on Game Development See other posts from Game Development or by codymanix
Published on 2013-10-18T11:10:31Z Indexed on 2013/10/18 16:15 UTC
Read the original article Hit count: 230

Filed under:
|
|
|
|

How can I implement fast lighting with multiple lights?

I don't want to restrain the player, he can place an unlimited number and possibly overlapping (point) lights into the level.

The problem is that shaders which contain dynamic loops which would be necessary to calculate the lighting tend to be very slow.

I had the idea that if it could be possible at compiletime to compile a shader n times where n is the number of lights. If the number n is known at compiletime, the loops can be unrolled automatically. Is this possible to generate n versions of the same shader with just a different number of lights?

At runtime I could then decide which shader to use for which part of the level.

© Game Development or respective owner

Related posts about XNA

Related posts about shaders