The Motion Dynamics of Snakes and Worms

Reference: Gavin S.P. Miller, "The Motion Dynamics of Snakes and Worms", Computer Graphics 22:4, pp. 169-173, August, 1988.

Introduction

It is difficult to realistically model biological forms. The creatures should look realistic both statically and dynamically. In this paper the relatively simple forms of snakes and worms are modeled using physics.

Animals have a strong emotive effect on audiences and are usually perceived as either lovable or frightening. Thus they are very popular in animations, or in films in general. But, they are difficult to train. Puppets have been used but this is also not fully satisfactory since they require alteration with every frame. Animals change shape with every frame and this should be done automatically. For example, snakes deform elastically when external forces are applied.

Modeling Elastically Deformable Strands

We can use a simple model of the internal structure of a snake or worm. Each segment is modeled as a cube of masses with springs along each edge and across the face diagonals. At each time interval the forces exerted on the masses at the end of each spring can be computed by the formula:

f = k*(L - l) - D*dl/dt f = force along the spring direction
k = spring force constant
D = the damping force
l = current length of the spring
L = minimum energy spring length. Note that L can be animated as a function of time to model muscle contractions

Gravity was added to this equation and the acceleration, a, was computed by:
a = f/mass. Then the new position was computed by integrating the acceleration twice with respect to time:

We also need to consider external constraints, e.g., the ground, a wall, etc. Impulse-based collisions detect whether a point intersects a surface, and if so, then it computes the new position and velocity analytically as shown below.

Sharp discontinuities need to be tested against the cube edges as well as the vertices, so to avoid this, his paper only considers two types of constraint, a horizontal floor and a rounded cliff edge.

Muscle Contraction and Directional Friction

Forces must be exerted on the system to make it move. To be realistic, the motive forces must be generated internally and then the system will use friction and constraints and shape changes to move. With humans, the frictional forces are isotropic, i.e., sliding a foot forward causes the other foot to slide backwards. That is why we must lift one foot to reposition it while the other foot remains static. But snakes and worms remain in contact with the ground and can have anisotropic frictional forces because of their scales. When sliding forward the frictional forces are minimal, but when a body segment slides backward, the scales dig in and the frictional force becomes very large. Below is a figure of a one spring, two mass worm.

When the spring is expanded (l increases) scale B slides over the ground and scale A grips the ground. Then the spring is contracted and scale A slides and scale B digs in and grips. So changing (oscillating) the spring length will result in forward motion.

A real worm consists of many segments like the above. To prevent having only one scale gripping, the worm sends a wave of compression from its head to its tail. In a real worm, the wave is a square wave. However, with the simple spring-mass model, a square wave creates shape distortions and a sine wave works better and looks more realistic.

They modeled the directional friction as follows. The local forward spine unit vector S was computed by:

S = (Xp+1 - Xp-1)/ (|Xp+1 - Xp-1|) where Xp is the center position of segment p

So S is the direction the worm is heading (it does not go backwards).

Then the velocity is set as:

if (S*V < 0.0) then V = V - S(S*V)

This stops any backwards sliding of the worm. This is applied only if the point mass is close to the floor, i.e., in "contact" with the floor.

In a real worm the muscles bulge out as they contract. This was modeled by keeping the volume of each segment constant, i.e., 1/(l)1/2 was used to scale L for the springs around the worm circumference. So as l decreases for the "forward" springs, then L increases for the circumference springs.

Snakes

Snakes are quite different internally than worms, since they have ribs attached to a flexible backbone. The worm motion described above is called "rectilinear progression" and can be done by a sliding its skin over its ribs. The more familiar horizontal motion of a snake is called "horizontal undulatory progression".

This is simulated by sending compression waves down the body, as with the worm, but the springs on the left side are 180 degrees out of phase with those on the left side, i.e., one side is expanding while the other is compressing. This bends the snakes into waves. As with the worm, directional friction causes the snake to move forward. If the snake has a good grip on the ground then the body segments all follow the same path. If the snake has a poor grip on the ground then the segments move sideways, causing a "sidewinding" motion.

The "sidewinding" motion occurs with real snakes when they don't have good contact with the ground, e.g., sand. The snake also partially lifts itself off the ground to reduce thermal contact and increase the pressure on the remaining part. This is simulated by adding a vertical sinusoidal flexing that is 90 degrees out of phase with the horizontal waves. This raises most of the snake off the ground. The wavelength used was the length of the snake divided by 1.4

Sample Parameter Values

Animal: Spring Strength (k) Damping
Worm 1.5 0.9
Snake 0.5 3.5
caterpillar 0.3 0.6

Since the snake tail moves from side to side, it requires a greater damping force or else standing waves appear.

Rendering the Animals

The lattice of masses was used to create control points for bicubic parametric patches. The worms were rendered using a color map and a bump map (for the wrinkles).

A good examples of this is:

"Eric - The Dynamic Worm" from the animation   "Natural Phenomena" by  Gavin Miller in SVR 39 (SIGGRAPH 88 Film & Video Show).

Another example is "Her Majesty's Secret Serpent" - done by Gavin Miller at Apple Computer.  SVR Issue 51 (SIGGRAPH 89 Computer Graphics Theater)

Here is a link to some more recent work  by Dr. Gavin Miller.


Artificial Life in Computer Graphics
HyperGraph Home page.

Last changed February 08, 2000, G. Scott Owen, owen@siggraph.org