OpenGL Fire effects with blending
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 =
GL_ONE
GL_ONE_MINUS_CONSTANT_COLOR
GL_CONT_ALPHA
Thanks in advance.
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 =
GL_ONE
GL_ONE_MINUS_CONSTANT_COLOR
GL_CONT_ALPHA
Thanks in advance.
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?
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!
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.
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.

