Martin Wepner

making.cool.stuff

Fluid simulation with compute shader

The goal of this project was to learn more about compute shaders and to create a fancy looking fluid simulation. Game Physics was a course in my fifth semester at TUM, teaching the basics of physics for games. I was bored by the inefficient, slow and boring CPU-SPH solution, that was given as an optional task by the course. So I decided to make my own one in Unity3D with the breathtaking power of graphic cards.

The results looked pretty decent and I managed to simulate 1 million particles at about 5 fps on a single Nvidia GTX 980. With 64k particles, the fps rate was >100. And even on an older MacBook Pro running windows, the simulation was pretty smooth. Just as a comparison: In the CPU Version the framerate started struggling at just 1000 particles.

FEATURES

  • all calculations are done on the graphics card
  • viscosity, rest density, surface tension, stiffness tweakable
  • change the size of the simulation box
  • choose between cube or point shading
  • switch gravity modes (normal, center, off)

TECHNOLOGIES

  • Unity3D
  • Computer Shader

TEAM

  • Christian Diemers (physics course project)
  • Yannick Stachelscheid (physics course project)
  • Martin Wepner (physics course project + Unity Shader project)

GALERIE

Here is a temporary video. I will add some better video material, as soon as I have time

Weiter Beitrag

Zurück Beitrag

© 2025 Martin Wepner

Thema von Anders Norén