Coding Adventure: Simulating Fluids
Let's try to convince a bunch of particles to behave (at least somewhat) like water. Written in C# and HLSL, and running inside the Unity engine. Support my...

Sebastian Lague
2.4M views • Oct 8, 2023

About this video
Let's try to convince a bunch of particles to behave (at least somewhat) like water.
Written in C# and HLSL, and running inside the Unity engine.
Support my work (and get early access to new videos and source code) on Patreon or Nebula
* Patreon: https://www.patreon.com/SebastianLague
* Nebula: https://go.nebula.tv/sebastianlague
Source code:
* GitHub: https://github.com/SebLague/Fluid-Sim/tree/Episode-01
Check out my other fluid simulation videos:
https://youtube.com/playlist?list=PLFt_AvWsXl0dJrPelwdVSMVC_MDTYPJWn&si=Z5cOCDSI1aS4fe_C
Credits and References:
* https://matthias-research.github.io/pages/publications/sca03.pdf
* https://web.archive.org/web/20250106201614/http://www.ligum.umontreal.ca/Clavet-2005-PVFS/pvfs.pdf
* https://sph-tutorial.physics-simulation.org/pdf/SPH_Tutorial.pdf
* https://web.archive.org/web/20140725014123/https://docs.nvidia.com/cuda/samples/5_Simulations/particles/doc/particles.pdf
* Music: https://github.com/SebLague/Misc-Project-Info/blob/main/Coding-Adventures/Fluid-Sim.txt
Chapters:
0:00 Intro
0:27 Gravity and Collisions
2:31 Smoothed Particles
3:55 Calculating Density
7:53 The Interpolation Equation
11:58 Gradient Calculations
15:38 The Pressure Force
19:19 Trying to Make it Work...
22:05 Optimizing Particle Lookups
26:31 Spatial Grid Code
27:48 Position Predictions
30:32 Mouse Force
33:22 Artificial Viscosity
36:46 Pressure Problems
39:51 Bugs
41:06 Parallel Sorting
43:22 Some Tests and Experiments
44:47 The Third Dimension
47:23 Outro
Written in C# and HLSL, and running inside the Unity engine.
Support my work (and get early access to new videos and source code) on Patreon or Nebula
* Patreon: https://www.patreon.com/SebastianLague
* Nebula: https://go.nebula.tv/sebastianlague
Source code:
* GitHub: https://github.com/SebLague/Fluid-Sim/tree/Episode-01
Check out my other fluid simulation videos:
https://youtube.com/playlist?list=PLFt_AvWsXl0dJrPelwdVSMVC_MDTYPJWn&si=Z5cOCDSI1aS4fe_C
Credits and References:
* https://matthias-research.github.io/pages/publications/sca03.pdf
* https://web.archive.org/web/20250106201614/http://www.ligum.umontreal.ca/Clavet-2005-PVFS/pvfs.pdf
* https://sph-tutorial.physics-simulation.org/pdf/SPH_Tutorial.pdf
* https://web.archive.org/web/20140725014123/https://docs.nvidia.com/cuda/samples/5_Simulations/particles/doc/particles.pdf
* Music: https://github.com/SebLague/Misc-Project-Info/blob/main/Coding-Adventures/Fluid-Sim.txt
Chapters:
0:00 Intro
0:27 Gravity and Collisions
2:31 Smoothed Particles
3:55 Calculating Density
7:53 The Interpolation Equation
11:58 Gradient Calculations
15:38 The Pressure Force
19:19 Trying to Make it Work...
22:05 Optimizing Particle Lookups
26:31 Spatial Grid Code
27:48 Position Predictions
30:32 Mouse Force
33:22 Artificial Viscosity
36:46 Pressure Problems
39:51 Bugs
41:06 Parallel Sorting
43:22 Some Tests and Experiments
44:47 The Third Dimension
47:23 Outro
Video Information
Views
2.4M
Likes
97.7K
Duration
47:52
Published
Oct 8, 2023
User Reviews
4.8
(478) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends