gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Sprite Fading

#39466 - Ultima2876 - Sat Apr 09, 2005 6:50 am

In my game I want to have exposions that fade out over a few frames. I'll have a maximum of about 14 explosion sprites on screen at once, and there is the possibility of them overlapping scanlines.

I've had a look around, and apparently this effect is impossible to acheive using alpha blending (because you only have one alpha value to use - so you can't have a value for each sprite) unless the sprites do not overlap on the Y axis. However, my sprites do x.x

Can anyone think of any clever ways of doing it? (I'd rather avoid dither fading or blink fading if necessary, but if there is absolutely no way with alpha blending...)

Thanks in advance.

#39470 - poslundc - Sat Apr 09, 2005 8:18 am

Based on the parameters you've specified, I think you're probably stuck. In particular, even if you could get different sprites at different alpha-values, blending overlapped sprites usually turns out poorly because the hardware won't blend between sprites.

But alpha-fading, while a nice effect, is really just nice-to-have, and won't save an explosion animation that only looks mediocre anyway.

You might try fading the sprite's palette to black or some other neutral colour that is compatible with the background. Many SNES games do this, although if the animation doesn't naturally disperse/dither/whatever it will be noticeable when the pixels abruptly disappear at the end. Also, if you're going to have 14 of them then you don't want each sprite to use a full 16 colours, or you'll only be left with 2 palettes for your remaining sprites. (You might manage a decent four-colour animation, in which case you could squeeze it into about 3 palettes if you're clever about it.)

Dan.

#39471 - Ultima2876 - Sat Apr 09, 2005 9:14 am

Thanks for the input. It's what I thought... ah well, it's nothing vital, it's just I'm porting this from an old PC game that I [semi] made (as in I never got further than a basic demo) - and I had an alpha effect on those explosions which looked excellent. However, if it's not possible on the GBA hardware, I'm sure we can do without. Thanks again.

#39487 - tepples - Sat Apr 09, 2005 5:37 pm

By "old PC game", how old was it? Was the original a game running in Mode 13h (320x200 pixels 256 colors) or another indexed-color mode? Or was it a DirectX game with high or true color?

One thing you could do is use alpha dithering on your explosion frames. GIMP supports dithering of transparent images down to 1-bit binary transparency when converting them to indexed color. Combine this with multiple frames of animation for a fireball, and you have dithering in both space and time domains. This more sophisticated version of the "supertransparency" hack should look especially good on a slow LCD such as that of the GBA.

And about the palette issue: I'd suggest making all your fireballs use the same palette. Put them in a big "sprite sheet" and then convert that to 15 colors plus transparency.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39533 - Ultima2876 - Sun Apr 10, 2005 1:46 am

Well, I didn't mean old in that sense... as in a game I was working on two or so years ago - but it was a high colour Direct3D game (hence easily being able to support alpha blending).

I'll give the alpha dithering a go and see how it turns out. That may just be what I'm looking for.

As for the palette problem, yeah, that's what I plan to do.