Sunday, May 15, 2011

Houdini: Foam Pass for level set fluids

I've been using Exotic Matter's Naiad for water simulations, and apart from the main simulations, other layers are included, such as foam particles floating on the surface, as well as particles ejected away from the surface to simulate spray.

This experiment is an attempt at creating foam off a Houdini Level Set Fluid simulation (Note: Naiad uses FLIP fluids.)

Emission is basically scattered points on a  mesh that was converted from the fluid's main level set ("surface" volume: with a convert sop you can get a mesh). Two parameters are used to control emission regions; curvature (measure SOP) and velocity (lookup into velocity volumes).

These points are then used as for emission in POPs; this particle layer is relatively fast to simulate because it's all pops! Inside pops, there is a fake "advection" stage where the particles sample the velocity volumes from the base simulation, and uses that to move each particle to its new position.

This however will result in particles moving into positions below the surface, or a bit too high above the surface. Tests indicate this can be improved by a high resolution level set, but we all know how expensive those are ;-)

Instead, a VOP POP was created to move the points based on the gradient of the base simulation's distance field, and points are moved accordingly to whether they are negative or positive (i.e. negative distances moved towards the surface following the gradient vector; positive distance are again moved, but against a negative distance vector).

I have no idea about those spots that hang on the ceiling - there is a cull pass that removes particles if they are a set distance away from the distance field. Since those particles are hanging there, I'm assuming there are remnants of the level set that do not have velocities affecting them and not dissipated.

That's it for this experiment, maybe I'll look into it another day.


No comments: