new in 2020.06
3D Fluid SimulationSPH fluid simulation with a dynamic boundary.
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.
- CMakeLists.txt
- configure.h.cmake
- DrawableObjects/
FlatShadeObject.h - DrawableObjects/
ParticleGroup.cpp - DrawableObjects/
ParticleGroup.h - DrawableObjects/
WireframeObjects.h - FluidSimulation3DExample.cpp
- resources.conf
- SPH/
DomainBox.cpp - SPH/
DomainBox.h - SPH/
SPHKernels.h - SPH/
SPHSolver.cpp - SPH/
SPHSolver.h - Shaders/
ParticleSphereShader.cpp - Shaders/
ParticleSphereShader.h - Shaders/
ParticleSphereShader.frag - Shaders/
ParticleSphereShader.vert - TaskScheduler.h
- ThreadPool.h
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.