Smoke Visualization

Hi there.

I have stopped developping my VR viewer for a while to spend some time on a CFD (Computational Fluids Dynamics) viewer.

My division uses CFX but you might as well have heard about Fluent or other CFD packages.

Basically, a CFD package uses finite volumes to determine values such as temperature, velocities AND smoke concentrations in a model giving the geometry and boundary conditions.

My question is quite simple : for each volume (basically a cube), I have the smoke concentration (from 0-100%). I was wondering if someone knew of a technique to render the smoke with these values…

I want to say that I am not looking for a real-time solution (it’s barely possible when you have 500000+ cells even with a GeForce 2 !). My idea is to somehow cast a ray from the view point to the boundaries of the model and use some alpha-blended quads but I can not relate the actual smoke concentration to the opacity…

I think this is more related to physics than to OpenGL but I would be happy if someone could help me (and don’t worry if it goes deep into physics, I’ll try to cope with it !).



Quite simply, you just cast the ray and determine how much of that length passes through smoke. Ray marching techniques are typical for this. You then apply a linear interpolation of ambient color and surface color based on the opacity of the smoke. Naturally, for good results, you will need to know the opacity value of the type of smoke, fog, or whatever scattering gas you’re dealing with.

This is pretty good due to the type of scattering that occurs in smoke. Usually, light can be assumed to scatter only once, and the light removed by scattering is simply replaced by light at the ambient frequencies (the color of the smoke) that is scattered into the ray in its place.

Of course, this technique will look pretty boring, so you should probably use noise-based methods to get a more realistic look.
Ken Perlin, David Ebert, and a bunch of other people have written many readily available papers on such subjects. Plus, the book Texturing and Modelling is helpful, although it isn’t a high-level book:
more tips and tricks really. Also, real scattering is highly frequency dependent: for plain old smoke, this is usually ignored, but for some applications, you might want to split up light into a few frequency bands.

Of course, this probably won’t work well in real time. Given enough compute power, you could maybe do it per-vertex if you’re using a representation conducive to that.

Of course, as you start getting dense internally lit gases, the assumption that scattering occurs only once becomes false, and you won’t get the results you’re looking for. But the assumption does work well surprisingly often.

Hi Yngwar !

Thanks for your reply. Do you know which editor sells the book you are talking about (Texture and Modelling) ?

Thanks again.


Texturing and Modeling 2nd edition by Ebert, Musgrave, Peachey, Worley, and Perlin

published by Morgan Kaufmann. July 1998

ISBN 0122287304

The first edition is called Texturing and Modeling: A Procedural Approach. If I remember, it’s lacking a few chapters that are present in the 2nd edition, but might be okay if you see it cheap in a used bookstore.