Computer Animation Simulations

This coming Tuesday, I will be taking my “prelim exam”, which is an exam that I have to pass at some point to continue as a graduate student.  For this exam, I need to know a little bit about everything in computer graphics and will have to answer questions for an hour and a half.  For the first part, I get to present a paper, and I have to be prepared to answer any question about it.  To help prepare myself for this, I’ll summarize the paper for you all, and hopefully I’ll be able to explain it in terms that anyone can understand.

The paper I’ll be presenting is called Unified Particle Physics for Real-Time Applications, and here’s a video showing their results:

My favorite part of the video is when they pop the water balloons.

Anyway, this paper describes a method to create physical simulations of solid objects, liquids, smoke, cloth, and any other similar things.  On top of that, they are able to run this simulation at interactive speeds, which means that these simulations are capable of being run in games.  The main component of these simulations is the particle, which is simply a point that has a 3D position, a velocity, and a mass assigned to it.  This image shows the one frame in the simulation next to a visualization of the particles where each particle is shown as a sphere.

This simulation runs by creating a set of particles in this virtual world and defining a set of constraints on the particles that restrict how they move.  These constraints are equations that can be used to describe how the particles should behave.  For example, one constraint could be that the position of two particles should always be at least a certain distance apart.  The constraint would then check that the distance between the two particles and would move them away from each other if they were two close.  Constraints are used to create all of the effects shown in the video, and I’ll describe how they use these constraints to simulate all of these things.

The first step of the simulator when it updates the position of all the particles from one frame to the next is to apply external forces, such as gravity, on the particles.  This is used to update the velocity of the particles, and then a new position is predicted for each particle by moving the current position by the particle’s velocity according to the kinematic equations from physics.  Next, the predicted positions are used to which particles are colliding with each other and other things in the scene such as the ground floor.  Next, the simulator fixes these collisions by calculating how far it needs to move each particle from their original positions (before applying forces) so that they’re just barely not touching or colliding with anything.   It then updates the original position and the predicted position by the amount it needs to move each particle.  They use the original position for fixing collisions rather than the predicted positions to avoid creating errors in the particle’s velocity.  If these errors were created, then a particle, for example, might fall to the ground then might unrealistically bounce back up at a faster speed than it was falling.  Once the collisions have been fixed, the simulator then fixes any other constraints that might be imposed on the particles, which updates the predicted positions of all the particles.  Once they have the new predicted positions, the particles’ velocities are updated based on the difference between the original and predicted positions, and finally the particles’ positions are moved to the new predicted positions.

Solid, rigid objects in the scene are handled by filling them with particles and remembering the original orientation of the particles in the shape.  The simulator lets them behave like separate particles free to do whatever they want.  Once all the particles have been moved and adjusted to fix collisions, a constraint is added on all the particles making up the object.  This constraint finds the best way to move the particles back to their original orientation relative to each other such that it looks like the object as a whole is moving and rotating but the position of the particles within the object don’t change.  Collisions between other particles and any particle that makes up the object are handled by pushing the other particle in the direction of the surface of the object.

Fluids such as water as shown in the picture above are also handled with particles.  Like all other particles, these particles in a fluid are affected by gravity and are adjusted to avoid collisions with each other, and in this case, with the bunny placed in the liquid.  At the beginning of the simulation, they record the original density of the fluid, which is measured by counting the number of particles withing certain volume in the liquid.  When the simulation starts, one constraint is added to each particle in the fluid that forces the density at each point in the fluid to be at most equal to the original density.  With this one constraint, the simulator can create the effects of liquids shown in the video.  When a particle is near a solid object, the simulator needs to account for this non-fluid object when calculating the density; otherwise, it will incorrectly think that particles near these objects have a smaller density.  In addition, the effects of objects floating in the liquids comes without any extra work if the mass of the particles in the solid object and the fluid are used for computing densities.  If the density of the object is less than the original density of the liquid, then the particles in the fluid will push up on the object, just like it does in the real world.

The way this simulator handles fluids is also used to simulate with a few extra additions.  There are two ways to simulate the smoke.  The first method is to use closed boundaries, which is more physically accurate but takes more time to simulate on the computer.  The second method uses open boundaries, which is faster and less accurate.  The animation shown above uses an open boundary fluid simulation.  A closed boundary simulation works by filling a box or some other “closed” volume with particles.  The particles are treated as a fluid, so they move around in the box keeping the density no greater than the initial density at the start.  They then look at particles near the source of the smoke and reduce gravity for these particles so that they rise to the top.  Once this has been set up, the simulator begins to add special smoke particles that are used to visualize the smoke.  These smoke particles are added at the source of the smoke and only move based on the velocities of the particles nearby.  These aren’t affected by collisions, gravity, or any other constraints.  The whole effect of the smoke comes from these particles moving around the closed volume based on the fluid particles’ velocities.  When the scene is shown, the fluid particles are not displayed, and smoke particles are used to create the final result of the smoke.

In an open boundary simulation, the fluid particles only exist where the smoke particles exist.  This greatly reduces the amount of particles required to create the smoke effect, which makes everything run faster, but special constraints and forces need to be added to create a realistic-looking effect.  Like the closed boundary smoke simulation, smoke particles are created from the smoke source, and fluid particles are also created here, too.  These fluid particles are later removed when there are no nearby smoke particles to reduce the number of unnecessary fluid particles.  To create the smoke-like effect, two forces are added.  The first force is a drag force, which slows down the fluid particles near the edge of the smoke surface while the particles near the inside move faster.  The second force is a special vorticity force that give the smoke a curling effect near the edge of the smoke.

The last thing that they simulate is cloth and ropes.  A cloth is modeled by creating grid of evenly spaced particles on a surface and adding a constraint to all the particles.  The cloth-like effect is created by adding a constraints that force each particle in the cloth to be a specified distance away from all of the neighboring particles.  This is not quite physically accurate since it doesn’t account for stretching cloth, but these constraints are ideal since they are fast.

In this example, the water balloons are made of cloth and are filled with a fluid.  When the balloons pop, they remove constraints on some of the particles in the cloth which creates an opening for the fluid to flow out.

I hope my explanation was clear enough and that you enjoyed learning a little bit about particle simulations.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s