How to display smoke?

Started by
6 comments, last by Daywalker313 23 years ago
I want to add smoke and explosions to my game. I was searching for an easy way to display it. But I didn''t find any . I want that the smoke/explosion textures are always facing to the camera, but the depth buffer should be enabled. Does anybody know a solution?
Advertisement
billboard
Take a look in the openGL Challenge archives. They''ve done a smoke/gas theme.
fs

http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//
which is at http://www.oglchallenge.dhs.org/

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
If you want explosions, check out Nehe''s particle engine tutorial. That is how I would try to go about explosions, with a particle engine similar to that. As to smoke, I''m not sure. That could use some looking.

The Kid

I don''''t know what the future holds, but I know who holds the future.
I don''t know what the future holds, but I know who holds the future.
Make sprites like in nehe''s tutorial, but instead of using a star texture, draw a puff of smoke. Make a bunch of sprites using your smoke picture and just make them come up from an emitter. Then you should add a slightly random X velocity so they don''t always go straight up and also make them spin and fade while growing slightly. At least that''s what I did and it looks pretty cool. http://mac.emuscene.com/DavidStuff/index.html for screenshots
Thx for your replies. First I''ll try to display rotating textures, so that they rotate with you (not sure how do do) and always face to the camera. I have already a particle system in my engine, but for great explosions you would need hundrets of particles and that would need to many resources.

If you want to have a polygon that always faces the camera, try something like this:

flaot M[16]
glPushMatrix();
glTranslate(toWhereeverYouWantThisParticleToGo)
glGetFloatv(GL_MODELVIEW_MATRIX,M); //Get the matrix
glLoadIdentity(); //clear the matrix
glTranslatef(M[12], M[13], M[14]); //go to where it used to be but discard rotation information
DrawYourParticle;
glPopMatrix();

This topic is closed to new replies.

Advertisement