3D Explosions

I am interested in doing 3D explosions for the game that I am making. Does anyone have experience with this? Can you point me to some resources? I basically want to created an alpha blended, textured sphere that expands as the explosion gets bigger. My initial thought is that texturing the sphere is going to be the hardest part. Thanks in advance.

Tone

[This message has been edited by Tone (edited 05-28-2001).]

Explosion with texture mapped sphere is not very good, I tried and the explosion is too regular. What you can do is

  1. several texture mapped spheres
    or
  2. texture mapped particles
    I’d vote for the second one

Check this out:
http://www.nvidia.com/Marketing/Developer/DevRel.nsf/pages/8162B09F2314F3A7882568630079B73E

How about using a single billboarded(i think that’s the right term for a face that always points towards the viewer) quad and map an animated texture to it.

Use glTexSubImage2d to modify the texture. Modify your Quad by slowly increasing it’s size. You can even sync the 2.

For an ultimate power weapon type thing make it really fancy with a couple of textured,blended spheres that increase in size and then fad out, add loads of cool particle effects and smoke at the end, a bright flash of light always makes it look cool, shake the camera randomly bit (amount dependent on distance etc.)

Thanks for the ideas. Now what I need is an algorithm that draws a sphere (or more specifically a hemisphere) where I can control the radius. Does anyone know were I can find that?

There’s a recursive sphere drawing routine in the red book. IIRC, it actually draws 1/8 of a sphere, but just rotate and redraw

– Zeno

You can draw spheres with glut and with quadrics, and you can specify the radius for both. When you have other methods where you cant specify the radius you can always scale it with the modelview matrix.

But I wonder why you want to draw a hemisphere. When there is an explosion above the ground you need a sphere, when its on the ground the lower hemisphere won’t draw because its behind the ground (supposing the viewer is above ground ).

[This message has been edited by Overmind (edited 05-30-2001).]

Yeah, okay. Initially I wasn’t planning on explosions in mid-air, but I changed my mind. For spheres though, I need an algorithm to draw them manually, since I want to texture map it. I would prefer not to use glut or glu functions for that.

ild ditch the idea of a single billboarded quad for an explosion. though this is what a lot of games do quake/UT. IMO the only place this looks good is in a space game where theres no background.
personally ild go with the hundreds of small exploding particles. render as small billboarded quads
for each particle go for velocity
x = random number from -1 to 1
y = random number from -1 to 1
z = random number from -1 to 1
normalize this vector (it doesnt give a perfect distribution but near enuf)
place all the particles in the center of the explosion and each frame update them outwards by their velocity
vola a nice looking explosion

Ok, I think you can’t texture a glut-sphere, but you can turn on texcoord generation with quadrics.

If you want to model your sphere manually, the parametric representation of a sphere is:

x(s, t) = r * sin(s) * cos(t)
y(s, t) = r * sin(t)
z(s, t) = r * cos(s) * cos(t)

Just loop s from 0 to 2*Pi and t from -Pi to Pi and draw triangle strips. You can take s and t as texture coordinates (of course you have to normalize them to a range from 0 to 1).

Btw.: Does anyone know how to model a geosphere like in 3DS-Max?