Jump to content
  • Advertisement
Sign in to follow this  
sanjay1186

explosion effect in DirectX9.0

This topic is 2904 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

Can anyone tell me how to create explosion effect in DirectX9.0. I am taking help from DirectX9.0c book by Frank D Luna. Effects like rain,sprinkler are there in the book but how to create explosion effect.can any one send the programme or hint.

Share this post


Link to post
Share on other sites
Advertisement
how do you simulate rain or a sprinkler? I'm assuming using a particle system, explosion can be done the same way just using different textures.

Share this post


Link to post
Share on other sites
Quote:
Original post by freeworld
how do you simulate rain or a sprinkler? I'm assuming using a particle system, explosion can be done the same way just using different textures.


and behaviour of the particles.

Share this post


Link to post
Share on other sites
If you are using particles you can make all of them originate from a single point giving each particle a random speed vector.

Share this post


Link to post
Share on other sites
glizli draws a good approach. To slow the particles down over time you could also add a friction force, the direction of which is the opposite - i.e. negative - of the particles current velocity.

Share this post


Link to post
Share on other sites
Long ago, when I wrote my first game (Lunar Rift - you can find the link my signature) I created an explosion effect with geometry instead of a particle system. The idea was to use a sphere, which would read from a copy of the back buffer and distort the image to create a shockwave effect. Then I animated the scale of the sphere, making it grow quickly over time.

The end effect turned out pretty good, without particles. If you try it out, any of the tank style weapons will produce an explosion, or if a unit gets blown up it will also create an explosion too. Just a suggestion that you don't need to use particles alone - mixing the two could also be pretty cool.

Share this post


Link to post
Share on other sites
Quote:
Original post by sanjay1186
Can anyone tell me how to create explosion effect in DirectX9.0. I am taking help from DirectX9.0c book by Frank D Luna. Effects like rain,sprinkler are there in the book but how to create explosion effect.can any one send the programme or hint.


Use an animated texture on a billboard.

You simply draw a comic strip of the explosion, stick it in a texture file, and in your game stick the texture on a square that is aligned to always face the camera, like the bad guys in Doom.

You can make each frame 64x64, and have 4 frames side-by-side in the file, for a file with dimensions of 256x64. Then, to animate it, you first set the texture coords to be (0, 0) (top left vertex) through (0.25, 1) (bottom right vertex of the square). To get to the next frame, you set (0.25, 0) on the top left and (0.5, 1) on the the bottom right for your texture coords (supplying the other two vertices' texture coordinates as well, of course). And so on and so forth. You loop through the comic strip at any speed you want and get an animation.

It's good when your particle effects are not detailed enough or take a long time to run.

An alternative method:

One "cheap" way I created a bunch of particles was to just have a bunch of vertices with position and color that I rendered as a point list. Each particle has a starting velocity and is affected by gravity. I'd make a bunch of vertices colored white, orange, yellow, red, etc., render them as a point list, move them around, and get rid of them when their Y value was lower than my terrain. I think I got this idea from a game called iM1A2 Abrams, which was released in the mid-late 90s. So this technique works on old hardware, and it's automatically 3D (unlike the billboard)!

Share this post


Link to post
Share on other sites
you would need 2 textures 1 for fire and 1 for the smoke,the arma 2 explosions are really nice,heres one for example,

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!