Archived

This topic is now archived and is closed to further replies.

How to display smoke?

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

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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();

Share this post


Link to post
Share on other sites