Monday, October 4, 2010

SPH on iPad

I've just implemented my first SPH solver.  It's quite stable; and it runs at a decent speed.  I'm happy that it works; but haven't gotten to do much else this weekend.

My current solver is literally what Muller described in Particle-Based Fluid Simulation for Interactive Applications.  I don't want to go experimental on the first version, simply I'm searching for a feel on how the simulation reacts to stimuli; and what it might be useful for.

First, this is not behaving the way I expected.  The method, for lack of better words, uses a set of particles to approximate what occurs within the space.  I was expecting it to behave more like a massive cluster of discrete particles.

My issue is that density is computed based on the effect a particle has on other particles.

My interest in particle-based simulations is finite particles.  Essentially a ball-pit.  Cheaper-to-compute particles but more of them.  Essentially, massive atoms whose complex interactions yield fluid flow.  This experiment led me to a few conclusions which will dictate my next experiment.

First; pressure for incompressible flow - I believe - is very similar as to how balls in a ball-pit function.  As such, I'd look at the laws of rigid-body motion to do the pressure.  Namely, the forces arising due to collisions.  If no ball can enter the area of another ball, I've done it right.  But to make sure that human error wasn't the cause; I'll compare Muller's equations to those of rigid body motion to see how they differ.

Second; viscosity is a force that arises from interactions of nearby particles.  The motion should rub off.  For that, I'd use a simple area of effect - that is nearby (colliding) atoms have a given velocity, whose average is weighted and blended with the current atom's velocity.  The reason for limiting the area of effect to colliding particles is to ensure there is no "space" between atoms.  I'm aiming for a very fine approximation of fluid flow; not one that is coarse.

Third; I'm interested in non-uniform matter.  That is, each atom is not just water or air; but half could be water and half could be air.  The last thing I'd add to the system are springs.  Implicit springs to neighbours based upon stickiness factors.  I want goop.  Semi-solids.

Last; there are one-time springs - used for solids.  A coarse representation of glue.

Finally.  As I said, I should review the equations that I've implemented.  See and better understand how they compare to the equations for rigid-body motion before I build the next prototype.

Why SPH on iPad?  Doesn't it seem ridiculous?  Consider a video-game.  Right now we are stuck in a rut where things are coded for a purpose...  Wouldn't it be great to be able to paint properties of materials and let the game engine do the rest?  Clothes and fluids should be intrinsically the same material.

Or so I believe for now.  I'll comment on the next prototype...

No comments:

Post a Comment