Coding a Realtime Fluid Simulation in Unity [Pt. 2]

preview_player
Показать описание
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
---
---
Information Links
---
---
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)
Рекомендации по теме
Комментарии
Автор

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!

batchprogrammer
Автор

Fascinating video! I'd love to see more in this series.

petermaltzoff
Автор

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

camsterdragon
Автор

This is some top tier business sir, you are doing gods work. Please please please make the screen space shader!

valk
Автор

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.

thewarhelm
Автор

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?

petarnedeljkovic
Автор

Very nice Sir!Please make also a fluid grid simulation tutorial, not a particles but just vector arrows.😊

JehanSaren
Автор

This looks so :)
I'm an artist dumdum, but can this be used in an "actual" game (with toon graphics, so can be way tweaked down)?

angiemon
Автор

@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?

iaxsgames
Автор

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?

kadircalloglu
Автор

first!!! and thanks for tutorials mate!!!

masteryoyo
Автор

Can you run the simulation with Unity DOTS?

thedynoxx
Автор

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

FWpapo