A high-performance Smoothed Particle Hydrodynamics (SPH) fluid simulator implemented in Unity, capable of simulating 10,000 particles at 30 FPS on modest hardware. Inspired by Sebastian Lague's tutorials and the scientific work in MDPI 2023: SPH Fluid Simulation.
shp2.mp4
Untitled.video.-.Made.with.Clipchamp.4.mp4
- Unity C# for simulation & rendering
- Custom Shader for particle colors and lighting
- MaterialPropertyBlock batching for efficient GPU uploads
- Kernel functions implemented directly in C# for easy modification:
- Poly6, Spiky gradient, Viscosity Laplacian
- Inspired by Sebastian Lague SPH tutorials
- Research paper: MDPI Applied Sciences, 2023
- Clone the repository:
git clone https://github.com/yourusername/hydrodynamics-sph.git
Open in Unity 2021.3+
Assign particleMaterial and collision layers in HydrodynamicsManager.
Hit Play to run simulation.