Black Blended smoke???

I have designed a particle system for my game where when an object becomes damaged it lets off some smoke. Everything to do with this smoke is done and completely coded, just one problem. The smoke currently looks greyish white if blended enough and doesn’t give the desired effect of damage. Right now it looks more like clouds or steam.

Are there any extensions or blend functions or any other ways to create black smoke and still be able to keep transparencies and translucencies.

I have experimented but haven’t found any combination yet.

I am using a texture for the smoke and glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE) to blend the texture to the scene. The texture is only BW ATM with the background being black and the smoke effect being grayish.

I have tried inverting the texture’s colors and playing with the blend function as well as other masking techniques but haven’t had any luck.

Thank you for your help in advance


And set glColor4f(0.0f, 0.0f, 0.0f, 1.0f) (or something similar) for your particles.

Thanks, thats it.

It didn’t quite work with a BMP since I lost the transparency that was previously there, but when I changed to a TGA with an alpha channel it gave me exactly the effect that I wanted.

Thanks a lot.

The blend function I like the best is:


This means that if you want your source texture to be fully additive, you set an alpha of 0 in the texture; if you want your texture to be fully opaque, you set an alpha of 1.

Thus, for the bright, fiery parts, you will have a fairly low alpha value (i e mostly additive) whereas for the smoky fringe, you’ll have a much higher alpha value (which will hide more of the background). Then you simultaneously make the center a saturated yellow or orange, and fade to a dark grey or almost-black towards the smoky bits. Don’t forget to fade color to totally black at the edge, and alpha to totally 0 at the edge (this means “no change” for the framebuffer).

Also, BMP is often stored with pre-multiplied alpha, which is not what you want for OpenGL textures.

Originally posted by jwatte:
Also, BMP is often stored with pre-multiplied alpha, which is not what you want for OpenGL textures.

It looks (I could be wrong though) like gamma151 is using 24 bit BMPs and the actual colour of the bitmap is being used as the alpha via the blend function glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE).

I think expanding the bitmap at load time (from RGB to RGBA) and adding the Alpha as the Luminance value for the original RGB.

That’ll allow progress without having to redo the textures.

But Jons suggested Blend function etc is a very good one…

[This message has been edited by rgpc (edited 07-03-2003).]