how can to realize fire effect with opengl

I want to use procedural texture ?

In a fragment program or run on the cpu? Both are the same in essence, but different in applying it.

To do it on the cpu, have a base fire texture kept in memory, and a 2d array of random values. Each frame (or every couple frames), loop through your texture, creating a new texture in memory, but offsetting the pixel data by the values in the 2d array (mentioned earlier), which you should scroll through.

To do it on the gpu, have a base fire texture on the card, and a texture full of random values (our 2d random value array). Do a dependant texture read into the random value texture, and use the values from that to offset the UV coords of the fire-texture, do a texture read from there, and output that to the frame buffer.

Both can give a nice flickering fire effect, when done right. Hope that helps

the nvidia OpenGL SDK provides good demos(+sources) for this effect

As does…

http://users.ox.ac.uk/~univ1234/opengl/projects1.htm

I want to create fire effects based on procedural texture ,or say Perlin `s noise .
and u can give some suggest .
thanks .

Originally posted by DopeFish:
[b]In a fragment program or run on the cpu? Both are the same in essence, but different in applying it.

To do it on the cpu, have a base fire texture kept in memory, and a 2d array of random values. Each frame (or every couple frames), loop through your texture, creating a new texture in memory, but offsetting the pixel data by the values in the 2d array (mentioned earlier), which you should scroll through.

To do it on the gpu, have a base fire texture on the card, and a texture full of random values (our 2d random value array). Do a dependant texture read into the random value texture, and use the values from that to offset the UV coords of the fire-texture, do a texture read from there, and output that to the frame buffer.

Both can give a nice flickering fire effect, when done right. Hope that helps [/b]

If all you’re doing is scrolling the texture, you’re better off doing that with the texture matrix, than trying to scroll the bits in memory.

another topic would be “real” fire, made out of polygons; does anyone have a solution for this ?
Or is there a modelling-plugin outside there, which can create procedural fires ? this would be an interesting peace of software, i think.

Its quite easy to generate procedural fire in a program like 3D Studio Max ( Fire effect ). I guess you could generate a fire movie and billboard it in game. I’m not too sure about actually procedurally generating the effect in real-time. I’m not sure what you would gain from doing this - its quite an intensive procedure anyway ( max takes ages to do fire effects ). Would be an interesting demo to hack I guess.

@robbo:

>>Would be an interesting demo to hack I
>>guess.

yes; that’s the reason why i want to do it ! (or let me say "why i would do it, if anyone could tell me a program that generates geometric flame meshes)

Originally posted by DJSnow:
another topic would be “real” fire, made out of polygons; does anyone have a solution for this ?
Or is there a modelling-plugin outside there, which can create procedural fires ? this would be an interesting peace of software, i think.

what about volumetric rendering ? (remeber: “volumetric rendering” does mean much more than some fog-on-the-ground-and-cloud-effects.)

i don’t know where to get it but at the last siggraph, there was an excelent paper about this topic:

“Physically Based Modeling and Animation of Fire” written by Duc Quang Nguyen,Ronald Fedkiw,Henrik Wann Jensen

I have had great success with using particle systems to create nice volumetric fires. Check for instance my Soft Coronas demo or my Volumetric Fogging demo. http://esprit.campus.luth.se/~humus/

There’s a paper put out by Stanford that tells how to model fire realistically. It looks very good. But good luck getting it to run in real time. And they didn’t use OpenGL obviously. But it’s still cool anyway.

-SirKnight