Coding a Realtime Fluid Simulation in Unity
Vložit
- čas přidán 26. 06. 2024
- Got really curious about Realtime Fluid Simulations and I put together this video that will hopefully help you understand how it all works, the core technology used is Smoothed Particle Hydrodynamics, and everything is written from scratch in Unity using C# and Compute Shaders.
If this video gains some interest I'll release a second part about optimization and making the fluid look cooler, just leave a comment down below if you're interested.
Also tried a new editing style, and would love some feedback. It's been a while since I released a video so thanks to everyone who's supported me so far :)
I'll see you all next time ✌
---
Project Links
---
GitHub: github.com/AJTech2002/SPH-Uni...
Base Project: github.com/AJTech2002/SPH-Uni...
FluidRayMarching.cs : github.com/AJTech2002/SPH-Uni...
---
Information Links
---
SPH Paper: matthias-research.github.io/p...
Sebastian Lague Raymarching: • Coding Adventure: Ray ...
Thread Groups Medium Article: / compute-shader-indices
---
Timestamps
---
Intro: (0:00)
SPH Explanation: (0:45)
Project Setup: (4:22)
Initializing Particles: (5:03)
Compute Shader Setup: (9:24)
Integrate Function: (10:33)
Linking Compute Shader: (12:09)
Density & Pressure Calculation: (14:13)
Force Calculations: (16:45)
Testing: (20:25)
External Forces: (21:07)
Raymarching Setup: (21:48)
Outro: (22:43) - Zábava
its nice to have you back!
really great video quality
Part 2 on Optimization (60,000 particles) : czcams.com/video/9M72KrGhYuE/video.html
Hey everyone, hope you enjoyed the video! I'd love to help with any questions or issues you have with the video so just leave a comment if you need something :) If you are wondering about how to optimize this code I have a branch on the GitHub with the optimization implemented github.com/AJTech2002/Smoothed-Particle-Hydrodynamics/tree/feat/optimization
thx for sharing
This video was just perfect, keep it on !
epic comeback!
Thanks , I really learned a lot from your video,Looking forward to your next video
Thanks, currently editing the optimization video :)
Very good video 👍
The King is Back.
much love bro
very nice
Love the content, thanks for sharing your knowledge!
Does the kernel also take surface tension into account ? From the poly6 representation I suppose it does but by the visualization only it doesn't seem to be the case 🧐
I actually didn't implement surface tension in this video because it's a little more difficult but I do plan to make a continuation tutorial for that 😁
@@batchprogrammer108 nice! I'd love to watch that 👌😁
OMG, extremely useful video. Please make a new one about optimization
Will do!
@@batchprogrammer108 I m really interested about building bvh trees for optimization using gpu.
Hi! I have an URP project and i don't know how can i adapt the shaders in the project to work properly. I tried to upgrade the shaders but apparently this can't be done in custom shaders. Can someone tell me where can i learn to do this? Or if someone can provide an URP version of the shaders it would be very helpful.
Is the fluid ray marching script responsible for making the particles look like water?
Hey, thanks for this tutorial that was insane !
11:36 nazi pro tip : if particleMass is constant, then 1f / particleMass is a constant too
force * (1f / particleMass) will be faster to compute :P
True! I'll keep it in mind next time 🤙
Very nice. Please create an optimization and shader video as well!
I've added optimization into the GitHub on this branch (github.com/AJTech2002/Smoothed-Particle-Hydrodynamics/tree/feat/optimization) incase you're interested, currently working on the video :)
@@batchprogrammer108 glad to hear :)
As promised - czcams.com/video/9M72KrGhYuE/video.html
@@batchprogrammer108 cool, added to my watchlist :)
how did distance times mass become density?
Hi does this work with URP?
I downloaded the base project and it doesn't work in the sample scene
How we can enable this fluid to flow? actually i am working on a project "Fluid dynamics Experiment demonstration" where I am trying to create a environment where we can simulate fluid dynamics experiments like demonstration pf "water turbulence" or "Calculation of fluid flow". for that I need a realistic fluid simulation something similar to this video. Is there someone who can help me with this and guide me?
cant open you channel man, it says channel page is missing
…but then how did you comment 🫣
@@icantdrawhandss just got this video on my recommendtions, I wanted to see the other videos but still cant able to see them
@@monishdhayalan2552 ohhhh yeah right
Hey Can you tell me how to make a fps shooter controller??
I really want to make an fps controller with everything.
Thanks.