Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
Sponsored Feature: Multi-Core Simulation of Soft-Body Characters Using Cloth
arrowPress Releases
July 24, 2021
Games Press
View All     RSS







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Sponsored Feature: Multi-Core Simulation of Soft-Body Characters Using Cloth


December 10, 2008 Article Start Previous Page 4 of 4
 


Figure 10: Intel® Thread Profiler visualization of the threaded cloth Calculation

Figure 10 shows the results of the threading effort as portrayed by Intel® Thread Profiler. The Intel Thread Profiler is a threading visualization and debugging tool that makes it straightforward to verify the effectiveness of a threading strategy. Each horizontal bar represents a thread, and a dark green area on a bar represents active computation being done by that thread. Thread sleep and blocking is represented by the pale green color. These screenshots were taken on a four-core processor.

Figure 10 shows a transitional point in the demo where the user has been running in a single-threaded mode, but has just switched to a multi-threaded mode. Initially, on the left side, one thread is doing all the computation. The active work is followed by an artificially added gap - this gap was intentionally introduced to the demo to represent the other computation typically performed by a game. The goal is to minimize the amount of time that the main thread is busy, and to ensure that the other threads are able to do useful work during this gap.


Figure 11: The fully parallelized calculation visualized in Intel Thread Profiler

Figure 11 shows that, after some initial work by the main thread, three other threads are becoming active. This is the defer-and-parallelize approach that was presented earlier. Threading Building Blocks has created three threads to accompany the main thread for a total of four threads on this four-core processor. The force calculation has been broken up into four equal pieces, and is being computed during the artificial gap introduced in the main thread. The work is divided into four pieces so that if the main thread completes its work before the computation on the other threads is done, the main thread can take on part of the computation, too.

Since users have a variety of hardware options, it is necessary to simplify the calculation for users with single-core CPUs. One method is to ignore the cloth forces and instead apply a simplified positioning of points in the mesh. Another option is to use a conventionally animated bone-and-skin model for users with single-core CPUs. Since both models will render the same number of triangles, users with multi-core CPUs get the full animation without significant impact to frame rate.

The demo of these techniques is a very simple one, and there are a number of improvements that could be made. Presently, the models in the demo are all defined mathematically - they are not output from a modeling tool in the conventional art pipeline. Thankfully, there are no real barriers to using a character modeling tool to output a soft-body character, since most of them already allow attaching of cloth to a bone-and-skin model. By putting the modeling emphasis on the cloth instead of the bones, a soft-body character can be created.

On a math note, many cloth simulations use a more optimized technique of simulation called Verlet integration. This technique makes some assumptions and uses some simplified math to allow the forces to be calculated more rapidly. Those assumptions and math work best when the framerate stays within a narrow band. Since this demo was designed to have wildly differing framerates (when switching between single-threaded and multi-threaded modes), the demo uses a very literal implementation of the underlying math. Games that use cloth-based characters are usually able to tune a Verlet integration for a targeted framerate and it will look right.

Soft-body physics have been used to good effect in many modern videogames. As appealing as the effects are, they have been limited to light use due to the computational intensity required. With an algorithm modified to take advantage of the computational power of multi-core CPUs, it is possible to simulate entire soft-body characters. A simple cloth simulation is straightforward to adapt in this fashion, and can be expanded to support the creation of expressive soft-body characters.


Article Start Previous Page 4 of 4

Related Jobs

Insomniac Games
Insomniac Games — Burbank, California, United States
[07.23.21]

Technical Artist - Pipeline
Insomniac Games
Insomniac Games — Burbank, California, United States
[07.23.21]

Engine Programmer
Legends of Learning
Legends of Learning — Baltimore, Maryland, United States
[07.23.21]

Senior Gameplay Engineer - $160k - Remote OK
Bytro Labs GmbH
Bytro Labs GmbH — Hamburg, Germany
[07.23.21]

Senior Product Owner / Live-Ops Owner (f/m/x)





Loading Comments

loader image