Source code can be found here
http://forum.unity3d.com/threads/181520-2D-dynamic-shadows-with-source
I found a great blog post about implementing 2D shadows.
http://www.catalinzima.com/samples/shader-based-dynamic-2d-smooth-shadows/
Requires a number of passes to generate the shadow occluder data but by keeping the shadow map size down it is still relatively fast. It’s very useful since it doesn’t depend on extruding any geometry.
Doesn’t really work on iOS now because it requires NPOT render textures. Looks like it’s been ported to win 7 phones so an iOS one is probably possible with a few shader tweaks.
Here is a demo video
Source coming soon (hopefully:))
1 Like
absolutely cool 
long time since I last saw an implementation of the penumbra shadow casting shown yeeears ago on gamasutra 
Wow. Just wow, brilliant job!
so are you porting this to Unity?
See the title of the video.
It’s a pretty nice technique although it does require several passes for each light rendering into a texture, and then each light has to have its own set of passes so you can imagine it getting slow fairly quickly for a more complex scene. But on the plus side, it doesn’t need to detect where geometry is so you could have an extremely complex and dynamic level.
Thanks for the comments. Yup Imaginaryhuman you hit the nail in the head. It still works quite fast on desktop computers if you keep the resolution of the “shadowmap” low. The more expensive version simulates a penumbra using a 3.0 ps. It’s a very clever way of generating shadowmaps by projecting everything to the x axis and then “raycasting” by downscaling by the x-axis. That’s what made me want to try it. The advantage with this technique is that it decouples the shadow mapping algorithm from the geometry. You can think of it as a defered renderer.
Later I’ll try the geometry extrusion version which would most likely work on iOS much better.
Chazde it has been already done in Unity. I’ll release the source for free later this week I promise:)
The final result is very similar to the 2DVLS plugin already on the Asset Store. The technical approach though is very different and I’m very interested to know which one is better.
I’ll definitely keep an eye on your work and can’t wait to see a first implementation! Keep up the great work!
I’ve built on Catalin Zima’s ideas for shader shadows and come up with a much more efficient technique that uses far fewer passes.
You can read about it here (uses OpenGL + LibGDX).
Hopefully this will help some asset developers. 
Nice. I was trying to find a more efficient way. Might give that a go. Thanks