explosion effect in DirectX9.0

Started by
6 comments, last by Anddos 13 years, 9 months ago
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.
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.
[ dev journal ]
[ current projects' videos ]
[ Zolo Project ]
I'm not mean, I just like to get to the point.
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.
If you are using particles you can make all of them originate from a single point giving each particle a random speed vector.

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.

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.
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)!
you would need 2 textures 1 for fire and 1 for the smoke,the arma 2 explosions are really nice,heres one for example,
:)

This topic is closed to new replies.

Advertisement