Coding Adventure: Simulating Fluids

Sebastian Lague October 8, 2023
Video Thumbnail

About

No channel description available.

Video Description

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

Master Fluid Simulation Today

AI-recommended products based on this video

Loading...
EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

(122)
$15.99
FREE delivery Mon, Feb 16 on your first order
Loading...
ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

(10)
$4,269.00
FREE delivery Feb 24 - Mar 5
Loading...
Lenovo Legion Pro 5 16" WQXGA 165Hz Gaming Laptop, AMD Ryzen 9 9955HX, GeForce RTX 5070, 32GB DDR5, 3TB Storage (2TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, WiFi 7, Win 11, Black

Lenovo Legion Pro 5 16" WQXGA 165Hz Gaming Laptop, AMD Ryzen 9 9955HX, GeForce RTX 5070, 32GB DDR5, 3TB Storage (2TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, WiFi 7, Win 11, Black

(2)
$3,199.00
FREE delivery Feb 24 - Mar 5
Loading...
GEEKOM A7 Max Mini PC (Flagship Level Performance), AMD Ryzen 9 7940HS (Up to 5.2GHz),Mini Computer 16GB DDR5 RAM and 1TB PCIe 4.0 SSD, Windows 11 Pro, Quad 8K Display, USB4, Dual 2.5G LAN, Wi-Fi 6E

GEEKOM A7 Max Mini PC (Flagship Level Performance), AMD Ryzen 9 7940HS (Up to 5.2GHz),Mini Computer 16GB DDR5 RAM and 1TB PCIe 4.0 SSD, Windows 11 Pro, Quad 8K Display, USB4, Dual 2.5G LAN, Wi-Fi 6E

(115)
$1,199.00
FREE delivery Sat, Jan 3
Loading...
GEEKOM A8 AI Mini PC (3-Year Quality Support) with AMD Ryzen 9 8945HS Mini Computers, 32GB DDR5 RAM&2TB M.2 2280 NVMe Gen4*4 SSD, Windows 11 Pro Mini Desktop, WiFi 6E/BT5.2/USB4/8K/Quad Display

GEEKOM A8 AI Mini PC (3-Year Quality Support) with AMD Ryzen 9 8945HS Mini Computers, 32GB DDR5 RAM&2TB M.2 2280 NVMe Gen4*4 SSD, Windows 11 Pro Mini Desktop, WiFi 6E/BT5.2/USB4/8K/Quad Display

(215)
$1,159.40
FREE delivery Sun, Aug 10
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Logitech G305 Lightspeed Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech G305 Lightspeed Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

(35,879)
$49.99$44.99
FREE delivery Mon, Jan 26
1K+ bought in past month
Loading...
Dell 27 Plus 4K Monitor - S2725QS - 27-inch 4K (3840 x 2160) 120Hz 16:9 Display, IPS Panel, AMD FreeSync Premium, sRGB 99%, Integrated Speakers, 1500:1 Contrast Ratio, Comfortview Plus - Ash White

Dell 27 Plus 4K Monitor - S2725QS - 27-inch 4K (3840 x 2160) 120Hz 16:9 Display, IPS Panel, AMD FreeSync Premium, sRGB 99%, Integrated Speakers, 1500:1 Contrast Ratio, Comfortview Plus - Ash White

(13)
$309.99$297.59
FREE delivery Tue, Oct 7
200+ bought in past month
Loading...
KOORUI 27 Inch 4K Monitor, UHD(3840 x 2160) IPS Computer Monitors, HDR10, 90% DCI-P3, Frameless, 2X HDMI 2.0 & DisplayPort 1.4, VESA Mountable, Eye Care, N07

KOORUI 27 Inch 4K Monitor, UHD(3840 x 2160) IPS Computer Monitors, HDR10, 90% DCI-P3, Frameless, 2X HDMI 2.0 & DisplayPort 1.4, VESA Mountable, Eye Care, N07

(6,421)
$219.99
FREE delivery Sun, Aug 10
100+ bought in past month
Loading...
MAGICRAVEN 4K Portable Monitor 13.3" - 3840 * 2160 UHD IPS Portable Screen Laptop Monitor, Slim Lightweight Dual USB C HDMI Computer Monitor Gaming Display with Speakers, Travel Monitor for PC Phone

MAGICRAVEN 4K Portable Monitor 13.3" - 3840 * 2160 UHD IPS Portable Screen Laptop Monitor, Slim Lightweight Dual USB C HDMI Computer Monitor Gaming Display with Speakers, Travel Monitor for PC Phone

(795)
$223.99
FREE delivery Sun, Aug 10
Loading...
4K Portable Monitor, MAGICRAVEN 15.6inch UHD 3840×2160 100% sRGB Portable Gaming Monitor, USB-C Mini HDMI External Second Monitor Portable with Speakers for Laptop MacBook Switch PS5/4 Xbox

4K Portable Monitor, MAGICRAVEN 15.6inch UHD 3840×2160 100% sRGB Portable Gaming Monitor, USB-C Mini HDMI External Second Monitor Portable with Speakers for Laptop MacBook Switch PS5/4 Xbox

(802)
$251.99
FREE delivery Tue, Aug 12
Loading...
Intel Core i9-12900KF Desktop Processor 16 (8P+8E) Cores up to 5.2 GHz Unlocked LGA1700 600 Series Chipset 125W

Intel Core i9-12900KF Desktop Processor 16 (8P+8E) Cores up to 5.2 GHz Unlocked LGA1700 600 Series Chipset 125W

(949)
$459.95