Coding a Realtime Fluid Simulation in Unity

Поделиться
HTML-код
  • Опубликовано: 1 авг 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)
  • РазвлеченияРазвлечения

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

  • @icantdrawhandss
    @icantdrawhandss Год назад

    its nice to have you back!

  • @batchprogrammer108
    @batchprogrammer108  Год назад +8

    Part 2 on Optimization (60,000 particles) : ruclips.net/video/9M72KrGhYuE/видео.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

  • @konka1906
    @konka1906 Год назад +1

    really great video quality

  • @evgeniipetrov2808
    @evgeniipetrov2808 Год назад

    epic comeback!

  • @venkatgopal2454
    @venkatgopal2454 Год назад

    Very good video 👍

  • @_yuri_n
    @_yuri_n Год назад +1

    Thanks , I really learned a lot from your video,Looking forward to your next video

  • @alejandrosainzmartinez9548
    @alejandrosainzmartinez9548 10 месяцев назад +2

    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.

  • @monotone5402
    @monotone5402 11 месяцев назад

    very nice

  • @pawartrader
    @pawartrader Год назад

    The King is Back.

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

    Is the fluid ray marching script responsible for making the particles look like water?

  • @tahaqazi376
    @tahaqazi376 4 месяца назад

    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?

  • @user-px5pj7ux5k
    @user-px5pj7ux5k Год назад

    how did distance times mass become density?

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

    I downloaded the base project and it doesn't work in the sample scene

  • @bike_n_fish
    @bike_n_fish Год назад

    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

  • @Smash_ter
    @Smash_ter Месяц назад

    Like the vid, but what theme are you using in your vscode?

  • @квадратя
    @квадратя Год назад

    OMG, extremely useful video. Please make a new one about optimization

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

    Hi does this work with URP?

  • @swalscha
    @swalscha Год назад +1

    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 🧐

    • @batchprogrammer108
      @batchprogrammer108  Год назад +1

      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 😁

    • @swalscha
      @swalscha Год назад

      @@batchprogrammer108 nice! I'd love to watch that 👌😁

  • @selimgonen
    @selimgonen Год назад

    Very nice. Please create an optimization and shader video as well!

    • @batchprogrammer108
      @batchprogrammer108  Год назад

      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 :)

    • @selimgonen
      @selimgonen Год назад

      @@batchprogrammer108 glad to hear :)

    • @batchprogrammer108
      @batchprogrammer108  Год назад

      As promised - ruclips.net/video/9M72KrGhYuE/видео.html

    • @selimgonen
      @selimgonen Год назад

      @@batchprogrammer108 cool, added to my watchlist :)

  • @monishdhayalan2552
    @monishdhayalan2552 Год назад +1

    cant open you channel man, it says channel page is missing

    • @icantdrawhandss
      @icantdrawhandss Год назад

      …but then how did you comment 🫣

    • @monishdhayalan2552
      @monishdhayalan2552 Год назад

      @@icantdrawhandss just got this video on my recommendtions, I wanted to see the other videos but still cant able to see them

    • @icantdrawhandss
      @icantdrawhandss Год назад

      @@monishdhayalan2552 ohhhh yeah right

  • @nimagames8639
    @nimagames8639 Год назад

    Hey Can you tell me how to make a fps shooter controller??
    I really want to make an fps controller with everything.
    Thanks.