Sign in to follow this  
  • entries
    162
  • comments
    262
  • views
    167074

Backlit sprites, part 1

Sign in to follow this  
OrangyTang

88 views

This idea has been knocking around my head for the past couple of days, but I think I finally figured out how to do it - backlighting of sprites at runtime.

I don't know if back lighting is the correct term, but I'm after the effect where a strong light behind the object appears to give it a glow around the edges (something like this). I figure if I can find how much light would pass 'through' any given pixel in a sprite, and encode this in a texture, then I could use it in a shader to change the amount of backlighting depending on lighting conditions and position.

Here's the result of the first step - analysing the input sprite(s) and determining how much light should be let through each individual pixel. Below you can see the result from several sprites (Tails, a cloud and the trees, pinched from the ice reflection test). Until I can come up with a better name I'm calling this the 'scatter map', as it represents how much light scatters around an object.



Next I'll need to generate a normal map from this so I can shade it directionally. Then I can write a shader to use the original sprite, the normal map and the greyscale scatter map, plus the lighting environment, to draw the final lit sprite. Hopefully I'll be able to get something drawing pretty pictures in a couple of days. [grin]
Sign in to follow this  


1 Comment


Recommended Comments

You probably DO know the correct term, since you use the word scatter, but alas it's called subsurface scattering ;-). See, this is why I love this blog. Like me, you are using the GPU to add some fluff to sprite engines, and the result shows.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now