I'm working on a 2d shadow system (by drawing to an alpha layer texture, which blends the world accordingly) and require a stencil test to make multiple light sources to work propperly.
However, there's an issue with the stencil test when it passes through the shader, it still renders. The "algorithm" used is:
- Draw point light onto stencil.
- Apply shadow (ie. remove the drawn light where it does not reach, behind walls etc)
- Render the point light to the alpha layer where stencil allows (ie. where shadows haven't removed)