This may come as a shock to some, but the world is not made up of corridors composed of completely planar surfaces. We live in a wildly organic place. Hills roll, muscles bulge and fountains splash. The world around you is filled with organic shapes which cannot easily be created out of triangles.
In fact, many of these objects are not even just lying around looking all organic. They slop, splash, waddle, and plop about you all the time. Many shapes around you are even in motion. These objects change shape effortlessly as you game artists crumple under the pressure of having to model such phenomena. When was the last time you saw a nice splashing fountain in a game, anyway?
Animators have faced the challenge of visually creating the organic world we live in for some time now. To help them out, commercial modeling packages have provided the artist with tools for creating organic shapes. One of the methods for creating organic objects is through the use of blobby balls that can be combined together to form a clay-like sculpture. The commercial animation package developers have realized the usefulness of this technique and coined all sorts of proprietary terms for their version. You may have seen ads for meta-balls, meta-clay, blob-modeling, and various other ways of combining the term "meta" with some form of goop.
The "meta-goop" seen here produces
results that are difficult to create with
traditional modeling techniques.
To create an object from this meta-goop, an artist drags around primitive elements, usually spheres, which represent the rough shape of the object. Each of these elements has a center position and several parameters associated with it. These parameters define how the element will interact with the particles and world surrounding it. You can see an example structure for a meta-goop particle in Listing 1.
Listing 1. A Meta-goop Particle.
The position describes the center of the element. I also need to keep track of the radius of influence of the element (actually squared so I save some math later) and the strength of the element. This strength parameter defines how the element will affect the space surrounding it.
interact with each other by creating an energy
field around them. This is similar to the way planets create a gravitational field for a solar system. It is possible to evaluate the energy of the system at an arbitrary point in space. The formula to determine the amount of energy that an element contributes to the point is given as:
= squaredDistance(&goop-> position,&testPosition);
if (distance < goop->radiusSquared)
falloff = 1.0f - (distance/goop-> radiusSquared);
fieldStrength += goop->strength * falloff * falloff;
By running this formula over all the elements in your system, you get the exact field strength for that position. The energy field creates some interesting data but is not much of an object. What I want to create are particles that will visually grow together as they get closer. You can see an example in Figure 1. In order to create an object that will show this visual aspect of the energy field, it is necessary to define a value that will represent the outer shell of the object - the threshold.
Figure 1. Our goal is to make our three particles visually grow together as they get closer to one another.
The energy field varies in strength from zero on up at any position you may evaluate. In fact, there is nothing to keep you from defining negative strength for an element, creating negative regions, or holes, in the energy field. This is useful for effects such as denting and the like. To define the surface of the object in the field, I can set an arbitrary threshold giving the object its final shape.
Figure 2. Creating a boundary threshold in a 2D energy field.
The threshold value defines the boundary between the area inside and the area outside the shell of the object. Figure 2 shows how an example threshold value creates a boundary in a 2D energy field created by three meta-goop entities.
By adjusting this threshold value for the energy field, as well as adjusting the strength, position, and effective radius of individual entities, a great variety of objects can be created. But I still need to talk about how.