Examples and tutorials » 3D Fluid Simulation new in 2020.06

SPH fluid simulation with a dynamic boundary.

Image

A basic implementation of SPH (Smoothed-Particle Hydrodynamics) solver. In order to run in real time, accuracy has been heavily sacrificed for performance. See also 2D Fluid Simulation, which runs real-time just in a single thread.

Controls

  • mouse drag rotates the view
  • Shift mouse drag pans the view
  • mouse wheel zooms in/out
  • H shows / hides the overlay
  • R resets the simulation
  • Space pauses the simulation

Credits

This example was originally contributed by Nghia Truong.

Source

Full source code is linked below and also available in the magnum-examples GitHub repository. This example depends on the ImGuiIntegration library which is not a part of the core Magnum repository, see its documentation for usage instructions.

The ports branch contains additional patches for Emscripten support that aren't present in master in order to keep the example code as simple as possible.