• Stars
    star
    2,378
  • Rank 18,557 (Top 0.4 %)
  • Language
  • Created over 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

10 differentiable physical simulators built with Taichi differentiable programming (DiffTaichi, ICLR 2020)

python3 diffmpm.py

DiffTaichi: Differentiable Programming for Physical Simulation (ICLR 2020)

Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, Frédo Durand

[Paper] [Video] (with instructions to reproduce every demo)

Differentiable programming in Taichi allows you to optimize neural network controllers efficiently with brute-force gradient descent, instead of using reinforcement learning.

The DiffTaichi differentiable programming framework is now officially part of Taichi. This repo only contains examples.

DiffTaichi significantly boosts the performance and productivity of differentiable physical simulators. For example, the differentiable elastic object simulator (ChainQueen) in DiffTaichi is 188x faster than an implementation in TensorFlow. The DiffTaichi version also runs as fast as the CUDA implementation, with the code being 4.2x shorter.

Most of the 10 differentiable simulators can be implemented within 2-3 hours.

Questions regarding the simulators/autodiff compiler go to Yuanming Hu (yuanming at mit.edu) or Issues.

Note: Updates on October 27 2021

Examples are now compatible with Taichi v0.8.3. Please update Taichi if you are using an old version.

How to run

Step 1: Install Taichi with pip:

(Most examples do not need a GPU to run.)

python3 -m pip install taichi

Step 2: Run example scripts in the examples folder: (Please wait for all GIFs to load :-)

Differentiable Elastic Object Simulator [python3 diffmpm.py]

Gradient descent iteration 0 and gradient descent iteration 80:

Differentiable 3D Elastic Object Simulator [python3 diffmpm3d.py]

Gradient descent iteration 40:

Differentiable 3D Fluid Simulator [python3 liquid.py]

Gradient descent iteration 450:

Differentiable Height Field Water Simulator [python3 wave.py]

Gradient descent iteration 180:

Differentiable (Adversarial) Water Renderer [python3 water_renderer.py]

Differentiable water simulation + differentiable water rendering + (differentiable) CNN

Optimization goal: find an initial water height field, so that after simulation and shading, VGG16 thinks the squirrel image is a goldfish. Input image: VGG16=fox squirrel (42.21%)

Left: center activation . Right: An activation that fools VGG (VGG16=goldfish (99.91%))

Differentiable Rigid Body Simulator [python3 rigid_body.py [1/2] train]

2048 time steps. Gardient descent iteration 20:

Differentiable Mass-Spring Simulator [python3 mass_spring.py [1/2/3] train]

682 time steps. Gardient descent iteration 20:

Differentiable Billiard Simulator [python3 billiards.py]

Gardient descent iteration 0 and gradient descent iteration 100:

See the video for the remaining two simulators.

Bibtex

@article{hu2019difftaichi,
  title={DiffTaichi: Differentiable Programming for Physical Simulation},
  author={Hu, Yuanming and Anderson, Luke and Li, Tzu-Mao and Sun, Qi and Carr, Nathan and Ragan-Kelley, Jonathan and Durand, Fr{\'e}do},
  journal={ICLR},
  year={2020}
}
@article{hu2019taichi,
  title={Taichi: a language for high-performance computation on spatially sparse data structures},
  author={Hu, Yuanming and Li, Tzu-Mao and Anderson, Luke and Ragan-Kelley, Jonathan and Durand, Fr{\'e}do},
  journal={ACM Transactions on Graphics (TOG)},
  volume={38},
  number={6},
  pages={201},
  year={2019},
  publisher={ACM}
}

More Repositories

1

taichi

Productive, portable, and performant GPU programming in Python.
C++
24,605
star
2

taichi-nerfs

Implementations of NeRF variants based on Taichi + PyTorch
Python
687
star
3

games201

Advanced Physics Engines 2020: A Hands-on Tutorial
Python
490
star
4

taichi_elements

High-performance multi-material continuum physics engine in Taichi
Python
454
star
5

awesome-taichi

A curated list of awesome Taichi applications, courses, demos and features.
322
star
6

taichi_three

A soft renderer based on Taichi (work in progress)
Python
216
star
7

voxel-challenge

Python
210
star
8

meshtaichi

MeshTaichi: A Compiler for Efficient Mesh-based Operations (SIGGRAPH Asia 2022)
Python
201
star
9

taichi_blend

Taichi Blender intergration for physics simulation and animation
Python
152
star
10

quantaichi

QuanTaichi evaluation suite
Python
134
star
11

taichi-docs-zh-cn

Taichi中文文档
127
star
12

taichi_houdini

Python
101
star
13

faster-python-with-taichi

Python
76
star
14

taichicon

TaichiCon: Taichi Conferences
71
star
15

taichi_glsl

A Taichi extension library providing a set of GLSL-alike helper functions
Python
68
star
16

taichi-aot-demo

A demo illustrating how to use Taichi as an AOT shader compiler
C++
67
star
17

taichi.js

Run compiled Taichi kernels in JavaScript and WASM
Python
63
star
18

image-processing-with-taichi

Python
52
star
19

soft2d-release

Soft2D: A 2D multi-material continuum physics engine designed for real-time applications.
C++
48
star
20

Taichi-UnityExample

C#
46
star
21

cpp-training-season1

C++ training, season 1
C++
45
star
22

taichi_benchmark

Python
25
star
23

cheatsheet

TeX
24
star
24

taichi_dem

A minimal DEM simulation demo written in Taichi.
Python
24
star
25

docs.taichi.graphics

Home of the Taichi documentation site.
HTML
23
star
26

taichi-unity2

C++
20
star
27

cloth-simulation-homework

Python
16
star
28

community

13
star
29

advanced_examples

More advanced Taichi examples
Python
10
star
30

soft2d-for-unity

Soft2D-for-Unity
C#
10
star
31

poisson-sampling-homework

Python
9
star
32

sourceinspect

A unified inspector for retriving source from Python objects
Python
8
star
33

mls_mpm_88_extensions

Python
6
star
34

test_actions

C++
5
star
35

taichi_elements_blender_examples

5
star
36

public_files

5
star
37

dummy-rdp-client

Keep a live session by RDP, so OpenGL can function.
Rust
4
star
38

docstring-gen

Workflow for generating the docstring website
Python
4
star
39

mpm_3d_exercise

Python
4
star
40

stock_trading_strategy

Optimal stock trading strategy using Taichi
Python
3
star
41

taitopia-status-page

Taitopia status page
Markdown
3
star
42

taichi_assets

Taichi binary assets (submodule of the main Taichi repository)
3
star
43

taichi-release-tests

Python
2
star
44

blogs

Python
2
star
45

taichi-zoo-issue-tracker

This repository is used for collecting user feedback from the community
1
star
46

hackathons

Taichi ❤️ Hackathons
1
star
47

taichi_glad_ready

Ready to use GLAD as a OpenGL API loader
C
1
star