Real-time Eulerian fluid simulation on a Macbook Air, using GPU shaders

Поделиться
HTML-код
  • Опубликовано: 25 дек 2023
  • In order to implement fluid simulation we need to implement conservation of mass, incompressibility, and conservation of momentum. How to do this, using Eulerian cell representation, on GPU shaders?
  • НаукаНаука

Комментарии • 72

  • @Kevin-jz9bg
    @Kevin-jz9bg 10 дней назад +25

    That was one of the best explanations for advection I've seen online! Especially the pushing bubbles out of a phone screen protector analogy.

    • @rlhugh
      @rlhugh  10 дней назад +2

      Thank you very much! Very much appreciated :)

  • @jonsonj5249
    @jonsonj5249 День назад +4

    love the experimental feel to how you moved forward itteration by itteration,

  • @mikhailhumphries
    @mikhailhumphries 6 дней назад +8

    Can't believe I watched entire video about coding and didn't get bored

  • @samaltschul4605
    @samaltschul4605 5 месяцев назад +25

    Hugh, the standard first book on PDE is Walter Strauss's book. If you want to try questions on me I'm happy to help out.

  • @SpeedyGwen
    @SpeedyGwen 8 дней назад +10

    first thing I thought about when I clicked on this video is about The Powder Toy which is a pixel based particle simulator game which actually has that exact same type of fluid simulation for simulating air in the game

    • @rlhugh
      @rlhugh  8 дней назад +1

      Interesting! Thank you!

  • @anonymouscommentator
    @anonymouscommentator 9 дней назад +5

    loved the video! feels like discovering sebastian lagues yt channel all over again :)

    • @rlhugh
      @rlhugh  9 дней назад +1

      Wow, that's a very nice thing to say. I feel like I can die happy now. I mean, unfortunately this is my least bad video to date, and you will be disappointed if you watch any of my others, but it's still very nice to hear these words :)

  • @Cmanorange
    @Cmanorange 4 месяца назад +9

    very good video. i'm glad you showed or mentioned what approaches didn't work

  • @hyperFixationStudios
    @hyperFixationStudios 5 месяцев назад +5

    Great work, I can't wait to see your next simulations!

  • @justinsciullo3342
    @justinsciullo3342 17 дней назад +6

    This is so cool, and you did a great job with the video editing! I hope you make more videos like this!

    • @rlhugh
      @rlhugh  17 дней назад +2

      Thank you! That's very kind to say. Very much appreciated :)

  • @santiagobirkenstock
    @santiagobirkenstock 18 дней назад +8

    I wish the very best on RUclips, I am so glad I discovered your channel. Keep up the good work !

  • @PAPERSCHOOL
    @PAPERSCHOOL 5 месяцев назад +5

    Really well produced, nice work

  • @Theo-iz5cj
    @Theo-iz5cj 4 месяца назад +1

    Great and inspiring video, thanks a lot!

  • @veritas7010
    @veritas7010 11 дней назад +2

    I love this, thank you for makin my day on yt much better!

    • @rlhugh
      @rlhugh  11 дней назад

      Thank you very much!

  • @benjaminlehmann
    @benjaminlehmann 14 дней назад +1

    I loved this video! Really inspiring, and I'm sort of amazed that this was running on a macbook air too - great job :D Thanks so much for sharing.

    • @rlhugh
      @rlhugh  14 дней назад

      Thank you very much!

  • @HitAndMissLab
    @HitAndMissLab 17 дней назад +1

    Thanks for the beautiful video.

  • @jomazu7874
    @jomazu7874 23 часа назад +2

    i bet this would run much better on a gpu with a cooling system and more than 10 cores (or whatever your model of macbook has)

  • @saadahmed688
    @saadahmed688 5 месяцев назад +2

    Subbing cause I wanna see you simulate the inside of Earth. Great content

  • @tommycard4569
    @tommycard4569 14 дней назад +2

    educational and entertaining! loved it, thank you

    • @rlhugh
      @rlhugh  14 дней назад

      Thank you!

  • @CalcWithDec
    @CalcWithDec 20 дней назад +1

    Beautiful!

  • @tahmidchoudhury8946
    @tahmidchoudhury8946 5 месяцев назад +2

    Got recommended.....now in love

  • @Kyler1Ace
    @Kyler1Ace 3 месяца назад +1

    Great video

  • @FromLake
    @FromLake 4 дня назад +1

    Thank you for this video

    • @rlhugh
      @rlhugh  4 дня назад +1

      Thank you!

  • @Tordek
    @Tordek 15 дней назад +1

    regarding the parallel part: would it be feasible to work the opposite way? Instead of writing to 4 cells, each cell would instead read from 4 neighbors and update itself.

  • @janerikjakstein
    @janerikjakstein 4 дня назад +2

    Awesome 👍

    • @rlhugh
      @rlhugh  4 дня назад

      Thank you!

  • @naztar4323
    @naztar4323 5 дней назад +2

    You could have used MultiGrid for the solver since it land it self to parallelism better

    • @rlhugh
      @rlhugh  5 дней назад

      Yes. Potentially a topic for a next video :)

  • @incription
    @incription День назад +1

    this thumbnail is better

  • @qfurgie
    @qfurgie День назад +3

    me: 50 frames per second that’s pretty bad performance
    RL: *”on my MacBook Air”*
    thats CRAZY

    • @D.S69
      @D.S69 9 часов назад

      50 fps is bad?

  • @sapiosuicide1552
    @sapiosuicide1552 10 дней назад +1

    Cool

  • @blitzguitar
    @blitzguitar 10 часов назад

    Imagine the kind of simulation you could do with a 4090 over the mac book.

  • @tselhamishac5910
    @tselhamishac5910 5 дней назад +1

    Nice

    • @rlhugh
      @rlhugh  5 дней назад

      Thank you!

  • @josiahjoel7580
    @josiahjoel7580 28 дней назад

    this is so cool, is it possible to upload the source code to a public repo?

  • @dovos8572
    @dovos8572 2 дня назад +1

    11:11 that looks like the lines of a magnet.

  • @drpwnage23
    @drpwnage23 3 месяца назад +1

    This is really cool. Do you have a github repo available for this?

    • @rlhugh
      @rlhugh  3 месяца назад +3

      I probably should do that yeah...

  • @NobodyYouKnow01
    @NobodyYouKnow01 7 дней назад

    No way Euler got named for a fluid dynamics problem. We're supposed to name the problem after the *second* person to solve it!

  • @cashkurtz5780
    @cashkurtz5780 8 дней назад

    So persistent zero velocity is like a solid object? I wish it were easier to see it against an unmoving background .

    • @rlhugh
      @rlhugh  8 дней назад

      Yes, that's right. As far as the coloring scheme, definitely open to suggestions. Won't affect this video, since cannot modify published videos. But could be useful for future videos.

  • @redstoneready697
    @redstoneready697 27 дней назад +1

    do you think this could be used for electromagetics?

    • @rlhugh
      @rlhugh  27 дней назад

      Interesting question!

    • @YaofuZhou
      @YaofuZhou 23 дня назад +3

      Depending on what you want. I guess you want to iteratively compute the EM fields?

    • @XGD5layer
      @XGD5layer 2 дня назад

      Some of the simulations definitely looked like simple 2d magnetic fields

  • @user-fj9hf4bu9f
    @user-fj9hf4bu9f 3 дня назад

    no links to the code?

  • @kwccoin3115
    @kwccoin3115 15 дней назад

    How do you run these shader ? Can it use under sdl2?

    • @rlhugh
      @rlhugh  15 дней назад

      These are running in Unity, using HLSL.

  • @wokeupina
    @wokeupina 9 дней назад

    wait you need a macbook pro to do pro stuff?? (looks sexy)

    • @rlhugh
      @rlhugh  9 дней назад

      I'm using a MacBook air m2

  • @samwolfe1000
    @samwolfe1000 2 дня назад

    Which method is cheaper to run?

    • @rlhugh
      @rlhugh  2 дня назад

      You mean for Lagrangian vs Eulerian? Eulerian is faster/cheaper.

    • @samwolfe1000
      @samwolfe1000 2 дня назад

      @@rlhugh Sorry for the vagueness, I meant for particle - vs vector based

  • @tomd6410
    @tomd6410 18 дней назад +2

    Love this but if that’s how you say Euler I’ve been saying it wrong all this time 💀💀

    • @rlhugh
      @rlhugh  18 дней назад

      I did research the pronunciation. There are a couple of ways. Before I researched the pronunciation, I was saying "you lurr Ian". But "oiler Ian" appeared to be more common, as far as I could see? How are you thinking if should be pronounced?

    • @tomd6410
      @tomd6410 17 дней назад

      @@rlhugh I’ve been saying youll-lah 😅

    • @rlhugh
      @rlhugh  17 дней назад +1

      @@tomd6410 actuuaaalllyyy seems that it might depend on us vs UK pronunciation, eg see youglish.com/pronounce/eulerian/english/uk

    • @unepintade
      @unepintade 14 дней назад +1

      ​@@tomd6410i feel like "name"-ian in English are pronounced very differently from how you pronounce the name so while Euler is pronounced weirdly, eulerian is pronounced how you would expect, like Laplace and Laplacian

    • @landsgevaer
      @landsgevaer 3 дня назад

      Oy-lear-ean, surely...?

  • @ethos8863
    @ethos8863 2 дня назад

    rather than updating a bunch of nonadjacent cells why don't you store two buffers, and instead of changing a cell's neighbors, instead calculate how a cell is affected by its neighbors, and write that into the second buffer.

    • @rlhugh
      @rlhugh  19 часов назад

      Do you mean, in the projection step? Because we aren't updating the cells: we are updating the walls of each cell. And each wall is attached to two cells. There isn't a way of updating one cell without updating its neigbor, because we aren't really updating the cells: we are updating the walls. When we choose 'a cell', what we are doing is updating all 4 walls of that cell. Then, you might say, can we select arbitrary walls? Well, no, because the update of 4 walls around a cell is based on ensuring incompressiblity of the fluid entering and leaving that one cell, but the updates themselves are applied to the walls, not to the cell. There is no way then to update two adjacent cells, because we'd be updating the same wall twice, i.e. the wall in between the two cells. Having a buffer doesn't really change that. Let's imagine we update the walls around cell A, into buffer 2. Now, when we calculate the walls around adjacent cell B, we'll need to read the values from buffer 2, in order to have the up to date value for the shared cell wall. So, it's sequential, not parallel. Not sure to what extent that answers your question?

  • @Leviathan_22
    @Leviathan_22 Месяц назад +2

    "shaders are fun" consider me an opp