Skip to content

A high-performance Smoothed Particle Hydrodynamics (SPH) fluid simulator implemented in Unity, capable of simulating 10,000 particles at 30 FPS on modest hardware.

License

Notifications You must be signed in to change notification settings

wendtpiotr/sph-fluid-simulation

Repository files navigation

Hydrodynamics SPH Simulator

image

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

Implementation Highlights

  • 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

Media

image image

Getting Started

  1. 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.

About

A high-performance Smoothed Particle Hydrodynamics (SPH) fluid simulator implemented in Unity, capable of simulating 10,000 particles at 30 FPS on modest hardware.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published