Shader-Based Dynamic 2D smooth shadows
This sample shows a method of drawing soft dynamic shadows in 2D using shaders. A detailed explanation of the technique can be seen here.
The algorithm used ensures that any object of any shape can cast shadows, and the complexity of the shadow casters does not affect the performance of the algorithm.
The sample shows a simple scene with some objects rendered in it (one of which is an animation), and two light casting shadows.
The red light can be moved with the arrow keys, and both light can be moved with a controller’s thumbsticks.
The source code: shadows2D.zip