For starters, heres the reference image I've been trying to recreate:
Expanding the preprocessing step to generate the full scatter map wasn't too tricky. I had to remove one of the early-out optimisations because it messes up things down the line, but it's still plenty fast enough.
From left to right:
- Calculated backlight factor (how much light shines through at the edges).
- Normal map generated from backlight factor.
- Final scatter map, with normal map in RGB and backlight factor in A.
Now with some pixel shader magic, we use the scatter map to light the sprite. It's quite a simple shader, basically combining regular per-pixel normal mapping with a per-pixel backlight. Most of the work is already done in the preprocessing, the only unusual bit is the light falloff, which uses a finite linear falloff rather than the usual 1/linear, and using two different falloff factors for the two halves of the lighting.
Backlit (totally on top of the light source):
Backlit from the side:
Quite close to the reference image I think. [grin]
After some tweeking and tidy up, I'll post the preprocessing code and the shader code. I've also got to extend the shader to support sprite rotation, but that shouldn't be too tricky.