In part 1, we implement basic springs and point masses and properties thereof. Springs connect point masses in various ways, and are acted on by various forces, primarily gravity, and then interactions with one another. We evaluate the sum of all forces on a point mass and integrate this in order to determine the new position of the mass, then adjust it for collisions with itself and other items in the scene.
In the following images, the springs are represented as the white lines in space. In the following image, all the spring types are visible.
In this image, only the springs that control bending interactions are visible - they connect point masses that are two units apart from one another in the left and up directions. This can be seen as some lines skip a point in between the ones that they connect.
From afar, all the springs:
From afar, only the springs that control shearing interactions:
From afar, all but the shearing springs:
In part 2, we actually implement the more advanced force interactions described before. In particular, we calculate the sum of the forces acting on the point masses, then, we use Verlet integration to approximate how much exactly those forces change the position of the point masses, and then constrain those position updates to be reasonable within the bounds of the springs we’re using to animate the figure. Various other factors come into play at this stage, such as the value of the spring constant that controls the displacement of our springs, a damping factor that emulates losing energy to the rest of the system, and a value representing the density of the simulated material.
Given the default parameters, this is how the
pinned2.json object looks like:
This is what happens when we modify some of the parameters.
Decreasing the spring constant (in this case,
ks=0), causes the cloth to have no shape after coming to rest - all the point masses are collinear with one another. This is because the effect of the springs has been negated entirely. It can be seen that this image is basically 2D rather than having any depth, as in the previous image.
As we increase the value of the spring constant, while the images converge at approximately the same shape as that of the image with default parameters, they do so at different rates and with slightly different mechanics.
ks=50000. In this image, the high spring constant creates more ripples in the lower part of the cloth.
As cloth density increases (holding
ks constant at the default value), the mechanics of the cloth movement begin to change. In particular, it becomes harder for spring interactions to deform the cloth. This image is taken with
density = 50 g/cm3
This image is taken with
density = 1000 g/cm3. Except for close to the pin points themselves, at this high density, spring effects are effectively eliminated.
This image is taken with increases damping factor. As the damping factor increases, the movements at each step get slower. This picture is taken with
d=0, the image rapidly undulates around the pin points, slowing my computer down enough that I wasn’t successfully able to take a screenshot of it without my display manager freezing.
In part 3, we implement object collisions.
As one can see, as the spring constant increases, the stiffness of the cloth does as well. It holds more of a plane-like shape the higher the spring constant is, and droops more the lower it is.
Here it is lying on the plane:
In the following images, the cloth can be seen at various stages of fall (not self-colliding!)