Coder Social home page Coder Social logo

kaist-silab / arcsim Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 5.0 14.49 MB

ARCSim 0.3.1 Fixes and Installer Script for Linux and MacOS

License: Other

Makefile 0.36% Shell 0.05% Mathematica 93.25% Haskell 0.11% Python 0.01% C++ 6.22%
arcsim installer simulation 3d graphics script instructions partial-differential-equations differential-equations linux

arcsim's Introduction

ARCSim 0.3.1 Fixes and Installer Script

๐Ÿ—‚ Contents

This repository is a fork of ARCSim: Adaptive Refining and Coarsening Simulator 0.3.1, which you can also find here. It contains bug fixes for the installation and an installer script tested on Ubuntu and Pop!_OS 20.04 which should be compatible with other Linux distributions as well (you may need to change the repository installation from apt-get to your distro's one). The script automatically detects the operating system and should also work with MacOSX - although this is untested, so any feedback will be welcome ;)

Flag simulation

๐Ÿ›  Setup Instructions:

Open a terminal in the folder you would like to install ARCSim and paste the following commands:

  1. Clone repository:
git clone https://github.com/kaist-silab/arcsim.git && cd arcsim/
  1. Change permissions and install:
sudo chmod +x install.sh && sudo ./install.sh

๐Ÿ“‘ Usage

Commands

For compilation instructions, see the INSTALL file. If you're on a Mac, make sure you have the latest gcc, as described there.

The simulator has various modes, which are called by running it with the format

bin/arcsim <command> [<args>]

The various command and their inputs can be discovered by running the executable with no arguments. The main simulation-related commands are as follows.

  • simulate <scene-file> [<out-dir>]

    Reads the simulation description given in (try conf/sphere.json, then see "Scene files" below) and runs the simulation while displaying the results in an OpenGL window. Press Space to run the simulation once the window opens, or 'S' to advance one timestep at a time. If is given, the results of the simulation are saved in that directory. The format of the output is described in "Output files".

  • simulateoffline <scene-file> [<out-dir>]

    Same as 'simulate' but without the OpenGL display. (And you don't have to press Space to start the simulation.) Useful for running on a remote server over SSH.

  • resume <out-dir> <resume-frame>

    Resumes an incomplete simulation saved in , starting at the given frame number. (Note that if the original scene file has been changed since the simulation was first run, those changes will not be respected in the resumed simulation.)

  • resumeoffline <out-dir> <resume-frame>

    Same as 'resume' but without the OpenGL display.

  • replay <out-dir> [<sshot-dir>]

    Replays the results of the simulation stored in . The left and right arrow keys step through the frames; Shift+arrow and Alt+arrow jump 10 and 100 frames. Hitting Space plays back all the frames as fast as possible. The Home key returns to frame 0. If is given, the rendered images are also saved there upon playback.

  • generate <out-dir>

    Reads the simulation state of a previous "simulate" run, and generates obj files which can be used for rendering.

Using the OpenGL interface

Space: start simulation/playback Left drag: rotate Middle drag: translate Scroll wheel: scale Esc: exit

Scene files

The scene configuration files are written in JSON syntax (http://www.json.org/). A number of example scenes are provided in the conf/ directory. The sphere interaction example, conf/sphere.json, is a good "hello world" scene to check that the simulator is working.

A scene file consists of a single JSON object containing many name/value pairs describing the parameters and contents of the simulation. For a full description of all the options, see the file conf/sphere-annotated.json, which is a heavily commented version of conf/sphere.json and describes all the settings that can be used.

Creating meshes for simulation

Simulation meshes are saved as OBJ files, with the parametrization space embedding stored in texture coordinates, and other simulation data (node velocities, plasticity data, etc.) in custom fields. These meshes can be imported or viewed as usual in 3D software.

If you want to use a flat sheet of material cut in an arbitrary shape, as specified by a triangle mesh in the xy-plane, this requires no extra effort. The simulator will simply assume the rest shape to be identical to the initial input. For this to work correctly, however, (i) the input mesh must have no texture coordinates specified; (ii) the mesh should lie in the xy-plane (its initial pose in the scene can be changed using the scene file); and (iii) all faces should be positively oriented, i.e. their vertices must be listed in counter-clockwise order.

Simulating a garment composed of multiple panels sewn together requires a little initial setting-up. At present, we only support garments that form manifolds with consistent orientation. Having more than two faces meeting along an edge, as occurs with pockets, or joining the back side of one panel with the front side of another, will break the simulation.

First, we model the panels laid flat and positively oriented in the xy-plane as above, and save them in a nonoverlapping arrangement in a single OBJ file. Call this the parametrization-space mesh. If two boundaries are to be joined into a seam, care must be taken in this step to have them discretized consistently, with both sides having the same number of vertices and equal lengths of corresponding edges.

Second, we take the same mesh and move its vertices into the desired initial positions in world space, say around a posed character. We indicate seams and darts by placing two or more boundary vertices very close to each other; in the next step, such vertices will be fused together. Here, though, we only move vertices, but must not modify the mesh topology. This is saved as the world-space mesh.

Finally, the parametrization-space and world-space meshes are combined to form a mesh in which the seam vertices have been fused, but the intrinsic flat shapes of the panels are still intact in texture coordinates. This is done with the command

bin/arcsim merge <param-mesh> <world-mesh> <out-mesh> [<thresh>]

where the optional <thresh> (default 0.01) sets the maximum distance threshold between vertices to be merged.

For an example of this procedure, see the meshes named tshirtm.obj, tshirtw.obj, and tshirt.obj in the meshes/ direectory.

Output files

The output of the simulation consists of a number of files:

  • conf.json is a copy of the scene file that was used to run the simulation. This is useful for resuming, replaying, and general future reference.

  • <frame>.bin is the full simulation state of frame . To generate obj files from the simulation state, a post-processing run of bin/arcsim generate has to be executed.

  • <frame>_<i>.obj is the mesh for the <i>th cloth at the given frame number. A simulation may have multiple articles of cloth, e.g. the pants, t-shirt, and vest of the kicking character.

  • obs_<j>.obj is a copy of the geometry of the <j>th obstacle in its reference pose.

  • <frame>obs<j>.txt is an XML fragment describing the transformation of the <j>th obstacle at the given frame. It is only used to plug into the Mitsuba scene file when rendering. The resume and replay code ignores it, instead reconstructing the obstacle motion from the specification in conf.json.

  • timing is a dump of the wall-clock compute time spent per time step in each routine of the simulation.

You may use the .obj file for visualization: the GIF was obtained by importing them into Blender. Finally, we leave the original README with the license.

๐Ÿ“ฌ 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 to the code and created the install.sh script. Full credits go to the original authors. 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.

Special thanks go to @DanielTakeshi for his instructions!

arcsim's People

Contributors

fedebotu avatar

Stargazers

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

Watchers

 avatar  avatar

arcsim's Issues

Taucs doesn't compile

Hi! I've been trying to compile ARCsim for days now, but simply can't get it to work. Taucs just refuses to work. I'm on Ubuntu 22.
With your repository I'm getting the following error:

In file included from src/taucs_sn_llt.c:13:
src/taucs.h:6:10: fatal error: taucs_config_tests.h: No such file or directory
    6 | #include <taucs_config_tests.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [build/linux/makefile:51: obj/linux/taucs_sn_llt.o] Error 1
make[1]: Leaving directory '/home/marl/arcsim/dependencies/taucs'
make: *** [Makefile:18: lib/libtaucs.a] Error 2
ERROR: Make error on dependencies occurred. Exiting...

Any ideas? I followed the exact commands you put in the readme.

On entry to DGESVD parameter number 6 had an illegal value LAPACKE_dgesvd failed with return value -7 on matrix..

When I run the test, I get a bunch of error messages. This is on a fresh git checkout, with commit e17d93b. Here's some of the error messages, which keep getting printed to the terminal:

$ ./bin/arcsim simulate conf/flag.json |& head -n 40
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (3.29028, 2.43448, 0),
    (-2.49196, 0.682025, 0),
    (0, -0, 1)
)
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (1.33333, -2.86489, 0),
    (0, 5.72977, 0),
    (0, 0, 1)
)
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (-0.919006, 3.20194, 0),
    (-1.59598, -2.92404, 0),
    (0, 0, 1)
)
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (3.7868, 1.06504, 0),
    (-3.1044, 1.42807, 0),
    (0, -0, 1)
)
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (2.31082, 3.10387, -0),
    (-3.27296, -0.396195, 0),
    (0, 0, 1)
)
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (0.925693, -2.67102, 0),
    (2.59127, 2.57435, 0),
    (-0, 0, 1)
)
 ** On entry to DGESVD parameter number  6 had an illegal value
LAPACKE_dgesvd failed with return value -7 on matrix (
    (0.324485, 3.91303, -0),
    (-2.35459, -2.33921, 0),
...

problem: how to install in Mac M1

Hello, I have just met some problems in running the install.sh in m1 Mac. when run 'make' in the dependencies folder, it comes with an AttributeError: 'module' object has no attribute 'getoutput', could you tell me what's the problem?

Build with Spack?

Just a suggestion since I had a lot of trouble getting arcsim and all the dependencies to build, but would it be possible to package this up so it installs with spack (https://spack.io). If done properly, this will allow users to build without sudo privileges, as al the dependencies can be specified and spack will build them too. As is, I had to install my own scons, since our system's version was too old, install my own atlas from source, and manually unpack blas/lapack libraries from rpms.

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.