omegaiota / DiffCloth

Code repository for our paper DiffCloth: Differentiable Cloth Simulation with Dry Frictional Contact
https://people.csail.mit.edu/liyifei/publication/diffcloth/
MIT License
358 stars 33 forks source link

Possibility of adding more obstacles? #7

Closed sihengz02 closed 1 year ago

sihengz02 commented 1 year ago

Hi, Yifei.

I have briefly looked through Primitive.cpp and Primitive.h and I have another question regarding to how to add other obstacles that are not provided by the simulator.

omegaiota commented 1 year ago

Hi,

sihengz02 commented 1 year ago

Hi, Yifei.

Thanks for your previous answer.

To the best of my understanding (sorry i'm new to simulation), the collision test in DiffCloth only supports detection between every point in the cloth mesh and the whole obstacle mesh (according to the Simulation::collisionDetection function in src/code/simulation/Simulation.cpp). It's more like the point cloud of cloth collide the obstacle mesh and it means that it do not support collison test between triangle faces.

So, how can the simulator detect the situation when one triangle edge in the cloth mesh penetrate into the obstacle?

omegaiota commented 1 year ago

In terms of solving collisions (as in resolving collision and cloth dynamics simultaneously at every time step), currently the framework only supports nodal contacts, (node-node, but not vertex-face or edge-edge). This is a limitation inherited from the simulation framework used by diffcloth (https://hal.inria.fr/hal-02563307v2/document Sec 5.4). However you can still add edge-edge and vertex-face for collision detections, and treat them as nodal contact constraints when adding them to the solver, which should still make collision handling more robust. Currently for collision detection I've only implemented nodal self-collisions and primitive collisions, which you probably already figured out. Let me know if you have any other questions.

omegaiota commented 1 year ago

I'm closing this issue for now. If you have other questions let me know.