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
339 stars 31 forks source link

Some question about the warning in /src/code/simulation/Triangle.cpp #17

Closed BingyangZHOU closed 1 year ago

BingyangZHOU commented 1 year ago

Hi, I notice some warning detection code in /src/code/simulation/Triangle.cpp as follows:

if (angle < 20) {
  std::printf("WARNING: MESH TOPOLOGY: angle between point %d-%d-%d is %.2f degree\n", id1,
              id2, id3, angle);
}

if (area_rest < 0.001) {
  std::printf("WARNING: MESH TOPOLOGY: Triangle (%d, %d, %d) has area %.4f\n", p0_idx, p1_idx, p2_idx, area_rest);
}

When I try to load my obj file into obj DiffCloth, the output of such warnings is numerous. I wonder if it is necessary for me to modify my obj file to pass the warning detection in order to simulate them in DiffCloth correctly. And does it mean the triangle area should be more than 0.001 m^2 and three angles in each triangle are more than 20 degrees? Thanks^^

BingyangZHOU commented 1 year ago

And should all the faces must be triangles? Can the faces be only quards or combination of triangles and quards? If so, for quards,are there similar limitation of area and angle like triangles?

omegaiota commented 1 year ago

Hi, Currently ths algorithm only allows for triangle meshes, and it is recommended that you remesh your obj file (with mesh processing softwares, e.g. the Iso Parameterization Remshing function in MeshLab which is what I used or similar functions in Blender) so that most triangles are close to equilateral triangles, otherwise the simulation quality will be very poor (artifacts, non-convergence, contact penetration etc). Let me know if you have other questions.

BingyangZHOU commented 1 year ago

Thanks for your reply. Can I say that a mesh of equilateral triangles which are similar in area size is the best?

omegaiota commented 1 year ago

yep!