Get the latest tech news

Fluid Simulation and Web Assembly


Try: Esc Space r Left Mouse Right Mouse Three weeks ago I saw a video where Sebastian Lague, a Unity developer and YouTuber, created an interactive fluid simulation in Unity. The project hooked me and I decided to make my own in C++. Here’s how it went. How to simulate a fluid In fluid simulation, there are two big classes of simulation: Eulerian Lagrangian Either of these models can be used to simulate either liquid or gas.

In practice, this can be a very finicky process, where small changes to the number of particles, target density, or pressure multiplier can lead to an unstable simulation. If you imagine the red particle in a corner of the center cell it is easy to see that the smoothing radius (denoted with h) would never reach outside the highlighted 9-cell region. Though I did find an excellent post by nicebyte demonstrating how a similar project can be done and maybe at some point in the future, I’ll learn OpenGL.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Web Assembly

Web Assembly

Photo of Fluid Simulation

Fluid Simulation