Non-Alpha based explosions

Discussion in 'Game Development (Technical)' started by Jason Chong, Oct 1, 2004.

  1. Jason Chong

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    264
    Likes Received:
    0
    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.
     

    Attached Files:

    • test.JPG
      test.JPG
      File size:
      32.9 KB
      Views:
      662
  2. Nauris

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    184
    Likes Received:
    0
    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.
     
  3. Rainer Deyke

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    380
    Likes Received:
    0
    You can fake alpha using scattered pixels.
     
  4. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    >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.
     
  5. Nemesis

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    273
    Likes Received:
    0
    Good point.. with 640x480 + resolutions, dithering on the transparency colour key or bit-mask should look even better than the older consoles.
     
  6. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    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.
     
  7. serg3d

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    69
    Likes Received:
    0
    Or you can use one big bitmap instead of several small. Just draw animation for one big picture of explosion.
     
  8. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
  9. Jason Chong

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    264
    Likes Received:
    0
    Onyx, wonderful! ;)
     
  10. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    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) ;)
     
  11. RedKnight

    Original Member

    Joined:
    Sep 23, 2004
    Messages:
    148
    Likes Received:
    0
    a simple Particles engine.
     
  12. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    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.
     
  13. Sunshine

    Original Member

    Joined:
    Aug 7, 2004
    Messages:
    173
    Likes Received:
    0
    Try mixing floor clenser and aluminum foil together then throw it in the fireplace. :eek: Voiala!
     
  14. James C. Smith

    Moderator Original Member

    Joined:
    Aug 21, 2004
    Messages:
    1,768
    Likes Received:
    0
    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.
     
    #14 James C. Smith, Oct 2, 2004
    Last edited: Oct 2, 2004
  15. James C. Smith

    Moderator Original Member

    Joined:
    Aug 21, 2004
    Messages:
    1,768
    Likes Received:
    0
    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
     
  16. tentons

    Indie Author

    Joined:
    Mar 1, 2004
    Messages:
    664
    Likes Received:
    0
    I apologize for being pedantic, but I think it's actually called "stippling." :)
     
  17. Anthony Flack

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    2,176
    Likes Received:
    0
    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...
     
  18. Screwball

    Original Member

    Joined:
    Aug 2, 2004
    Messages:
    84
    Likes Received:
    0
    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.
     

    Attached Files:

    #18 Screwball, Oct 3, 2004
    Last edited: Oct 3, 2004
  19. Chaster

    Original Member

    Joined:
    Aug 2, 2004
    Messages:
    144
    Likes Received:
    0
    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
     
  20. Jason Chong

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    264
    Likes Received:
    0
    changes

    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. :-/
     

    Attached Files:

    • exp2.jpg
      exp2.jpg
      File size:
      29.7 KB
      Views:
      569

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer