On my todo list for ages was fixing damage sprites so they glow in the dark. It always bugged me that my damage sprites were not really good enough, to my mind. We have wood-burning stoves at my house, which I light almost every day right now, and for a lot of the time I worked on GSB I used to sit there staring an a blazing inferno of logs and coal and feel annoyed that the damaged bits of spaceships didn’t look that awesome. I am using a very similar system for GTB, although with less hassle for placing the individual damaged locations, which makes it a bit easier for modders. They still do not pulse and glow the way i want.

One complication though, is I have lighting in GTB (not real 3D lighting, but cunningly faked), which means they needed to glow in the dark like this:

Which they now do, and I’m very happy about it. Unfortunately it took 2 days work, because in investigating it, it turns out I had to totally re-write my lighting system. The game uses multiple render targets for the lighting and composes them right before displaying the end image, which means that anything that actually gives off any light, such as a searchlight, laser beam, particle, or damage sprite, needs to also render to the offscreen lightmap buffer. It also means you have to batch these, and there are all kinds of annoying  unlikely scenarios where it actually breaks down, in some way, although I doubt anyone will ever notice.

At the end of those 2 days, I was very glad I took the effort. Maybe one day I’ll manage to get them pulsing properly, and have particles flitting around ‘inside’ the damaged areas. Maybe!

2 Responses to “Glowing damage”

  1. yayoyoyo says:

    I’m curious as to how your lighting works, if you don’t mind talking about it.

    I was thinking of having a system that would let me create polygons on top of my sprites by clicking their vertices, then defining surface normals for those polygons. It would then calculate lighting for each of those polygon regions– I will only have a few polys per sprite, and not all that many sprites per frame so figure not that many lit polys. Do you think this would work?

  2. cliffski says:

    a few people have done that before, I think the trendy term is deferred lighting with normal maps. In practical terms it’s much more involved than it sounds, but google it and you will find several articles on it.