OpenGL Fire effects with blending

Posts: 321
Joined: 2004.10
Post: #1
I'm trying to make a simple (ha ha) smoke and fire effect for a 2D game.

I'm real happy with the smoke. Looks great.

For fire, I've got three 16x16 RGBA textures of sort of a "ball" of colors:
red, orange, and yellow.

By brute force I simply cycle through all possible glBlendFunc(s,d) combinations,
and three combinations are great except when the smoke is gone, the fire goes completely away. (I've got a white background)

The 3 combinations are.
glBlendFunc(GL_SRC_ALPHA, dst);

where dst =

Thanks in advance.
Quote this message in a reply
Posts: 1,403
Joined: 2005.07
Post: #2
I dont know what you are asking
id do fire differently..

but yeah um

you could draw some black circles (which fade outwards toward the edges) behind the fire or somthing to "fix" your problem?

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Posts: 148
Joined: 2003.03
Post: #3
He's asking why his fire disappears whenever the smoke does.
Quote this message in a reply
Posts: 1,140
Joined: 2005.07
Post: #4
Indeed, but if it's depending on the smoke as a background for the blending to work correctly, then it's going to break when the smoke is gone. It's likely due to over-exposure. If you play with the blending functions, you may be able to get similar results without requiring the background. Or draw a black version of the flame for each particle, then draw the actual flame particles on top of those (after you draw all the black ones) to provide a background.
Quote this message in a reply
Posts: 1,199
Joined: 2004.10
Post: #5
When I've done smoke & fire, I've used two passes. One pass for smoke with GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA and a second pass for fire, with GL_SRC_ALPHA,GL_ONE.
Quote this message in a reply
Post Reply