Stencil Shadow Algorithm
Render scene’s depth values into the depth buffer
Invert stencil bits when depth test passes when rendering the stencil volume
- glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT);
Pixels outside the shadow volume are inverted an even number of times
Pixels inside the shadow volume are inverted an odd number of times