4
\$\begingroup\$

i'm newly working with opengl. I'm trying to create a simple program that will simulate fire. My question is what are the ways other than particle effects to simulate fire. And can fire simulation really be done without particle system effect??

\$\endgroup\$
  • \$\begingroup\$ Look up fluid dynamics - a few implementations exist that can run in realtime on the GPU. \$\endgroup\$ – Jonathan Dickinson Dec 1 '11 at 14:14
2
\$\begingroup\$

You could try something like the method described here . Basically, you generate random heat sources (random pixels in a texture for instance), then iterate over the whole texture and compute each pixel as a function taking the nearby ones as arguments.

Let c0 be the color of the current pixel, c1 is at its left, c2 at is right, and c3 and c4 the two at its bottom; c0 color (value) is the result of (c1+c2+c3+c4)/4. Do this for every pixel at every frame, and voilà, you got a (somewhat basic) 2D fire. Feel free to distort the source image to add realism.

Note that the very same technic is usable on 3D as well.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.