-
Notifications
You must be signed in to change notification settings - Fork 186
2D Pixel Perfect Shadows
mattdesl edited this page Mar 31, 2013
·
22 revisions
Detailed here is an approach to 2D pixel-perfect shadows using shaders and the GPU. Because of the high fill rate and multiple passes involved, this is generally less performant than geometry shadows; however, it has a number of benefits. It will be implemented in LibGDX, although the concepts can be applied to any OpenGL/GLSL framework.
The basic steps involved are (1) render occluders to a FBO, (2) build a 1D shadow map, (3) render shadows and sprites.
The following animation demonstrates the technique:
The idea is an extension of my previous attempts at shader-based shadows, which combines ideas from various sources. However, "nego" on LibGDX forums suggested some great ideas to reduce the process into fewer passes.