PDA

View Full Version : Rendering flow density field



Ponja
05-19-2009, 01:36 AM
Hi guys, I am using the Lattice Boltzmann Equation to simulate condensation of vapor. The code is run in Matlab and the end result is a [x,y,z,time] matrix which I want to render using openGL.

Now my question to you is how can this be done efficiently? Currently I am doing it in Matlab by simply plotting points with size and color dependent on the density at the location.
Naturally openGL should be able to offer some more sophisticated solutions with transparency. Ultimately having some vapor (smoke) - water effect with raytracing wouldn't be too shabby but I am not really sure of how I would go about this.

What can be done is that a cutoff density can be used in order to separate the vapor from water.

Any ideas?

scratt
05-19-2009, 09:41 AM
I would have the CPU create vertex arrays of points and colour based on time, and then stream those with some side data to geometry shaders which can construct textured quads of varying sizes and use alpha values to blend them. Fragment shaders can even then be used to handle lighting or other effects in the cloud to do with colour and density.

If you are "streaming" the data so that the GPU is working on one batch while the CPU is prepping the next you are going to be running at maximum efficiency on both ends.

Ray-tracing is going to be complex and slow-ish on current HW IMO, but with some nice shaders you should be able to generate a fairly nice blended scene at reasonable frame rates, even with large datasets..

I currently employ a similar system for clouds and nebulas in a real time sim I am working on.

If your data-sets are massive you could always go one step further and split the data into an Octree of some sort so that geometry is cut down and averaged the further it is from the viewpoint...