Introduction
You can find the pixi-lights plugin on github.
Some of you may be aware that I recently did an experiment with Pixi.js to see if I could write efficient normal-mapped
lighting. Well I had no idea where to start, how to do lighting, or what the best way to do it would be. So, I did a
bunch of research on how drawing normal-mapped lighting works, and came up with a way to get it drawing correctly using
this tutorial (thanks Matt DesLauriers):
https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6#IlluminationModel
It was pretty dirty. Basically I wrote a filter that did N-lighting that was forward-rendered. For those who don’t know,
the normal renderer in Pixi.js is a forward-renderer. That means it iterates “forward” through the scene list and draws
each object entirely as it goes along. Anyway, the idea behind the filter I wrote was that by adding this filter to a
container it would add lighting to that container. Problem was that since it was forward rendered each light had to be
shaded for each object in the container. In the few projects I wanted to use the effect in, it wasn’t performant enough
for the amount of lights I wanted to have. So I started looking for a better way.