In this project, I created a ninja character, which was modeled and skinned from scratch through the application of Linear Blended Skinning (LBS) and Dual Quaternion Skinning (DQS) techniques, the character was enabled to interact with cloth simulations via martial arts movements. Additionally, to enhance the realism of the scene, simulation-based collision detection between cloth objects was incorporated.
To achieve these functionalities, I employed the following methods: Initially, the 3D modeling and skinning of the ninja character were carried out using C++ and OpenGL, ensuring the character's visual representation met the desired standards. The character model and movements were downloaded from mixamo.com. Next, the character's movements were made smoother and more lifelike through Linear Blended Skinning (LBS) and Dual Quaternion Skinning (DQS) techniques. Lastly, cloth simulation was conducted using the mass-spring model, combined with simulation-based collision detection to ensure natural and realistic interaction between the clothes and the character's movements. Collision Detection was achieved in collisions among character and clothes and also among different clothes by using spheres to approximate the ninja figure with particle collision constraints with bounding volume hierarchy(BVH) methods.
To simulate the interaction between the ninja character and the clothes, one common approach is to use spheres to approximate the ninja figure. I first managed to figure out the intuitive positions of the rigs of the ninja character by viewing them in Blender, then I used the positions of the rigs data to create spheres to approximate the ninja figure. BVH methods were used to manage the spheres to enhance the efficiency of collision detection. To simplify the problem, I only considered the collision between the ninja and the clothes, and the collision between the clothes themselves. Also, I used a well-built BVH library to utilize BVH methods.
In addition to all above, to further improve the realism of the scene, I also implemented the collision detection between the clothes themselves. The collision detection between the clothes themselves was achieved by using the same algorithm as the collision detection between the ninja and the clothes by checking the collision detection among particles of different clothes. This algorithm describes the process of detecting and handling collisions between two simulated cloths, using a mass-spring model. It checks every pair of particles from both cloths and applies a correction if they are found to be colliding:
Input: Two Cloth Objects - cloth1, cloth2
// Iterate through particles in cloth1
for (auto& p1 : cloth1.particles) {
// Iterate through particles in cloth2
for (auto& p2 : cloth2.particles) {
// Calculate the distance between the two particles
Vector3d delta = p1->x - p2->x;
double distance = delta.norm();
double collisionThreshold = p1->r + p2->r;
// Check if the particles are colliding (you can adjust the threshold)
if (distance < collisionThreshold) {
// Calculate a collision response (you can adjust the response behavior)
Vector3d collisionNormal = delta.normalized();
double overlap = collisionThreshold - distance;
Vector3d correction = 0.5 * overlap * collisionNormal;
// Move the particles to resolve the collision
p1->x += correction;
p2->x -= correction;
Considering the computing cost, complexity and time constraint, I did not implement the self-collision among particles within a single cloth. However, this is a very important feature to be implemented in the future which I think has great significance in improving the final product effect. I'll try to implement this feature in the future.
In this project, I only used spheres to approximate the ninja figure, which is a very simple and crude approximation. In the future, I'll try to use more sophisticated methods to approximate the human figure, such as using cylinders to approximate the arms and legs. Also, I'll try to design and simulate more sophisticated garments, such as a jacket with sleeves and apply them on human figures.
Character model, animation & skinning .fbx files were downloaded from mixamo.com.
BVH library
Fbx-extract is used to extract obj as well as skeleton and motion info from .fbx files.
Other references are listed below.
@article{article,
author = {Kavan, Ladislav and Collins, Steven and Zara, Jiri and O'Sullivan, Carol},
year = {2008},
month = {11},
pages = {},
title = {Geometric Skinning with Approximate Dual Quaternion Blending},
volume = {27},
journal = {ACM Transactions on Graphics},
doi = {10.1145/1409625.1409627}
}
@inproceedings{Provot1997CollisionAS,
title={Collision and self-collision handling in cloth model dedicated to design garments},
author={Xavier Provot},
booktitle={Computer Animation and Simulation},
year={1997},
url={https://api.semanticscholar.org/CorpusID:7421415}
}