Fluid Animation with forces and collision

Hi community people out there,

I am sitting on a task which drives me crazy. I want to animate a wobbly bubble, which can be pulled to certain direction with forces and is having a collision behaviour to an other bubble.

I was thinking to use Fuse, taking some circleSDFs and give them collition features. Than I have swarm of circles or particles, but what I need is one form surrounding this particle swarm.
May be writing a shader for the form?

I was thinking about a simple way too. Like having some points and a B-Spline around them and a simplex Noise for the animation, using fuse for forces and collision. But how to avoid, that point are staying in the right circular order to not have the b-spline form making loops. here a quick drawing.

Do you have any ideas?

thank you for help

first of all, i guess this is a 2D problem right?
in this case you could define a 2D particles system (you could start from some example from the vl.animation.particlesystem nuget) in which:

  • there are 2 groups of particles (each one representing one of the fluid blobs)
  • each group of particles have a cohesion force (particles of the same group attract each others)
  • all particles maintain a minimum distance from the others (basic collision)
  • you can set an attractor per group so that you drive around the two bubbles independently

then you would render them using 2d SDF circles, combining them spectrally, adjusting the merge smooth parameter to get something like metaballs.
you can do this for each of the two groups independently, to avoid having the “metaballs” merging.
it’s up to you then to render these bubble as you want, using the SDF just to draw the perimeter of the bubble of to Fill it…

1 Like

btw, the same approach can be applied in a 3D domain

cool, thanks. I was missing the possibility, that the particles could have cohesion forces and attract each other. Logo !!!
And than the combing of 2D Circle SDFs should work .
I’ll check it out. Thanks

how Do I render the SDF Field in 2D. I use ToVector4 and than the RenderTexture. But it only returns purple

wait I got it. I was missing to give the SDF a Domain

1 Like

you can also use the StrokeSDF