This is the open-source reference implementation of the SIGGRAPH 2021 paper Intersection-free Rigid Body Dynamics.

Overview

Rigid IPC

Build License

Robust, intersection-free, simulations of rigid bodies.

This is the open-source reference implementation of the SIGGRAPH 2021 paper Intersection-free Rigid Body Dynamics.

Files

  • src/: source code
  • cmake/ and CMakeLists.txt: CMake files
  • fixtures/: input scripts to rerun all examples in our paper
  • meshes/: input meshes used by the fixtures
  • tests/: unit-tests
  • tools/: Python and Bash scripts for generating and processing results
  • comparisons/: files used in comparisons with other rigid body simulators
  • python/: Python binding files
  • notebooks/: Jupyter notebooks

Build

To build the project, use the following commands from the root directory of the project:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4

Dependencies

All dependancies are downloaded through CMake depending on the build options. The following libraries are used in this project:

  • IPC Toolkit: common IPC functions
  • Eigen: linear algebra
  • libigl: basic geometry functions, predicates, and viewer
  • TBB: parallelization
  • Tight Inclusion CCD: correct (conservative) continuous collision detection between triangle meshes in 3D
  • spdlog: logging information
  • filib: interval arithmetic
  • Niels Lohmann's JSON: parsing input JSON scenes
  • tinygltf: exporting simulation animation to GLTF format
  • finite-diff: finite difference comparisons
    • Only used by the unit tests and when RIGID_IPC_WITH_DERIVATIVE_CHECK=ON

Optional

Scenes

We take as input a single JSON file that specifies the mesh and initial conditions for each body. The fixtures directory contains example scenes.

Python Bindings

We expose some functionality of Rigid IPC through Python. This is still in development and lacks the ability to script many features available in the full simulator.

To build the Python bindings use the setup.py script:

python setup.py install
Comments
  • cmake fails on Linux Mint 19.3

    cmake fails on Linux Mint 19.3

    Here is what I typed:

    $ mkdir build
    $ cd build
    $ cmake -DCMAKE_BUILD_TYPE=Release ..
    -- GCC >= 4.9 detected, enabling colored diagnostics
    -- Third-party: creating target 'Eigen3::Eigen'
    -- Third-party: creating target 'igl::core'
    -- Creating target: igl::core (igl)
    -- Creating target: igl::opengl (igl_opengl)
    -- Creating target: igl::opengl_glfw (igl_opengl_glfw)
    -- Using X11 for window creation
    -- Creating target: igl::opengl_glfw_imgui (igl_opengl_glfw_imgui)
    -- Creating target: igl::png (igl_png)
    -- Creating target: igl::predicates (igl_predicates)
    -- Third-party: creating target 'nlohmann::json'
    -- Third-party: creating target 'spdlog::spdlog'
    -- Build spdlog: 1.9.0
    -- Build type: Release
    -- Generating install
    -- Third-party: creating target 'finitediff::finitediff'
    -- Third-party: creating targets 'Boost::boost'
    -- Fetching Boost
    -- Fetching Boost - done
    -- Boost found: 1.71.0 /home/glenn/src/github.com/ipc-sim/rigid-ipc/build/_deps/boost-src
    -- Found the following ICU libraries:
    --   uc (required)
    --   dt (required)
    --   i18n (required)
    -- Third-party: creating target 'TBB::tbb'
    -- Third-party: creating target 'tight_inclusion::tight_inclusion'
    -- Tight-Inclusion CCD bottom-level project
    -- GCC >= 4.9 detected, enabling colored diagnostics
    -- Searching for AVX...
    -- Using CPU native flags for AVX optimization:  -march=native
    --   Found AVX 2.0 extensions, using flags:  -march=native -mavx2 -mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd
    -- Using Double Precision Floating Points
    -- Third-party: creating target 'PolyFEM::polysolve'
    [ 11%] Performing download step (git clone) for 'polysolve-populate'
    Cloning into 'polysolve-src'...
    fatal: reference is not a tree: a94e9b8ed8302d4b479533c67419f31addb1e987
    CMake Error at polysolve-subbuild/polysolve-populate-prefix/tmp/polysolve-populate-gitclone.cmake:40 (message):
      Failed to checkout tag: 'a94e9b8ed8302d4b479533c67419f31addb1e987'
    
    
    CMakeFiles/polysolve-populate.dir/build.make:110: recipe for target 'polysolve-populate-prefix/src/polysolve-populate-stamp/polysolve-populate-download' failed
    make[2]: *** [polysolve-populate-prefix/src/polysolve-populate-stamp/polysolve-populate-download] Error 1
    CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/polysolve-populate.dir/all' failed
    make[1]: *** [CMakeFiles/polysolve-populate.dir/all] Error 2
    Makefile:102: recipe for target 'all' failed
    make: *** [all] Error 2
    
    CMake Error at /usr/local/cmake-3.18.2-Linux-x86_64/share/cmake-3.18/Modules/FetchContent.cmake:987 (message):
      Build step for polysolve failed: 2
    Call Stack (most recent call first):
      /usr/local/cmake-3.18.2-Linux-x86_64/share/cmake-3.18/Modules/FetchContent.cmake:1082:EVAL:2 (__FetchContent_directPopulate)
      /usr/local/cmake-3.18.2-Linux-x86_64/share/cmake-3.18/Modules/FetchContent.cmake:1082 (cmake_language)
      /usr/local/cmake-3.18.2-Linux-x86_64/share/cmake-3.18/Modules/FetchContent.cmake:1125 (FetchContent_Populate)
      cmake/recipes/polysolve.cmake:14 (FetchContent_MakeAvailable)
      CMakeLists.txt:225 (include)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/glenn/src/github.com/ipc-sim/rigid-ipc/build/CMakeFiles/CMakeOutput.log".
    See also "/home/glenn/src/github.com/ipc-sim/rigid-ipc/build/CMakeFiles/CMakeError.log".
    

    Any ideas how to fix this? It looks like a bad git reference in polysolve-src, possibly.

    Thank you!

    opened by gmlewis 6
  • Missing files or invalid fixture scripts?

    Missing files or invalid fixture scripts?

    I tried some of the examples in the "fixtures" directory, and the simulator works great! Nice work!

    However, I discovered that there are some examples that don't run either because their mesh files don't exist in the repo or because of some other problem.

    For example, this example is missing its meshes: https://github.com/ipc-sim/rigid-ipc/blob/main/fixtures/3D/mechanisms/expanding-lock-box.json#L11-L57

    This example says [2021-09-30 19:57:28.039] [error] Invalid Json file: https://github.com/ipc-sim/rigid-ipc/blob/main/fixtures/2D/compactor.json

    opened by gmlewis 3
  • Added TimeStepping (WIP)

    Added TimeStepping (WIP)

    Updated clang-format so long chains of parameters are shown one on each line (don't hate me)

    IO

    • Added rigid-body fixtures (NEW FORMAT!)
      • Added rigid-body reader
    • Added json/eigen helper to read/write matrices

    OPT

    • Added is_barrier method (and get/set epsilon) to CollisionConstraint so we don't need to pass the BarrierConstraint to the solver
      • Updated barrier constraint to use them
    • Added accessors on OptimizationProblem for barrier case
      • updated ad-hoc problem too since it was used on unit-tests

    PHYSICS

    • updated RigidBody class to

      • include theta: position is now length 3 (x, y, theta)
      • compute mass and moment of intertia (needed for forces)
      • added position of previous step
      • added differentiable world vertices, and flag to obtain the vertices of the current or previous step.
      • TODO: remove world_displacements, we should use world_vertices instead!
    • Added RigidBodyAssembler (to replace RigidBodyAssembler once finished)

      • init method only computes inmmutable information
      • other methods compute assembly on call

    SIMULATION

    • Added new main file for simulation
    • Added UISimSate and UIMenu for the simulation UI
    • TODO: merge with collision-debugging UI or add export of single problematic step
    opened by panchagil 1
  • Newton fix

    Newton fix

    I updated the Newton solver to fail to gradient descent if the line search fails. This helps the optimization make progress even when the Hessian is ill-conditioned. The next step after this pull request is merged is to add a quasi-Newton solver (e.g. BFGS).

    • Exposed initialization of barrier epsilon in the UI.
    • Separated line search into its own file.
    • Newton method now fails to gradient descent.
    opened by zfergus 1
  • Chain rule refactor

    Chain rule refactor

    Refactor structure of project. Now we have only 4 problems

    • Rigid Body Physics + Distance Barrier Constraint + Barrier Solver

    • Particles Physics + Distance Barrier Constraint + Barrier Solver

    • Rigid Body Physics + Volume Constraint + NCP Solver

    • Particles Physics + Volume Constraint + NCP Solver

    • Remove some base classes that were forcing us to write more functions than neccesary

      • Base OptimizationProblem is gone, now we have some interfaces for the different problems
      • Base CollisionConstraint remainds but implements few methods.
    • Removed exmplicit template instantiation and instead created .tpp files to keep template implementations

    opened by panchagil 0
  • Combined the distance barrier and CCD broad-phases

    Combined the distance barrier and CCD broad-phases

    • Exposed broad-phase in order to get the candidate collisions
    • Modified DistanceBarrier::detectCollisions to first build a common collision candidate set
    • Using this set run the narrow-phase of both the barrier and the CCD
    • TODO: Expose the ev_candidates as a member variable.
    • TODO: Add a is_collision_candidates_frozen flag to cause detectCollisions to not run the broad-phase again.
    opened by zfergus 0
  • Added BFGS and gradient descent solvers

    Added BFGS and gradient descent solvers

    • Added BFGS and GD to barrier solver as inner solvers
    • Needed to move some functionality out of NewtonSolver and into OptimizationSolvers
    • TODO: Move free_dof out of the OptimizationSolver and into the optimization problem with the eval_* functions using free_dof to remove elements.
    opened by zfergus 0
  • Added Rigid Body System Derivatives and  Rigid Body Problem

    Added Rigid Body System Derivatives and Rigid Body Problem

    • Added python notebook to get exact derivatives of RB transformation
    • Moved rigid body to its own file (out of rigid_body_system)
      • Added tests for RB gradient/hessian comparing with exact solutions
    • Added assembly of gradient and hessian on RB-System
      • Added test for RB-System comparing with exact solutions

    Added Rigid Body Problem

    • Added Rigid Body Problem to opt/
    • Implemented Functional, its gradient and hessian
      • tested against finite differences
    • Added tensor util to compute the multiplication of (1x2N) * (2N x 3B x 3B) used by the chain rule.
    opened by panchagil 0
  • Rigid body system

    Rigid body system

    • Moved rigid bodies to physics/ folder
      • added RigidBodySystem that keeps list of RB.
    • Moved solvers to solvers/ folder
    • Removed (a lot of)unused code
    opened by panchagil 0
  • Rigid bodies

    Rigid bodies

    Add UI features for controlling rigid bodies individually

    • Added gradient and hessian of compute_particle_displacements
      • This will be removed later it not used
    • Improved readability by using .homogeneous and .hnormalized
    • Edit buttons half width
    • Rigid body section to control the velocity of each body
    • State method to update the displacements and other fields from the rigid bodies
    opened by zfergus 0
  • Add menu to procedurally generate a chain of n links

    Add menu to procedurally generate a chain of n links

    The menu loads the one-link fixture file and duplicates the link n times. Each link has a scaled displacement, so all links have at least one contact.

    opened by zfergus 0
  • Unknown CMake command

    Unknown CMake command "rigid_ipc_download_project"

    Hi, I git clone the rigid-ipc, and use python build.py to compile the project.

    It gives this error: CMake Error at python/CMakeLists.txt:6 (rigid_ipc_download_project): Unknown CMake command "rigid_ipc_download_project". Call Stack (most recent call first): python/CMakeLists.txt:13 (rigid_ipc_download_pybind11)

    my cmake version is 3.16.3 os: ubuntu 20.04 python: miniconda with python 3.7

    BTW, I also tried with:

    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Release ..
    make
    

    This can make with no mistakes.

    I think something wrong with the python part? Any suggestions? Thanks!

    opened by WenqiangX 0
Releases(s2021)
Owner
Incremental Potential Contact code and related projects.
null
PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization using Augmented-Self Reference and Dense Semantic Correspondence) and pre-trained model on ImageNet dataset

Reference-Based-Sketch-Image-Colorization-ImageNet This is a PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization usin

Yuzhi ZHAO 11 Jul 28, 2022
This repository contains numerical implementation for the paper Intertemporal Pricing under Reference Effects: Integrating Reference Effects and Consumer Heterogeneity.

This repository contains numerical implementation for the paper Intertemporal Pricing under Reference Effects: Integrating Reference Effects and Consumer Heterogeneity.

Hansheng Jiang 6 Nov 18, 2022
PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.

st-nerf We provide PyTorch implementations for our paper: Editable Free-viewpoint Video Using a Layered Neural Representation SIGGRAPH 2021 Jiakai Zha

Diplodocus 258 Jan 2, 2023
Expressive Body Capture: 3D Hands, Face, and Body from a Single Image

Expressive Body Capture: 3D Hands, Face, and Body from a Single Image [Project Page] [Paper] [Supp. Mat.] Table of Contents License Description Fittin

Vassilis Choutas 1.3k Jan 7, 2023
Full body anonymization - Realistic Full-Body Anonymization with Surface-Guided GANs

Realistic Full-Body Anonymization with Surface-Guided GANs This is the official

Håkon Hukkelås 30 Nov 18, 2022
WormMovementSimulation - 3D Simulation of Worm Body Movement with Neurons attached to its body

Generate 3D Locomotion Data This module is intended to create 2D video trajector

null 1 Aug 9, 2022
Alpha-IoU: A Family of Power Intersection over Union Losses for Bounding Box Regression

Alpha-IoU: A Family of Power Intersection over Union Losses for Bounding Box Regression YOLOv5 with alpha-IoU losses implemented in PyTorch. Example r

Jacobi(Jiabo He) 147 Dec 5, 2022
Plotting points that lie on the intersection of the given curves using gradient descent.

Plotting intersection of curves using gradient descent Webapp Link ---> What's the app about Why this app Plotting functions and their intersection. A

Divakar Verma 2 Jan 9, 2022
The code for the CVPR 2021 paper Neural Deformation Graphs, a novel approach for globally-consistent deformation tracking and 3D reconstruction of non-rigid objects.

Neural Deformation Graphs Project Page | Paper | Video Neural Deformation Graphs for Globally-consistent Non-rigid Reconstruction Aljaž Božič, Pablo P

Aljaz Bozic 134 Dec 16, 2022
Code for ICCV 2021 paper: ARAPReg: An As-Rigid-As Possible Regularization Loss for Learning Deformable Shape Generators..

ARAPReg Code for ICCV 2021 paper: ARAPReg: An As-Rigid-As Possible Regularization Loss for Learning Deformable Shape Generators.. Installation The cod

Bo Sun 132 Nov 28, 2022
Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

null 235 Dec 26, 2022
Supplementary code for SIGGRAPH 2021 paper: Discovering Diverse Athletic Jumping Strategies

SIGGRAPH 2021: Discovering Diverse Athletic Jumping Strategies project page paper demo video Prerequisites Important Notes We suspect there are bugs i

null 54 Dec 6, 2022
Code for the SIGGRAPH 2021 paper "Consistent Depth of Moving Objects in Video".

Consistent Depth of Moving Objects in Video This repository contains training code for the SIGGRAPH 2021 paper "Consistent Depth of Moving Objects in

Google 203 Jan 5, 2023
Official PyTorch implementation of CAPTRA: CAtegory-level Pose Tracking for Rigid and Articulated Objects from Point Clouds

CAPTRA: CAtegory-level Pose Tracking for Rigid and Articulated Objects from Point Clouds Introduction This is the official PyTorch implementation of o

Yijia Weng 96 Dec 7, 2022
[IJCAI-2021] A benchmark of data-free knowledge distillation from paper "Contrastive Model Inversion for Data-Free Knowledge Distillation"

DataFree A benchmark of data-free knowledge distillation from paper "Contrastive Model Inversion for Data-Free Knowledge Distillation" Authors: Gongfa

ZJU-VIPA 47 Jan 9, 2023
Implementation for "Seamless Manga Inpainting with Semantics Awareness" (SIGGRAPH 2021 issue)

Seamless Manga Inpainting with Semantics Awareness [SIGGRAPH 2021](To appear) | Project Website | BibTex Introduction: Manga inpainting fills up the d

null 101 Jan 1, 2023
Official implementation of "StyleCariGAN: Caricature Generation via StyleGAN Feature Map Modulation" (SIGGRAPH 2021)

StyleCariGAN in PyTorch Official implementation of StyleCariGAN:Caricature Generation via StyleGAN Feature Map Modulation in PyTorch Requirements PyTo

PeterZhouSZ 49 Oct 31, 2022
Official implementation of "StyleCariGAN: Caricature Generation via StyleGAN Feature Map Modulation" (SIGGRAPH 2021)

StyleCariGAN: Caricature Generation via StyleGAN Feature Map Modulation This repository contains the official PyTorch implementation of the following

Wonjong Jang 270 Dec 30, 2022
Official repository of the paper "A Variational Approximation for Analyzing the Dynamics of Panel Data". Mixed Effect Neural ODE. UAI 2021.

Official repository of the paper (UAI 2021) "A Variational Approximation for Analyzing the Dynamics of Panel Data", Mixed Effect Neural ODE. Panel dat

Jurijs Nazarovs 7 Nov 26, 2022