Jump to content
  • Advertisement
Sign in to follow this  
Sparhawk42

How to program explosions with Direct3D9?

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

Advertisement
Not sure what you mean by bound to a mesh but the normal way of doing explosions is with a particle system - you will find plenty of tutorials on the web for these. To make the explosion 'follow' some mesh parts you just move the position of the particle emitter.

Share this post


Link to post
Share on other sites
As Trip99 said, you need to look into particle systems for this - unless you actually want your mesh to explode [smile]

I've seen a few algorithms (you often get them in 3D Modelling packages) that will take a mesh and "explode" the triangles outwards from a given detonation point. This isn't trivial, and basically requires you to rotate/transate each triangle outwards along a face normal (or otherwise).

The other alternative, is to have your particle system draw lots of fire/smoke/flashes etc... on the screen and have your mesh disappear at an appropriate point. This one is relatively easy to program.

For Direct3D, you really need to look into "Point Sprites" - they are the API's interface for hardware accelerated particle systems. You provide Direct3D with a list of points (each point is a particle) and it will do the work to convert them into a small textured quad on the screen.

There used to be some general documentation and a sample in the DX SDK on using PSprites for a particle system, but they disappeared a while back. Look up the IDirect3DDevice9::SetRenderState() call with the D3DRS_POINTSPRITEENABLE render state (as well as a couple of others).

hth
Jack

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!