PDA

View Full Version : Non-Alpha based explosions



Jason Chong
09-30-2004, 11:13 PM
Anyone managed to do any decent explosions without resorting to alpha blending ?

A few that came to mind is those you see in Metal Slug. Very nicely done/drawn.

I am doing one based on a 2D particle system, basically a collection of
animated non alpha explosions/smokes, which can then be used to make up
other patterns/explosions.

The easiest is to render an animated explosion but they won't look good
without alpha. Do you guys know any good ways to generate explosions without the edges getting into the way ? I don't want to use alpha blending as this will require the 2D game to be done using 3D ways or I will have to put all bitmaps into system memory just to acomodate the software alpha blending if using pure directdraw.

Here's mine.

Nauris
09-30-2004, 11:21 PM
Yours look too "whole", I think. its hard to tell from still shot, but maybe you should make them not too round, make the borders more jaggy and such. It could distract the eye and make borders less obvious. Oh, and make them short, go more for series of short, dynamic anims instead of one long. Once the eye has traced the pattern, it becomes hard to mask borders.

Hehe, i dunno how murky it sounds to you.

Rainer Deyke
09-30-2004, 11:37 PM
You can fake alpha using scattered pixels.

oNyx
09-30-2004, 11:49 PM
>scattered pixels

dithering ;)

I suggest taking a look at older games (mega drive, snes and the like)... they had to do everything without alpha, too.

Nemesis
10-01-2004, 12:12 AM
Good point.. with 640x480 + resolutions, dithering on the transparency colour key or bit-mask should look even better than the older consoles.

oNyx
10-01-2004, 12:24 AM
Ah... just thought about it a bit (by accident heh).

You could render explosions the usual way (whatever that means). And then you have to do some stuff with the rendered images: pull out the alpha channel of em, convert it to 1bit (dithered), and put the image together again (rgb+your new channel). With some testing the result should look pretty good.

serg3d
10-01-2004, 12:30 AM
Or you can use one big bitmap instead of several small. Just draw animation for one big picture of explosion.

oNyx
10-01-2004, 12:41 AM
Ye, that worked pretty ok-ish.

http://people.freenet.de/ki_onyx/dither_ex.png ~21kb (8bit bitmasked image)

Well, it's not perfect but I guess it's good enough for an example ;)

Jason Chong
10-01-2004, 02:19 AM
Onyx, wonderful! ;)

oNyx
10-01-2004, 03:15 AM
Another thing you can try out are alternating patterns for 50% transparency

frame1:
xoxo
oxox

frame2:
oxox
xoxo

frame3:

xoxo
oxox

etc

This way each pixel is flashing (half animation rate) if it's fast enough it appears to be half transparent (like two alternating frames of ff0000 and 0000ff appears to be 7f007f). Older hardware (like the Sega Saturn) used this trick for emulating transparency.

Well, let's say the animation runs at 30fps... that wouldn't look perfect, but you could for example alternate the pattern twice per animation (if your game runs at 60fps). So you get something like:
-frame1 pattern A
-frame1 pattern B
-frame2 pattern A
-frame2 pattern B
and so on.

However, you need to carefully think about how to do it, if you want to avoid glitches. Well, eventually you can use this trick for less tricky things (=without overlapping) ;)

RedKnight
10-01-2004, 01:16 PM
a simple Particles engine.

Applewood
10-01-2004, 02:35 PM
What's wrong with alpha-blending ?

You can do 25,50 & 75% real quick in code. It's still read-modify-write but you should be able to get a lot done, even moreso if you dip into assembler.

Sunshine
10-01-2004, 02:51 PM
Anyone managed to do any decent explosions without resorting to alpha blending ?

Try mixing floor clenser and aluminum foil together then throw it in the fireplace. :eek: Voiala!

James C. Smith
10-01-2004, 04:52 PM
For the past several years I have been using 8 bit alpha channels in my “2D” games using nothing but software blitters. (No hardware acceleration). You can do full 8 bit alpha blending in software. By “full 8 bit blending” I mean 16 bits of color + 8 bit of alpha. In other words, 256 levels of blending.

In our older games we used a couple other approaches. One was basically a 3 bit alpha channel. We had pre-calculated tables for doing 80/20 blending, 60/40 blending, 40/60, and 20/80. The source art had 8 bit alpha channels but what the art was “processed” by our tools it was split into 5 separate RLE encoded layers. One layer was all the opaque pixels from the image, a separate “later” had all the 80% opaque pixels, another had the 60%, and so on. To draw the image we would first copy all the opaque pixels, then blend all the 80% pixels using one pre-calculated table, then bland all the 60% pixels using a different table. This worked great for anti-aliasing the edges of think like player sprites. Explosion which needed more levels of alpha blending ended up looking banded.

Most expositions used a different method we called “black biased” blitting. It was using for explosions and other effects. It was basically variable alpha blending without an alpha channel. You just use the source pixels brightness as an alpha channel. The bright pixels are opaque or nearly opaque. The black pixels and transparent. And the dark pixels are translucent. If your art it 8 bit you can build a 64k lookup table to make this real fast. Read the source pixel and dest pixels, look them up in your pre-calculated “black biased” table and draw the result. It looked great for explosion in 8 bit games. No extra data in the art (no alpha channels at all) and no black edges around the explosions.

James C. Smith
10-01-2004, 04:55 PM
Of course the newest game we just released (Wik) does use Open GL hardware acceleration. The software based alpha blending I was referring to was in Ricochet Lost Worlds, Ricochet Xtreme, and Lionheart

tentons
10-02-2004, 04:51 AM
>scattered pixels

dithering ;)
I apologize for being pedantic, but I think it's actually called "stippling." :)

Anthony Flack
10-02-2004, 07:10 AM
The non-alphaed explosions in games like Metal Slug do look wicked good, though. Better than most alphaed ones. Maybe even better than all alphaed ones...

Screwball
10-03-2004, 02:04 PM
The non-alphaed explosions in games like Metal Slug do look wicked good, though. Better than most alphaed ones. Maybe even better than all alphaed ones...

With a bit of work you can recreate that style fairly eaisly (well a bit of work but it's mainly just going over and over it). The explosions in metal slug are basicly created using grouped spheres to give it depth.

With his current animation above you notice how it is basicly one big sphere, with a yellow centre and increasingly darker, and more red shades to the extents of the ball of fire. Flames / explosions should have very little yellow in them at all, most of it should be an orange / red colour. As well as this you should move away from one central yellow point and have multiple sphere like shapes, simmilar to how you would draw a cloud.

Secondally your flame / explosion has no smoke assosiated with it. When something like an explosion happens, it's going to generate some smoke around the outside of the flames. The smoke, however, is not going to be around the whole of the flame but mainly where the fire has been, eg the bottom and sides.

With brings me to the last point, you flame should just disapate into thin air, it should billow upwards and fade out. Yours looks a little strange as it doesn't billow, it just dissapates out like mist.

I've attached a Metal Slug explosion.

If you have a look you'll notice how there isn't really a centre point of the flames, the billow up and smoke is produced. It's a great effect.

Chaster
10-04-2004, 08:17 AM
Looking at Jason's screenshot, the thing that strikes me most is the fact that all the smoke clouds are the same size. He needs to make the clouds different sizes (and have them slowly "disintegrate/dissipate"). It's an art problem, not a code problem. Lots of games make good explosions without using alpha. (like umm, every game made before 1990....) Take a look at some old arcade games (via MAME) - tons of great explosion examples with no alpha used..

Chaster

Jason Chong
10-04-2004, 09:38 AM
I've made some changes to the smoke/fire anims.

Basically it's still a particle based system, it's meant to be a bit exaggerated
in it's own style.

And yes, it only looks good in animation sequence, not in a still shot. :-/