Fundamentals 10 min read

How 99 Lines of Code Let You Create Frozen‑Style Magic with Taichi

Taichi, a new CG programming language created by MIT PhD student Hu Yuanming, enables high‑performance physical simulation and differentiable programming with just a few dozen lines of code, dramatically outperforming TensorFlow and PyTorch, and has been showcased in SIGGRAPH, ICRA, ICLR papers and real‑time demos.

21CTO
21CTO
21CTO
How 99 Lines of Code Let You Create Frozen‑Style Magic with Taichi

Only 99 lines of code let you create ice‑magic effects similar to those in Disney's Frozen, thanks to Taichi, a new computer‑graphics programming language developed by MIT PhD student Hu Yuanming.

Taichi dramatically reduces the barrier to high‑performance physical simulation: a simple scene that takes minutes on a regular PC runs 188× faster than TensorFlow and 13.4× faster than PyTorch, while the code is about one‑tenth the length of traditional implementations.

Installation is as easy as import taichi as ti, similar to TensorFlow. import taichi as ti Hu also provides a complete tutorial, and his work has been accepted at top conferences such as SIGGRAPH 2018, ICRA 2019, and ICLR 2020.

Material Point Method (MPM) and MLS‑MPM

MPM is widely used in visual effects; Frozen used it, but early versions required a week of cluster time for a few seconds of footage. Hu improved it with Moving Least Squares MPM (MLS‑MPM), achieving a two‑fold speedup and enabling new phenomena such as material cutting and bidirectional coupling of rigid bodies.

An 88‑line C++ demo of MLS‑MPM is provided as a reference implementation.

ChainQueen Differentiable Physics Engine

Building on MLS‑MPM, ChainQueen is a real‑time, differentiable hybrid Lagrangian‑Eulerian simulator for deformable objects, delivering high precision in both forward simulation and gradient computation. The research appeared in ICRA 2019 and formed Hu's master thesis.

DiffTaichi

DiffTaichi extends Taichi with differentiable programming, offering ten physical simulators that can be benchmarked against existing baselines. Most models run in 2–3 hours without a GPU; examples include elastic objects, rigid bodies, fluids, light refraction, and elastic collisions.

A differentiable elastic object simulator runs on a 2017 13‑inch MacBook Pro in under ten minutes, while the CUDA version requires 490 lines of code compared to 110 lines in Taichi.

Taichi’s speed rivals CUDA, being 188× faster than TensorFlow and 13.4× faster than PyTorch, and neural‑network controllers typically need only a few dozen gradient steps for optimization.

Why Taichi?

Computer graphics lacks a universal tool like TensorFlow, forcing developers to master low‑level details. Taichi provides a Python‑friendly interface, integrates with IDEs and libraries such as NumPy and Matplotlib, and is distributed as a pip package, lowering the entry barrier for graphics programmers.

Hu Yuanming’s Background

From a top high‑school student to a Tsinghua “Yao Class” graduate, Hu has won multiple programming contests, interned at Microsoft Research Asia, and published several papers in CVPR, SIGGRAPH, and other top venues before completing his MIT PhD.

For more details, see Hu’s Zhihu article, the arXiv paper, and the GitHub repositories.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Differentiable Programmingcomputer graphicsPhysical SimulationTaichiMLSM‑MPM
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.