PDA

View Full Version : how can to realize fire effect with opengl



whoamiwww
02-22-2003, 04:08 AM
I want to use procedural texture ?

DopeFish
02-22-2003, 08:08 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

AdrianD
02-22-2003, 08:36 AM
the nvidia OpenGL SDK provides good demos(+sources) for this effect

rgpc
02-23-2003, 01:00 AM
As does...

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

whoamiwww
02-23-2003, 01:30 AM
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:
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

jwatte
02-23-2003, 08:12 AM
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.

DJSnow
02-24-2003, 08:33 AM
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.

Robbo
02-24-2003, 08:57 AM
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.

DJSnow
02-24-2003, 09:03 AM
@robbo:

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

yes; http://www.opengl.org/discussion_boards/ubb/biggrin.gif 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)

AdrianD
02-24-2003, 01:37 PM
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

Humus
02-24-2003, 02:05 PM
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/

SirKnight
02-24-2003, 05:07 PM
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. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

-SirKnight