Тёмный

Optimizing our Realtime Fluid Simulation in Unity 

AJTech
Подписаться 8 тыс.
Просмотров 7 тыс.
50% 1

The last time I made a video about how to code a fluid simulation using SPH, it was pretty slow so I made this follow-up video that will hopefully help you understand how to optimize it using a dynamic hashed grid, 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 third part on how to realistically render this fluid in a performant way.
The editing on this one is a bit rough, was in a rush so please forgive me for that :)
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
Nvidia Dynamic Hashed Grids: on-demand.gputechconf.com/gtc...
Bitonic Merge Sort: • Bitonic Sort - Sorting...
Spatial Hashed Grids: • Spatial Hash Grids & T...
---
Timestamps
---
Intro: (0:00)
SPH Explanation: (0:34)
Dynamic Hashed Grid Explanation: (3:19)
Setting up for Optimization: (4:00)
Hashing Setup: (6:51)
Bitonic Merge Sort: (7:46)
Compute Cell Offsets: (8:55)
Density & Pressure Calculation: (14:13)
Apply Optimization: (10:38)
Testing & Bonus: (11:26)

Опубликовано:

 

25 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 23   
@batchprogrammer108
@batchprogrammer108 Год назад
Hey everyone hope you enjoyed this follow-up video on fluid simulations, if you have any questions or comments leave them down below. If you're interested in another part to this series let me know as well!
@ahmedsalih2308
@ahmedsalih2308 8 месяцев назад
I would be interested in a Part 3! Especially the neighbour searching approach.
@grayliar147
@grayliar147 7 месяцев назад
Me too ​@@ahmedsalih2308
@petermaltzoff1684
@petermaltzoff1684 5 месяцев назад
Fascinating video! I'd love to see more in this series.
@camsterdragon
@camsterdragon Месяц назад
Just got into your videos after watching parts one and part two of this series. Your explanations at the beginning are very helpful, and the code is laid out in an easy-to-read way and seems really adaptable, which is amazing. Very impressed
@batchprogrammer108
@batchprogrammer108 Месяц назад
Thanks that means a lot! :D
@valk1521
@valk1521 Год назад
This is some top tier business sir, you are doing gods work. Please please please make the screen space shader!
@thewarhelm
@thewarhelm Год назад
Another optimization you could try is creating a 3D dispatch size and thread group and use shared memory. This way all threads would access data from shared memory rather than global memory and improve memory bandwidth. You might need to play around with the thread group size to get better performance.
@_yuri_n
@_yuri_n Год назад
Finally,We See the great Video
@user-px5pj7ux5k
@user-px5pj7ux5k Год назад
Very nice Sir!Please make also a fluid grid simulation tutorial, not a particles but just vector arrows.😊
@masteryoyo1510
@masteryoyo1510 Год назад
first!!! and thanks for tutorials mate!!!
@petarnedeljkovic6507
@petarnedeljkovic6507 8 месяцев назад
Hi AJ, I am very glad how far you have come and working with ThomasBrush! Are you still planning to release on the unity asset store FPS controller?
@angiemon897
@angiemon897 10 месяцев назад
This looks so amazing!!!!! :) I'm an artist dumdum, but can this be used in an "actual" game (with toon graphics, so can be way tweaked down)?
@batchprogrammer108
@batchprogrammer108 10 месяцев назад
Absolutely! On my GitHub I actually have a branch where I turned the water into lego pieces for fun and it was much cheaper to render as well. Would love to see what you do with it, so please leave a comment with some examples if you end up using it :D
@iaxsgames6029
@iaxsgames6029 8 месяцев назад
@batchprogrammer108 Ok, I am sorry for asking you on this video but on your nerual network video, is it possible so the "AI" gets a reward if it copleates it the track and if it goes around the track faster it gets a bigger award?
@kadircalloglu2848
@kadircalloglu2848 8 месяцев назад
I am thinking of creating a game in the style of Royal match, essentially a match-3 game. I would like to incorporate a fluid structure in some levels to navigate through the board. Can I use this system, or do I need to use a different structure?
@batchprogrammer108
@batchprogrammer108 8 месяцев назад
Hey! I think SPH might be overkill for what you're trying to do, here's another one of my GitHub repositories which is using a simpler version of fluid simulations which just uses the Navier Stokes equation, it's a lot more efficient and can be run on bigger grids github.com/AJTech2002/Realtime-Fluid-Simulation This is the paper I referenced for that repo: graphics.cs.cmu.edu/nsp/course/15-464/Fall09/papers/StamFluidforGames.pdf Hope this helps!
@kadircalloglu2848
@kadircalloglu2848 8 месяцев назад
Thanks so much for sharing with me @@batchprogrammer108
@thedynoxx
@thedynoxx Год назад
Can you run the simulation with Unity DOTS?
@batchprogrammer108
@batchprogrammer108 Год назад
You can but something like this would run much faster on a compute shader, especially since in future you'll need to take this data to the GPU so that you can render it to look like actual water. Since this is already on the GPU it will be much more performant :)
@FWpapo
@FWpapo Год назад
how the frick ppl do this? im trying to make game and its hard and here AJ makes this xd I feel really stupid :D
@pureay2700
@pureay2700 Год назад
A lot of us game devs who like making super good niche things typically spend an outrageous amount of time on just one thing you know. Like I've been making a voxel engine for my game forever
@batchprogrammer108
@batchprogrammer108 Год назад
Don't put yourself down man! I spent months researching and getting my head around this, I felt really dumb because I couldn't understand it for ages, it's just a niche topic but making a whole game is much harder. Good luck on your game 😁
Далее
Coding Adventure: Simulating Fluids
47:52
Просмотров 1,7 млн
Coding a Fluid Simulation with my Last 2 Brain Cells
4:24
Get STARTED With Shadergraph in Unity
16:28
Просмотров 10 тыс.
Beautiful Fluid Simulations...In Just 40 Seconds! 🤯
5:04
Ocean waves simulation with Fast Fourier transform
14:26
Coding Challenge #132: Fluid Simulation
54:31
Просмотров 634 тыс.
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 696 тыс.
Deep dive into the HDRP water system - Tutorial
12:18