CS184 Lecture 14 summary

Dynamics

Last time we talked about dynamics, which covers the full gamut of physical motion, including Newton's laws, elasticity, friction, motors, muscles etc. We explored some of the complexity of basic 3D motion including simple ballistic rotation. One important characteristic of dynamic simulation, and one reason it hasnt been popular for animation, is that it exhibits chaotic behavior.

Chaotic behavior

Many simple systems, like multi-link pendulums, dont have a closed-form solution. Many dynamical systems lik these exhibit chaotic behavior. Chaotic systems have the property that their trajectories are aperiodic (not repeating) and their state is highly sensitive to the initial conditions. So a small change to the initial conditions of a chaotic system lead to large changes in the outcome over time. Also its hard to predict which changes in the input will cause a desired outcome. This is the opposite of what animators want.

For such systems, its  a good idea to run simulations with small random changes to the model. Because simulations are deterministic, you get the same outcome every time you run the simulation. If you ran a real chaotic system several times, you would almost certainly get very different outcomes each time. Making random changes to the model will give you a better idea of how the physical system might possibly behave. Video examples.

Particle systems

Interesting visual effects arise with systems of simple particles. For example, lots of small particles each executing a parabolic trajectory from the same starting point will simulate the dust cloud from an impact, or a volcano. The effect of many particles has a different character from a single-particle motion.

Simple cases:

In simple cases, closed-form paths can be used (e.g. parabolic for fountains or impact clouds). The variation between particles is accomplished by using random number generators to create variation in the initial conditions.

For more complex behaviors, e.g. smoke rising, random perturbations can be applied to move the particles around as they rise.

Particles will often have animated color information. Either they will be emissive for a while, as in sparks or a flame, or they may be diffuse white but transition to black, as in smoke or steam.

The trace of particle trajectories can be used to simulate hair or fur.

Interacting particles

Complex structures are possible when particles are allowed to interact with each other. Applying gravitational forces to a system of particles and allowing them to move for some time will produce galaxy or cloud-like patterns. To simulate such particles, dynamics is needed. That is, each particle remembers its own position (most particles are too small to bother with orientation), and motion is computed as the integral of force and velocity as we explained last time.

Galaxies:
Galaxies can be simulated by systems of particles with normal dynamics and gravity (which is the product of the masses divided by the square of the distance). The particles will coalesce into spiral and globular clouds. Their kinetic energy stops them from collapsing.
Clouds:
You can get cloud formations using a pairwise attractive force (gravity), some viscous drag (force proportional to the negative of velocity) and some repulsive force that stops particles from getting too close. The attractive and repulsive force can be combined into a single pairwise force that you save with discrete samples in a table. You could recover the force values using a FloatInterpolator.

Flocking Behavior

You can get very interesting aggregate behavior from particles (or actors) running simple individual behaviors. One advantage of flocking systems is that the actors only sense the behavior of a few nearby actors. With gravity, every particle needs to be aware of all the other particles. So computing each time step for a system with N particles takes O(N2) time. For a flocking system, each actor only needs to know the behavior of a nearby actor, and you can compute the next time step for all the particles in O(N) time.

Control Systems

To control an individual actor, you would apply forces to it that will move it close to an ideal position. The ideal position is typically a displacement from one or more of the nearby actors. This amounts to a simple control system. Suppose the ideal location of the actor is x'. Its actual position is x. The force you apply to it would be

F = k(x' - x)

Unfortunately, if you apply only this force, the system will oscillate. The equation above decomposes into a constant force plus F = -kx which is the equation for a mass-spring system. To prevent this, you can add a damping force:

F = k(x' - x) - b(dx/dt)

This models viscous drag such as air drag or fluid drag and causes the actor to lose energy as it moves. Small damping allows the system to oscillate a little. Too much damping will make the system respond slowly.

You can use discrete-time integration as described last time to compute v from F, and to compute x from v.