Using normal maps to create lighting for 2D sprites.
Ahoy, space-huntsman! So in the past I was having trouble trying to create lighting for my sprites in my game. I was trying to find a way to pull this off that didn’t require a massive amount of work and looked a good quality.
I actually tried to use a few unity made plugins as well as sprite lamp but nothing was coming out the way I wanted it too. This is when I accidentally ran across something really powerful that does more then just add lighting to your sprites, it makes your sprites look nearly three-dimensional.
First off, here is what the finished product actually looks like.
Long story short you can create normal maps from sprites using Illustrator or Photoshop pretty easily by layering your sprites as you develop them. You then apply those normal maps onto your sprites normal map layer. In order to do this you’ll need to make sure you have a custom sprite shader that takes in both a sprite and a normal map.
Here is a link for a sprite shader with a normal in case you need one. Here
Here is the normal map.
Here is the sprite without a normal map attached. (see how flat it looks in comparison)
Here is a screenshot of it in game.
Not only do your sprites receive lighting but they also appear to have 3d geometry as a consequence. I’ve actually been told several times now during play-testing that the structures in our game we’re 3d models. Little do they know :P
Anyways I hope this may be as helpful for you as it was for me!
Be sure to subscribe on our website for news, updates and free demos. here