Multi-Resolution Cloth Simulation

This was developed for my BSc Computer Games Programming final project. My aim was to develop something novel in the area of cloth simulation, and I would like to say that I had succeeded. The principle behind the project was to defer complex calculations used in cloth simulation to lower detailed copies of the same geometry, increasing both stability and processing time. The rest of this article will not delve into detail, but instead consolidate blog entries written during the project itself, in addition to some extra details.


After concluding my studies, my project supervisor and I both worked on a paper together that expanded upon the BSc project. The paper, Interactive Thin Elastic Materials for Virtual Reality Applications, can be found in my publications section. The video accompanying the paper follows.


My project was hand-picked to be displayed at Teesside University's ExpoTees event - a gathering of the best students to showcase their work to industry. At ExpoTees, I had to professionally demonstrate my work to industry members and employers coming from a wide range of backgrounds. This meant that I had to be aware of how to explain the technology to both experts and novices in the field. At the end of the event, my project was nominated and successful in obtaining the Games Programming Award for the best programming work.

Log 1

This is the initial stage of my cloth simulation project. As is obvious from the following image, it is very rudimentary. The simulation itself uses springs on every edge, and those edges know which triangles they belong to. The normals of said triangles are used to calculate bending angles. The cloth simulation is affected by gravity, viscous drag, and wind, and has basic constraints. The strain limiting algorithm used is fairly rough, but appears to work well. The simulation is not limited to grid-based geometry, but is, however, easier to develop and debug with.

Log 2

The geometric detail has been significantly increased, as has the performance. The new geometry is at a resolution of 40x40, whereas the previous was at 10x10. Although it may be difficult to tell from the following image, lighting has been added to better differentiate the curvature of the cloth. The strain limiting algorithm has also been rewritten and uses multiple passes to ensure a stable simulation. Constraints are also modified in line with the new strain limiting, as they were not compatible. Due to the high geometric detail of the meshes I would intend to simulate, coupled with the complexity of multiple strain limiting passes each frame, I have decide to investigate multi-resolution algorithms. These algorithms involve projecting computation of expensive functions to simplified meshes along a hierarchy. This means that simulation can be run on a low-detailed mesh, and changes can be projected up to a higher-quality mesh. The simulation will most likely lose accuracy, but the trade-off of increased speed will be worthwhile.

Log 3

The majority of the changes were behind the scenes, primarily in the area of spring configuration. A new strain limiting algorithm has also been implemented, which is significantly more efficient than the previous iterations. Textures have also been added to the cloth, to make it appear a little more presentable, although the current image is a placeholder. Although currently incomplete, much work has been done on mesh simplification in preparation for implementation of a multi-resolution algorithm. Other meshes have been successfully tested, such as the Stanford dragon, a heart, and the Stanford bunny.

Log 4

Collision detection against spheres has been added, and the spheres can move around in real-time. The collision response is not yet perfect, but is most definitely a solid start. Similar to the last time, a large number of changed were behind the scenes; performance has increased significantly since the last version. The configuration and simulation code has been modified to support multi-resolution simulation. Projection between levels during the hierarchy is not yet implemented, though. The multi-resolution approach chosen should allow simulation of very highly detailed geometry, yet maintain an interactive frame rate.

Log 5

The underlying framework was previously based on a tutor's framework, but has since been completely rewritten from the ground up. This custom framework is better suited to my own needs, and I have full control over how it functions. The cloth simulation was not easy to port to the new framework, however. The loading and configuration of the simulation was previously rather inefficiently implemented. After troubleshooting through the difficulties, the simulation is dramatically faster in the new framework, with load times increased by up to five times. Many algorithms during the loading and configuration phases were completely replaced.

Log 6

Although incomplete, projection of detail between multiple levels of detail in the hierarchy has been started upon. The projection works by storing the barycentric coordinates of each point and the corresponding triangle in the neighboring level of the hierarchy, and then using those coordinates as weighting values, can project its information throughout the levels. The image below shows a fine mesh (right) and a coarse mesh (left), where the fine mesh takes its shape purely based on projection of velocities throughout the hierarchy. The coarser mesh is where the strain limiting algorithm is run.

Log 7

The integration method has been switched from standard Euler to Verlet. Much work was done to rewrite the simulation to accompany the new integration scheme. The strain limiter was yet again improves. Another major change was the resolution of the geometry, now measuring 90x90. Although it is not extremely detailed, it is much higher than the previously used values. The mathematics library has also been switched to my own. Although this is a risky move, it appears to be faster than the previous third-party library I was using. Angle preservation has also been fixed, which makes the cloth better retain its initial bending angles.