box2dlights
box2dlights copied to clipboard
using multiple light layers
Hi, I think it could be a greate thing to be able to use multiple rayHandler (one per layer). The main loop could be like this:
// render layer 0 (background)
map.render(0);
rayHandler1.updateAndRender();
// render layer 1 (front)
map.render(1);
rayHandler2.updateAndRender();
To achieve this, I think that the light/shadow shader may be disabled when the alpha chanel of a pixel is equal to 0, this way, the shadow of the front layer wont be casted to the back layer anymore.
for an example, see towerfall ascension game, they make use of 2 light layers (the background is not affected by the light on the foreground).
http://www.gamesaktuell.de/screenshots/original/2013/11/towerfall_ascension_2-pc-games.JPG
This would be awesome, there are some major issues handling lights plus viewports. My game has multiple viewports and I can't sort this out.
Currently this might be achieved using rendering to FBO, which should work fine. Custom viewports are also supported (in wiki there is some info about viewports).