Alx101 / Unity2DShadows

2D dynamic shadows for the Unity engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity 2D Shadows

About

This is an open-source Unity addon that allows you to easily create fully dynamic 2D lighting and shadows. The shadows are completely shader based and should work on Windows, OSX and WebGL (though with limitations to quality) builds. All code is commented and examples are available in the package, as well as a .unitypackage and a custom Editor within unity to set up the shadows to your liking.

It builds off of the techniques in this post and is basically a slightly expanded Unity version of it.

image

Shadows are pixel-perfect, meaning an image with transparency (for example the three dots in the image above) will generate appropriate shadow geometry. There's also the posibility to select filtering modes for the texturemaps created for the shadows, as well as blending mode for how the shadows will be applied to the objects to be lit.

editor

The editor included is meant to make it easier to edit many objects' lightsettings at once. It also provides an easy-to-find settings window for the shadow controller, so you won't have to go hunting for what object you attached that script to.

How to use

Check the Wiki page here on GitHub for a quick-setup guide.

Notice

This project is under the Apache 2.0 license. Feel free to clone and extend, or contribute to this project! Any improvements or suggestions are much apprechiated, as this was made to be free and open to everyone using Unity.

About

2D dynamic shadows for the Unity engine

License:Apache License 2.0


Languages

Language:C# 75.8%Language:GLSL 11.2%Language:ShaderLab 6.5%Language:JavaScript 3.5%Language:CSS 1.5%Language:HTML 1.5%