11 releases (breaking)

0.9.0 Feb 11, 2024
0.7.0 Aug 8, 2021
0.6.0 Jan 29, 2021
0.5.0 Nov 30, 2020
0.1.1 Nov 1, 2019

#1571 in Game dev


Used in nphysics_testbed3d

Apache-2.0

245KB
5K SLoC

crates.io

crates.io (salva2d) crates.io (salva3d) Build status

Users guide | 2D Documentation | 3D Documentation | Forum


Salva is a 2 and 3-dimensional particle-based fluid simulation engine for games and animations. It uses nalgebra for vector/matrix math and can optionally interface with nphysics for two-way coupling with rigid bodies, multibodies, and deformable bodies. 2D and 3D implementations both share (mostly) the same code!

Examples are available in the examples2d and examples3d directories. Because those demos are based on WASM and WebGl 1.0 they should work on most modern browsers. Feel free to ask for help and discuss features on the official user forum.

Why the name Salva?

The name of this library is inspired from the famous surrealist artist Salvador Dalì. The logo of Salva is inspired from its renown painting The Persistence of Memory.

Features

  • Pressure resolution: DFSPH and IISPH.
  • Viscosity: DFSPH viscosity, Artificial viscosity, and XSPH viscosity.
  • Surface tension: WCSPH surface tension, and methods from He et al. 2014 and Akinci et al. 2013
  • Elasticity: method from Becker et al. 2009
  • Multiphase fluids: mix several fluids with different characteristics (densities, viscosities, etc.)
  • Optional two-way coupling with bodies from nphysics.
  • WASM support

Dependencies

~3–43MB
~695K SLoC