views:

791

answers:

4

Where can I find a good algorithm, or where is just a good place to start, to implement real-time, non-interactive smoke or fire or mist, in 2D?

I've come across this simple one and this complex 3D one but I was hoping for something in between. Anyone know of any good algorithms?

+5  A: 

The best "in-between" algorithm that is in common use is a particle system, described here.

Essentially, you create a bunch of sprites and animate them according to simple rules. With the right parameters and textures, you create smoke as it is done in just about every game published.

Its a bit of a black art getting it right, but there's loads of resources for getting started if you know where to look.

Justicle
+1  A: 

Most fire/smoke effects are particle systems. I'd start there and then try to make it more realistic through tweaking the randomness. Play with the shape of the fire, the way color fades, the direction parts of it move.

There's not much in the middle. Either it seems to be tweaking a particle system, or actually delving into temperature and airflow. Here's a project delving into temp/airflow.

McAden
The first example is nothing like a particle system - its the old-school demo "fire" image-based algorithm.
Justicle
Ah, I didn't actually read the code, I shouldn't be so hasty, sorry.
McAden
+2  A: 

This article by Hugo Elias describes a pretty nice variant on the traditional 2D demo fire effect. It's fairly simple and looks pretty good.

mattnewport
+1 Ah takes me back.
Justicle
+2  A: 

The co-author of the second link (Jos Stam) has a paper that more game focused Real-Time Fluid Dynamics for Games. Quite a accessible read, and you can just keep it to the 2d example.

Simeon Pilgrim