Built with Rust+WASM and WebGL
For our final project we implemented an algorithm called Fast Fluid Dynamics (FFD) using Rust and WebGL. This is a method for creating real-time, stable fluid simulations that run entirely on the GPU based on Jos Stam’s paper, “Stable Fluids” (Stam 1999).
Our implementation is based on the tutorial in this GPU Gems Chapter.
In order to use Rust and WASM you will need the nightly version of Rust.
- First, install rustup
- Then, run the following commands to install the rust nightly toolchain and make it the default:
$ rustup install nightly
$ rustup default nightly
You will also need to install Node.js. Then run the following command to install the javascript dependencies.
$ npm install
To build and run the project run the following command.
$ npm run serve
You can access the simulation from localhost:3000
To build without running the webserver execute:
$ npm run build
wasm-bindgenfor communicating between WebAssembly and JavaScript.console_error_panic_hookfor logging panic messages to the developer console.wee_alloc, an allocator optimized for small code size.