Passive Squash & Stretch
The first thing you should ask yourself when animating a deformation is whether it should be active or passive. I call a deformation passive when it is solely the result of outside forces. In this case, the dominant factor for the deformation is inertia. To understand how inertia deforms your object, it’s best to think of it as a collection of smaller objects, like little boxes – or pixels.
Each of these boxes can be compressed or stretched when the neighboring boxes push or pull it. In engineering, this concept is called Finite Element Method or FEM and is used for all kinds of simulations, but I also find it very helpful for understanding Squash & Stretch. So, let’s first take a look at the part where the box is pushed up.
The boxes at the bottom are pushed upward, but they have a lot of inert boxes on top of them that aren’t willing to move in the same way. For this reason, the boxes at the bottom are compressed. They want to preserve their volume, so not only do they get flatter, they also grow on the sides. Note that you don’t need to treat this preservation of volume with a great deal of accuracy. In the third frame, where the boxes are compressed the most, they would need to be much wider to completely preserve their volume – however, this is not the goal. Keep in mind that when things become much flatter, they also get wider, but making them just a little bit wider is often ok. In reality, things also don’t preserve their volume. They preserve their mass, but they can usually be compressed to some extent. So when the box is pushed, some of its matter moves to the sides while at the same time it’s also compressed, meaning it effectively has less volume than before.
Why are the boxes less compressed in the upper rows? Well, the higher we go, the less boxes there are on top. So, the total inert mass that resists the push is smaller, and thus so is the pressure on those boxes.
After the push is completed, the boxes are flying in the air and the pushing force doesn’t exist anymore. So, during the flight all the boxes relax again and go back to their normal, square shape. Engineering distinguishes between plastic deformation and elastic deformation. While a plastic deformation is permanent, elastic objects go back to their original shape as soon as there is no longer a force preventing them from doing so. But is there really no longer any force? Well, there is one – gravity! This causes the upward movement to slow, and pulls the boxes towards the ground. But this downward force supports the relaxation of the boxes, rather than preventing it.
Let’s take a look at gravity in a bit more detail to understand what’s going on when the boxes fall down again.
In this example, it looks like gravity is pulling the boxes at the bottom downward. The rules of inertia still apply: when the boxes in the bottom row move down, the boxes in the upper rows aren’t willing to follow immediately, and as a result the boxes get stretched. Is this realistic? No. In reality, gravity would act in the same way on all boxes, so it’s not just pulling the boxes in the bottom row, but instead evenly pulling all the boxes downward. So, there should be no reason for a deformation at all. If there is anything that could cause a deformation, it would be drag. Drag acts mostly on the boxes in the bottom row, decelerating them. Because of this, they should be squashed but not stretched. If you want to understand more about how drag deforms objects, Google the real shape of a rain drop (no, it has nothing to do with the classic teardrop shape). Here’s a comparison of our physically wrong stretch (left) and a realistic squash based on drag (right):
The right one is definitely more realistic. But why does the stretchier variant on the left look so appealing if it’s physically wrong? Well, animation isn’t only about reality. You have a lot of artistic freedom, and one of the things that humans like is exaggeration. The left-hand variant looks like an invisible hand (or whatever kind of force) is actively pulling the bottom row downward. This overstates gravity and gives the movement more intensity. Know the rules – but don’t be afraid to break them. It’s very helpful to know about reality, but keep in mind that the ultimate goal is not to be realistic but to create something appealing.
Now, let’s analyze what happens during the impact. First note that for the boxes the impact is completely unexpected. So there is no anticipation of the landing, no easing into the landing pose or any kind or preparative deformation. When the impact happens, from one frame to the next there is a heavy deformation. The boxes in the bottom row have to stop abruptly, but due to inertia, the boxes above them don’t stop so quickly and compress the boxes below them. This compression is most intense for the bottom row and gets less intense for the rows above it, since the higher a box is located, the less mass it has above it to press it down. After all boxes have stopped, there is no longer a force acting on the boxes and they all relax into their default square shape again.
The idea of subdividing our object into individual boxes also helps us to understand overshooting. Overshooting happens when an object stops abruptly, but due to inertia some parts of the object continue their movement and so overshoot. Here are a few examples:
In these examples, the white box is the one that stops immediately, while everything else overshoots. Depending on the material, an overshoot can have more or less damping. In the example, when the object stops on the left side, it has a lot of damping so it just overshoots once. When it stops on the right side, however, it has much less damping so when it moves back after an overshoot, it overshoots again in the opposite direction, resulting in a swinging movement that slowly decreases.
When you analyze the movement of the individual boxes, you can see that the further away a box is from the white one, the more it overshoots. You can think of the white box as an anchor; the forces that drive the animation move this anchor, while everything else follows with some inertia. An object can have more than one anchor - if the object hits the ground, everything that touches the ground becomes an anchor, for example, because contact with the ground is what makes the object stop.
The Bottom Line: when animating deformation that’s based on inertia, think about which forces cause the movement in your scene and on which parts of the object they act. All other parts will then follow sluggishly, and depending on the situation this can lead to squashing, stretching or overshooting.
Create animations with Squash & Stretch in no time with a collection of ready to use behaviors, carefully handcrafted by professionals and controlled by an intelligent system – ensuring your animations come to life without starting from scratch each time.