Sunday, September 9, 2007

Intro to fluid simulation

My thesis is essentially a test drive of the major fluid simulation abilities of different off the shelf or freeware software packages. I quick surf of Wikipedia returns four options: Blender3D, Glu3D, AfterBurn, and Realflow. To those four I'm going to add OverBurn, Flowline, and Houdini.

Blender 3D is a freeware program for 3D production (GNU public license) and includes a fluid engine:


Glu3D is a plugin for 3D Studio Max and Maya. It uses particle-based hydrodynamics in conjunction with particle-wrapper geometry for the liquid shape and wet maps to simulate the differentiation between wet and dry parts of the surface:


Afterburn is also a plugin for max and maya developed by Sitni Sati of Afterworks.com. It includes various methods for creating mainly gaseous fluid effects, from what I've seen:


Overburn is a plugin for Maya and the brain child of Peter Shipkov. As far as I can tell, it uses Maya fluids to shade particles using the particleSamplerInfo node. It's freeware! (Double-click the movie below to play it again):


Flowline is the proprietary software of Scanline VFX and there is probably no way I will get my hands on it any time soon. But it has really nice looking renders; I remember being absolutely blown away during SIGGRAPH 2006:


And finally, Houdini from Side Effects Software, the grandaddy of particle effects. It is a purely procedural program and relies heavily on various operations:


The main issues are obviously the simulation and the rendering, and they are definitely two separate issues. For simulation, it's a matter of finding the software program that achieves the best qaulity results in the least amount of time. Learning software and testing the simulation are the big hurdles. With rendering, a potentially major hurdle is mental ray itself. I have heard that mental ray fights fluids and doesn't render properly, and moreover the mental ray to maya plugin does not support the particleSamplerInfo node, according to Peter Shipkov. I suppose there are ways around using the particle sampler via added attributes and expressions or direct connections, but it's still more work.

---------------

The heart of all fluid simulations is, of course, fluid dynamics. Fluid dynamics are based on fundamental laws of physics: conservation of mass, momentum, and energy. A fluid's main properties, velocity, pressure, density, and temperature, are used to define the behavior of the fluid at given points in time and space. Although fluids of course are made of discreet molecules, for the purposes of physical calculations this fact is mostly ignored and the fluid is assumed to be a continuous body.

Of course, computer scientists hate the idea of a continous body and tend to divide the fluid into discreet volumes, referred to as voxels. These, of course, are almost always much much larger than a single molecule of fluid. System's of energy, mass, and momentum are calculated for each voxel for each frame. Fluids, like all dynamic effects, are influenced by forces acting upon them, including gravity, turbulence, torque, and the like. Fluid molecules tend to want to stick together, and this stickiness is usually a controllable attribute of the fluid and/or particle system. Shading can be done volumetrically or using sprites for gases, or shaded and raytraced like normal geometry for liquids.

This is really really simplified, and I am not a scientist by any means. But I think a foundational knowledge is key to understanding the attributes, which in turn is key to understanding how to create a good fluid simulation.

Yay science.

No comments: