Dynamic Lighting Affecting Sprite-Based Characters?


I am wondering if there is a way to have ambient lighting (or just plain lighting sources) affect the appearance of character sprites to avoid having to do 30+ sprite sheets for different enviroments/conditions. Sort of the way a normal map bakes in lighting data, I would like to have the look of a sprite-based character’s pixels altered according to their materials. For instance, if a character is wearing a red dress in bright light, the shade of the dress brightens without affecting reasonably shadowed regions.

Thanks for any/all info!

Yes, there is definitely a way to do that. I’m doing that exact thing in my own game (Himeko Sutori in Unreal 3, but the principle is the same). The pawns all have a mesh that’s a plain square. On that square, I placed a masked, non-directional material that draws the sprite. The pawns have a light environment (are those still used in UE4?) assigned to the mesh, and the mesh changes color according to the light the pawn is in.

If you wanted to do something really detailed, you could draw a normal map by hand or you could draw a height map and convert it to a normal map.

Just to give you an idea of what it looks like, here are some examples:

A close look at the pawns. The material also layers sprite sheets for hair and equipment, with some custom texture packing for glow maps. This test screenshot was taken before I added rim lighting to the environment. The guy on the far left has the same skin color as the blue-haired girl in the middle, but it’s slightly lighter because he’s under a light.

Here’s a better look at the difference in lighting between characters in light and darkness.

And here’s a more extreme example. The skeletons at the far right have a pretty bright sprite sheet, but they’re mostly in darkness. If I move characters to that dark space to the right of the stairs, they’re almost black.