GithubHelp home page GithubHelp logo

gan-tu / cloth-simulator Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 4.0 67.2 MB

A mass-spring system simulator that animates realistic hanging, pinned, falling, colliding, and folding cloth behaviors.

CMake 2.39% C++ 60.97% Makefile 0.06% Python 3.58% Batchfile 0.06% C 20.09% Shell 0.16% Fortran 11.50% JavaScript 0.06% CSS 0.04% HTML 0.01% Objective-C 0.93% Lua 0.05% Objective-C++ 0.01% GLSL 0.01% Less 0.07%
cloth-simulation cloth animation graphics

cloth-simulator's Introduction

Cloth-Simulator

Build Status

A real-time cloth simulation engine

Code Protection

Upon request of the course staff, the source code will not be shown publicly on GitHub. The source code is currently password protected, zipped in src.zip. To request for the password for unzipping the source file, send me an email.

Write-Up

You can read my detailed writeup to understand what features I have implemented, how I developed them, see many of the cool results, and view side-by-side comparisons of the performance by different techniques.

Glimpse of Results

Demo

Animation

Note: the following animation may take a while to load before it starts moving

Animated Demo

Running Cloth Simulator

Running the program with zero arguments will load up the default scene (scene/pinned2.json).

./clothsim

Otherwise, to load a specific scene, run the program as follows:

./clothsim -f ../scene/<my_scene>.json

Specific Animations

To load a hanging cloth, run:

./clothsim -f ../scene/pinned2.json

To load a pinned cloth, run:

./clothsim -f ../scene/pinned4.json

To load a cloth falling on to a sphere, run:

./clothsim -f ../scene/sphere.json

To load a cloth falling on to a plane, run:

./clothsim -f ../scene/plane.json

To load a cloth falling onto itself, run:

./clothsim -f ../scene/selfCollision.json

Using the GUI

Besides the actual graphical user interface that you can work with using your mouse to tweak cloth parameters and dynamically change external forces, there are several keyboard commands that you might find useful.

Command Key
Pause simulation P
(while paused) Go forward 1 timestep N
Restart simulation R
End simulation ESCAPE
Reset camera to default position SPACE
Rotate camera (click and drag, or right click)
Pan camera (hold control + click and drag, or right click)

Build System

If you don't have CMake (version >= 2.8) on your personal computer, you can install it using apt-get on Linux or Macports/Homebrew on OS X. Alternatively, you can download it directly from the CMake website.

To build the code, start in the folder that GitHub made or that was created when you unzipped the download.

You will need to unzip the src.zip to get the source code first!

Upon request of the course staff, the source code will not be shown publicly on GitHub. The source code is currently password protected, zipped in src.zip. To request for the password for unzipping the source file, send me an email.

Run

mkdir build; cd build

to create a build directory and enter it, then

cmake ..

to have CMake generate the appropriate Makefiles for your system, then

make 

to make the executable, which will be deposited in the build directory.

cloth-simulator's People

Contributors

imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.