How to create good looking smoke fx?

Started by
17 comments, last by karx11erx 17 years, 7 months ago
I have been trying to add smoke effects to an old 3D shooter, but I just fail to make it look good and have decent performance. Obviously it's not enough to create a particle engine and throw a ton of bitmaps at the screen (not even if the bitmaps are small animated clouds). So please, is there anybody around who could explain me how to create good looking smoke, like white, pretty directional thruster exhaust, or thick, black, billowing smoke from a damaged machine, or fog like effects? Maybe with some code examples (OpenGL preferred for the rendering), or examples what kind of images to use?
_________karx11erxVisit my Descent site or see my case mod.
Advertisement
So what exactly did you try so far?

I'd say, creating a particle engine that allows an artist to dynamically change the opacity, location, rotation and scale of the particles should be sufficient to create some interesting effects already. Various flak cloud effects I've seen were accomplished by having a few black sprites slowly move outwards, while rotating, growing larger and fading out eventually.
I would definitely recommend looking at other games that achieved such effects, and try to find out how they did it. Usually, it shouldn't be too hard to spot the tricks they employed. Or look at real steam vents and get an idea of the particles behaviour. Either way, this tends more towards 'artistism' than towards programming.
Create-ivity - a game development blog Mouseover for more information.
One problem is that my smoke looks like it is made of soap bubbles.

Another problem is that overlaying a lot of bitmaps makes it look white - no matter how black the bitmaps are.

Scaling them to greater size doesn't make the particles look too pretty either.

So I don't know whether to use few or many particles, small or large bitmaps ...

Here's a few pics (click on small images for bigger ones):

_________karx11erxVisit my Descent site or see my case mod.
A rather interesting technique that I just recently heard about involves particles and raytracing. Mind you, it is being done on DirectX 10, so I am not sure how that will work. link - scroll down a bit and look for SoftParticles. Really quite an interesting technique with good looking results.

I would say that a particle system is the way to go either way.

EDIT - now that you posted the screenshots, it looks like a bit of an art issue to me. Try using a higher detail texture for your particles with more alpha blending towards the outsides of the particles. The problem with them appearing white when drawing a bunch of them has to do with how you are doing your blending. I don't know the exact method of blending them to make them look good, but it looks like you are doing some sort of additive blending.
I read about this too - create photon map using particles and some raytracer and extract some volume fogging data from it. Beyond what time I can invest. :)

Edit:

OMG - I just found one major reason why my smoke doesn't look good: Due to a bug, smoke sprite size was too small ...

Still remains the question which OpenGL blend mode is best suited for many overlaying smoke sprites ...

[Edited by - karx11erx on October 2, 2006 6:44:20 PM]
_________karx11erxVisit my Descent site or see my case mod.
Ever played Red Alert 2? I always liked that sort of flak clouds. Atomic Tank, a PopCap game, shows the same. You should check out such games for reference. There's amazingly few sprites used per cloud - only up to 5 or 10 perhaps. They certainly didn't use an additive blending mode, they probably used a color blending mode or such.

Looks nice bytheway. Descent ah? :)
Create-ivity - a game development blog Mouseover for more information.
Quote:Original post by karx11erx
Still remains the question which OpenGL blend mode is best suited for many overlaying smoke sprites ...


You're using additive blending from the looks of it, you need 'regular' blending:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

You've also still got depth testing enabled from the looks of it. Draw your regular geometry, disable the depth test and then draw them back to front.

I'd also suggest turning on texture filtering to GL_LINEAR rather than GL_NEAREST and giving the particles softer edges.
I am using the blend mode you posted, but I will try the other things. Though rendering the stuff back to front can hurt - a smoke cloud can have several thousand particles ... sorting every frame?

Captain P,

the problem is not that I wouldn't know how smoke should look like. The problem is to make it look like I want it to. Yes, it's Descent. ;)

[Edited by - karx11erx on October 3, 2006 7:32:22 AM]
_________karx11erxVisit my Descent site or see my case mod.
Quote:Original post by karx11erx
I am using the blend mode you posted, but I will try the other things.

Hmm, I'd double check that. The pictures show lots of over-bright areas which you don't really get with that blending function. Of course your particle sprites might just suck.

Quote: Though rendering the stuff back to front can hurt - a smoke cloud can have several thousand particles ... sorting every frame?

Blending is order-dependant, and without sorting you'll get all sorts of artifacts. Depending on your game you might be able to get away with just sorting on a per-system basis. Personally I'd sort particles within a system, and then sort all systems. You'll greatly reduce the sorting time but with only minimal artifacts.

Whatever you do, for goats sake turn off depth testing - most of your artifacts on the screenshots above are solely due to depth testing.
I re-checked the blend func, it's definitely the proper one.

I turned off depth testing though and will add particle sorting for back to front rendering.

The quality of the particle images is another story ... Currently, it's a small cyclically animated cloud puff. They're the best I could get, and I can by no way do something like that myself. :/

Edit:

Added sorting (quicksort with minimal data movement required) - completely kills framerate. :(

Edit 2:

I had to re-enable depth testing because otherwise smoke would appear in front of objects even if it was behind them.

[Edited by - karx11erx on October 3, 2006 5:20:40 PM]
_________karx11erxVisit my Descent site or see my case mod.

This topic is closed to new replies.

Advertisement