Jump to content
  • Advertisement
Sign in to follow this  
middy

OpenGL Explosion in OpenGl

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey I have finally got my weapon system working. But this presents me with a new problem I need to make things blow up. The object that needs to blow is a spaceship. I had something in mind like this. A sphere like explosion exspanding from the center with a bluish vertical plate also exspanding(this is the shockwave). But I am in doubt on how to make it. A particle engine is not an option but how then. Perhaps I could be pointed to a good tutorial?

Share this post


Link to post
Share on other sites
Advertisement
There was a thread that you might find useful here, in which we were discussing simple methods of using explosions.

Do you not want to use a particle system? Why not, may I ask? If you don't want to use a particle system, you have the option of pre-rendering an explosion as a series of textures, then automatically change between these to give the illusion of an explosion.

Your sphere could be changed using the scaling features of your rendering API (eg: glScalef) (make sure you use blending for the transparency, if needed). Likewise, the plane for the shockwave could have a simple texture (perhaps a ring like shape with brighter outsides than in) which again is scaled over time. It'd be effective if you tweak your blending as time goes on to make the effect fade away too, rather than just vanish suddenly.

Share this post


Link to post
Share on other sites
Well perhaps a particle it an option :-)

I just cant see how I can create the effect I want with it :)

Share this post


Link to post
Share on other sites
You can, but a particle system will add extra niceness. Here's how I'd do it.

0: Explosion occurs, several particles are created at centre of explosion
1: Particles expand outwards and continue 'micro' explosions whilst the sphere in the centre of the system expands and the dying initial particles turn to smoke textured particles
2: Rapidly moving shockwave (QUAD) is created at the explosion point
3: Sphere continues expanding, changing colour and fading whilst shockwave does the same, only faster.
4: Mini particles left over from explosion remnant continue raining down until all engergy is exhausted

The energy particles will shrink and fade with time as the smoke particles gain size and fade over time.

The sphere would be slightly scaled per frame with glScalef, with the shockwave doing the same, only with a greater scale factor. Use the glBlendFunc( GL_SRC_COLOR, GL_ONE ) or similar for additive blending.

Of course, the particle system is entirely optional. Have a look at NeHe #19 and Code Sampler for some basic info and code on particle systems and blending.

See also this page on the OpenGL resources page

Share this post


Link to post
Share on other sites
*Edited*

My question about QUAD was answered. its all explained in

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=32

[Edited by - middy on August 30, 2004 4:38:34 PM]

Share this post


Link to post
Share on other sites
One thing: when doing space explosions with anything that resembles big quads with a shockwave texture, billbord them! IMAO, there's nothing more annoying in a space shooter (or post-1970 movie) than those really cheap 2D shockwaves. Have a look at Freespace 1 and 2, you can even get sourcecode for part 2 and they had mighty fine capship explosions. If you really need an effect aligned to a plane not perpendicular to the camera, make it real 3D, like a relatively low-poly translucent torus expanding quickly from a major breach.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!