TetSim
Javascript Tetrahedral FEM Simulation
Install / Use
/learn @zalo/TetSimREADME
TetSim
<p align="left"> <a href="https://github.com/zalo/TetSim/deployments/activity_log?environment=github-pages"> <img src="https://img.shields.io/github/deployments/zalo/TetSim/github-pages?label=Github%20Pages%20Deployment" title="Github Pages Deployment"></a> <a href="https://github.com/zalo/TetSim/commits/master"> <img src="https://img.shields.io/github/last-commit/zalo/TetSim" title="Last Commit Date"></a> <!--<a href="https://github.com/zalo/TetSim/blob/master/LICENSE"> <img src="https://img.shields.io/github/license/zalo/TetSim" title="License: Apache V2"></a>--> <!-- No idea what license this should be! --> </p>Simulate Tetrahedral FEM Models in your browser in real-time using the GPU!

This repo contains two proof-of-concept demos:
CPU Sim
This one is a plain rehosting of Miles Macklin and Matthias Müller's A Constraint-based Formulation of Stable Neo-Hookean Materials demo.
I've broken the script into several ES6 Module pieces with the intention of improving reusability.
GPU Sim
This one rewrites the entire simulation as a set of GPU passes on Render Textures (gaining a ~20x speedup). This does NOT use the Neohookean energy/constraint function. This is because the Neohookean function only converges well with Gauss-Seidel iterations (which are tricky to implement on the GPU (see: Graph Coloring), and especially tricky to implement for this example dragon mesh, which has vertices with over 30 connecting tetrahedra). Instead, this simulation uses Matthias Müller's Robust Polar Decomposition on the tetrahedra, which converges much faster (and with GPU-friendly Jacobi Iterations).
- 20x faster
- Even works on Mobile Devices (though Android devices behave strangely)
- Not physically correct (doesn't incorporate deltaTime properly yet)
Building
This demo can either be run without building (in Chrome/Edge/Opera since raw three.js examples need Import Maps), or built with:
npm install
npm run build
After building, make sure to edit the index .html to point from "./src/main.js" to "./build/main.js".
Dependencies
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
