Geometry nodes FLIP fluid simulator

Hey everyone,

I don’t share much (this is probably my second or third time), but here is a FLIP fluid simulator made entirely in geometry nodes, based on this tutorial. I started using this file by Badnormals as a base but ended up rebuilding the whole thing. There’s both 2D and 3D versions. The 3D version is nowhere near as fast as Blender’s native fluid sim I’m afraid (I’m only getting about 4 fps realtime) but you can always bake it. Maybe someone can optimize it further. They both support collisions. Inflow and outflow are both pretty easy to implement too, simply by adding/removing points during the simulation. Enjoy!

fluid 2d

FLIP fluid 2D.blend (2.6 MB)
FLIP fluid 3D.blend (2.7 MB)


I tried to optimize file with 3d simulation. Mainly there is some ways to do that:

  1. Capture fields on geometry. Only math-like things can share the same inputs.
    Lets say there is A field that putted into multiple Mix nodes. In result, A will be evaluated only once (in one result Store Named Attribute node). But if you’ll put A in to to Accumulate Field node then A will be computed multiple times. This is true for: Evaluate at Index, Evaluate on Domain, Blur Attribute, Accumulate Field, Index of Nearest. If you want to put one filed into multiple such nodes its better to cature this first.
  2. Avoid Raycast node. This is very slow node on large amount of data. The best way to void this, as i can see, here this node is used to avoid index math. Its better to use just index math and store everything on the grid of points instead of use Raycast to sample and interpolate values between elements of the grid.
  3. If you want to store and access to the values of vectors by components, it’s better to just store them in separate float attributes.

Thanks for the advice! I’ll try that. I especially like the part about the accumulate field node, I didn’t know that.
It’ll be really tedious to replace the raycast with index math though since I’m using two raycast nodes to interpolate between 8 vertices. Doing 8 vertices separately will be a lot of work and I’m not sure it would be much lighter.
Regarding storing vector components, it’s only velocity that I store as vector and I process it as a vector most of the time, except for wall collisions.

1 Like

On an unrelated note, do you have any idea why the timings are not showing up on most of the nodes? I wanted to know which nodes are the slowest.

1 Like

Timings are only on the nodes in the zones (for simulation zone, frames != 1 would mean timings on external nodes will be gone). In latest 4.2/4.3 blender versions there is also fix of that timings in the zones. So i can see everything. Not sure how that looks for you.

1 Like

Ah got it. I don’t see any timings inside the sim zone on 4.1. Looks like I won’t wait for the 4.2 stable release after all!

I downloaded 4.2 beta but I’m still not seeing any timings except for nodes after the simulation zone!


Never mind! I’d forgotten to delete the bake! :laughing: