Code Monkey home page Code Monkey logo

omegaiota / diffcloth Goto Github PK

View Code? Open in Web Editor NEW
337.0 16.0 30.0 251.63 MB

Code repository for our paper DiffCloth: Differentiable Cloth Simulation with Dry Frictional Contact

Home Page: https://people.csail.mit.edu/liyifei/publication/diffcloth/

License: MIT License

CMake 0.52% Python 3.05% C++ 61.37% C 33.90% GLSL 1.16%
cloth-simulation differentiable differentiable-physics-engine differentiable-programming differentiable-simulations inverse-dynamics inverse-problems physics-simulation simulation simulator

diffcloth's People

Contributors

omegaiota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diffcloth's Issues

Where do you get your bending energy formulation from ?

Hi! I'm a beginner of computer graphics. I'm watching your code about bending constraint and notice that your defination of bending energy is defined on each dihedral angular structure. I haven't learn this kind of defination before (I only knew use mean curvature to define bending energy). Could you give any explaination about this? Or tell me what article you got this idea from.
thanks!

Simulation with dirvenable human model

Hi author,
Thx for your great work on cloth simulation. Since there are many ways to reconstruct dynamic human geometry along with cloth parsing masks. I wonder can this work simulate cloth given a sequence of dynamic human 3D models?

Possibility of visualize frame by frame?

Hi, Yifei, thanks for your awesome work and the release of the code!
I notice that when visualizing my generated .obj files by the bash command you provide, the viewer will automatically begin and if and only if I press [space], it will stay at the beginning frame. So I'm wondering can I play it frame by frame, such as whenever I press the -> button, it will show next frame; when I do not press any button, the viewer just stay at the current frame, so it's convenient for me to check whether the simulation is within my expectation?
Thanks for your reply!

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

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^^

Tirangle_K optimisation

Hi,
Thanks for releasing the amazing work

I ran the tshirt demo, which optimises the wind and CONSTRAINT_TRIANGLE. However, the output log shows that the k_CONSTRAINT_TRIANGLE is barely moving. The reference uses 550 and with my seed, the K stuck at 1018. If I turn off the wind, the optimisation is instantly finished because the solver hit the one-iteration condition. I tried to use different initialisation bound, and I got no luck. I also tried with initial guess very close to reference, which is noticeably different from the different k, even though the loss both dropped to 0.2.

What might be the cause of k not changing?

  • it looks like it hits a local minimum, but all initialisation have similar behaviour.

Use c++17 std::filesystem

I think one easy dependency is to use c++17 std::filesystem instead of unix calls for the final goal of Windows support.

Let me know if you're interested in a pull request.

custom simulation instructions

Hi, I cannot find any instructions on using DiffCloth for other simulations apart from the one in your paper.
Can you share some basic instructions for setting up a custom simulation?

how to simulate my garment into DiffCloth

Hi! I tried to put my simulation data(obj files of t-shirt) into DiffCloth simulation. However, it did not work. I found out that your obj files are much larger than mine and vertices and triangles are much larger. I have a few question about this: 1. Is it possible to input my simulation data(obj files of t-shirt) into your simulation? 2. Should I input my depth images(png) of t-shirt into your simulator instead of inputting my simulation data(obj files). If that's true, where could I input my depth images, I did not find any code on this. 3. the process fails maybe because the difference of size of obj files. If so, do you know how to fix this or this is non-fixable. I am so sorry to ask a lot. I am a beginner for simulation and I really like your work. Please look at the comments when you are free. Have a wonderful day.

WeChat_20230215002700.mp4

微信图片_20230215002709
微信图片_20230215002713

Application Porting?

Hello,

Great results with the PD Cloth Simulation.
We're in the lookout for alternatives to use in Unreal Engine, will this be implementable to the Engine, as a 3rd party library?

Thank you.

Restore windows support.

Hi!

I spent some time getting Windows support.

main...fire:differentiable_cloth:drop_python

Maybe you have some use of this.

It's a bit messy.

  1. ran clang format
  2. skipped python integration
  3. use c++17 std::filesystem
  4. some changes to the cmakelist for glfw and glad
  5. misc new lines add to printed string
  6. the global enum POINT is already defined. Rename to CAMERA_POINT.
  7. Does not automatically do the required steps to copy glfw3.dll, libnangui.dll and libomp.dll to the build directory.
  8. Had to disable preview after every iteration because of a crash in the renderer
  9. Easiest was to upgrade nanogui for the glad deps

Question about cloth material optimization

Hi,
Thanks for the awesome work! I have a question regarding optimizing the cloth material parameters. I run the tshirt demo and dress demo, and it seems that the optimized K_triangle or K_bending is almost the same with the random assigned initial value. Does this make sense? Besides, in the dress demo, the density changes to min value (0.01) after the first iteration, but after that it becomes larger again and the dress angle decreases, which seems weird. Could there be something wrong with my code or configuration?

Possibility of adding more obstacles?

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.

  • First, if I add obstacle by inheriting Primitive class, set its mesh and implement collistion detection function isInContact, what should I do to ensure the collision detection function is differentiable becuase I think the collision detection function is (or not?) in our computational graph?
  • Second, as a specific case for the first question, how can we implement the isInContact for CUBE, which is included in the enum PrimitiveType but is not implemented?
  • Third, is there any possibility of adding some complex obstacles not by analytical setting the mesh like Sphere, but by using a pre-provided .obj file?

How to set param in FabricConfiguration?

Hi, YIfei.

I'm tring to add a tie in this simulator and I notice that the simulation results differ greatly as I change params k_stiff_stretching, k_stiff_bending and density in FabricConfiguration (src/code/optimization/OptimizationTaskConfigurations.cpp), which are closely related to the material of cloth.

So, generally, how can I specify the value of these three params when I try to add a new type of cloth?

Pip subprocess error

Hi Yifei,

Thanks for sharing your wonderful work,
When I try to build python binding, I hit this problem:
Pip subprocess error:
ERROR: Could not find a version that satisfies the requirement diffcloth-py==0.0.1
ERROR: No matching distribution found for diffcloth-py==0.0.1

failed

CondaEnvException: Pip failed
When I dive into the conda env diffcloth, and try the cmd: pip install diffcloth-py==0.0. I hit the same error again.
So, could you give me some advice to deal with it?(my workstation is Ubuntu 20.04)
Many thanks,

-Leung

Run clang format over DiffCloth

I noticed that the code was a bit uneven and makes diffs difficult.

Would you be interested in a clang-format pull request?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.