Code Monkey home page Code Monkey logo

clothsimulator's Introduction

πŸ—‚Introduction

This is a GPU-based cloth simulator implemented by CUDA. The algorithm is based on ARCSim.

Changes

  • Fnet force output per node output
    • NOTE: Allowing remeshing to generate more than 10k nodes can significantly slow down the performance
  • Changed exporting to include obstacles.
  • Introduced a new command line flag (--no-export-obstacles) to disable the export of obstacle data during simulations.
  • Improved the naming convention for saved frame files, making it more intuitive and easier to manage.
  • Adjusted the replay function to accommodate the new naming convention.

For example, I used this plugin to bring the OBJs into Blender 3.6.

0001-0250.webm

πŸ›  Setup

Dependencies

  • OpenGL
  • GLAD (already in lib directory)
  • GLFW
  • jsoncpp
  • Eigen
  • CUDA

Note: If you're using Windows, vspkg is recommended to install dependencies.

Build

Run the following command in this directory:

mkdir build
cd build
cmake ..
make all

πŸ“‘ Usage

The simulator has 5 different modes. All the command mentioned should be run in this directory. Drop the --gpu parameter if you want CPU simulation.

Simulate

Simulate and display according to a configuration file.

Note: Currently, the simulate mode is not working due to an OpenGL issue.

./build/ClothSimulator simulate [config_file] --gpu

For example:

./build/ClothSimulator simulate conf/sphere.json --gpu

Simulate (Offline)

Similar to simulate mode, but will save cloth mesh for every frame to output directory. You can also disable obstacle data export with the '--no-export-obstacles' flag.

./build/ClothSimulator simulate_offline [config_file] [output_dir] --gpu [--no-export-obstacles]

For example:

./build/ClothSimulator simulate_offline conf/sphere.json output/sphere --gpu [--no-export-obstacles]

Resume

Resume and display a halted offline simulation.

./build/ClothSimulator resume [output_dir] --gpu

Resume (Offline)

Similar to resume mode, but will save cloth mesh for every frame to output directory. You can also disable obstacle data export with the '--no-export-obstacles' flag.

./build/ClothSimulator resume_offline [output_dir] --gpu [--no-export-obstacles]

Replay

Replay simulation result according to a output directiry. This mode has no GPU mode.

./build/ClothSimulator replay [output_dir]

πŸ“¬ Feedback

If you find any problems, feel free to raise an Issue or to contribute with a Pull Request!

πŸ“œ Credits

I am not the author of this code, I just made modifications. Full credits go to the original authors. The original GPU accelerated code can be found here.

If you use this code for a publication, make sure to cite the following papers:

Rahul Narain, Armin Samii, and James F. O'Brien. "Adaptive Anisotropic Remeshing for Cloth Simulation". ACM Transactions on Graphics, 31(6):147:1–10, November 2012. Proceedings of ACM SIGGRAPH Asia 2012, Singapore.

Rahul Narain, Tobias Pfaff, and James F. O'Brien. "Folding and Crumpling Adaptive Sheets". ACM Transactions on Graphics, 32(4):51:1–8, July 2013. Proceedings of ACM SIGGRAPH 2013, Anaheim.

Tobias Pfaff, Rahul Narain, Juan Miguel de Joya, and James F. O'Brien. "Adaptive Tearing and Cracking of Thin Sheets". ACM Transactions on Graphics, 33(4):110:1–9, July 2014. Proceedings of ACM SIGGRAPH 2014, Vancouver.

πŸ‘€ Samples

Here are some offline results:

clothsimulator's People

Contributors

wajov avatar jjdunlop avatar coyotnt avatar

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.