# 2D GPU Fluid Sim

**URL:** <https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394>\
**Category:** Gallery\
**Created:** [January 4, 2019, 7:31pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394 "2019-01-04T19:31:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixfaire](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/felixfaire/32/168_2.png) [@felixfaire](https://discourse.libcinder.org/u/felixfaire)\
**Post date:** [January 4, 2019, 7:31pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/1 "2019-01-04T19:31:46Z")

</div>

Hey.

I just open sourced my GPU fluid sim on github [here](https://github.com/felixfaire/GPU-Fluid) if anyone is interested.

It is based entirely on @chaoticbob’s CPU version in the CinderFX block so credit to him but I hope the code and shaders might help someone else interested in learning how they work. You can see it in action [here](https://www.instagram.com/p/BhhFyjsnE2y/).

 ![fluid](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/1X/5bf8916e3d7fad38e9f6fc8586eb8836aeda7963.jpeg)

---

<div class="post-metadata">

**Author:** ![dashandslash](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/dashandslash/32/112_2.png) [@dashandslash](https://discourse.libcinder.org/u/dashandslash)\
**Post date:** [January 4, 2019, 11:49pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/2 "2019-01-04T23:49:30Z")

</div>

Hey Felix,

Nicely coded! I’ll give it a try next days.

I made a similar one few years ago ([https://github.com/DashAndSlash/Fluido](https://github.com/DashAndSlash/Fluido))  
With the intent to make it in 3D…well that didn’t happen yet 😅  
But I still would like to do it at some point…

Anyway, Well done!

---

<div class="post-metadata">

**Author:** ![timmb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/timmb/32/336_2.png) [@timmb](https://discourse.libcinder.org/u/timmb)\
**Post date:** [January 10, 2019, 3:10pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/3 "2019-01-10T15:10:15Z")

</div>

Are there any open source 3D fluid sims out there for GL?

(Also - looks really nice Felix!)

---

<div class="post-metadata">

**Author:** ![felixfaire](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/felixfaire/32/168_2.png) [@felixfaire](https://discourse.libcinder.org/u/felixfaire)\
**Post date:** [January 10, 2019, 3:28pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/4 "2019-01-10T15:28:51Z")

</div>

Somewhere in david li’s WebGL repos theres probably a couple (or at least multi layered 2D ones):

> **[dli/fluid](https://github.com/dli/fluid)**
>
> Fluid Particles - http://david.li/fluid. Contribute to dli/fluid development by creating an account on GitHub.

  
[http://david.li/midismoke/](http://david.li/midismoke/)

---

<div class="post-metadata">

**Author:** ![timmb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/timmb/32/336_2.png) [@timmb](https://discourse.libcinder.org/u/timmb)\
**Post date:** [January 10, 2019, 4:16pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/5 "2019-01-10T16:16:21Z")

</div>

Very nice. just lost half an hour.

---

<div class="post-metadata">

**Author:** ![navadria](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/navadria/32/90_2.png) [@navadria](https://discourse.libcinder.org/u/navadria)\
**Post date:** [January 22, 2019, 11:52pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/6 "2019-01-22T23:52:46Z")

</div>

@felixfaire I just see a white screen on a retina Macbook Pro (new model), running on Mojave. Any ideas?

---

<div class="post-metadata">

**Author:** ![felixfaire](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/felixfaire/32/168_2.png) [@felixfaire](https://discourse.libcinder.org/u/felixfaire)\
**Post date:** [January 23, 2019, 10:21am UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/7 "2019-01-23T10:21:17Z")

</div>

when you click or touch the touchpad you should see drops of black fluid on the white background. Though I havent tested it on the newer AMD macbooks… do you see any errors?

---

<div class="post-metadata">

**Author:** ![navadria](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/navadria/32/90_2.png) [@navadria](https://discourse.libcinder.org/u/navadria)\
**Post date:** [January 23, 2019, 6:45pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/8 "2019-01-23T18:45:45Z")

</div>

Yeah, in my older Macbook with an Nvidia GPU it works fine. In the newer one just the white screen, no errors except for this one that appears on both of them:

> 2019-01-23 10:42:53.897819-0800 GPUFluid[10707:6172118] [default] Unable to load Info.plist exceptions (eGPUOverrides)  
> 2019-01-23 10:42:54.023149-0800 GPUFluid[10707:6172117] MessageTracer: Falling back to default whitelist

---

<div class="post-metadata">

**Author:** ![felixfaire](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/felixfaire/32/168_2.png) [@felixfaire](https://discourse.libcinder.org/u/felixfaire)\
**Post date:** [January 25, 2019, 12:13pm UTC](https://discourse.libcinder.org/t/2d-gpu-fluid-sim/1394/9 "2019-01-25T12:13:37Z")

</div>

Ah thats irritating, I must have been spoiled by Nvidias more relaxed shader compiler. I’ve had a quick look through the shader files but nothing jumps out as particularly risky / non-standard. I also dont have an AMD machine currently to test some variations unfortunately.

Someone else may be able to advise on common glsl syntax pitfalls / gotchas between Nvidia and AMD.

Ps. Those output messages seem pretty standard even in empty projects i think.
