Live data from Hacker News

Fast real time fluid simulator based on MPM algorithm

kotsoft.github.io

31–40 of 56 posts

Re: Fast real time fluid simulator based on MPM algorithm

#32
post #26

It's neat, but also it's unstable and hyper-energetic. Particles go flying off into space for no reason even long after gross motion has settled on mobile. Two particles falling downward past each other impart upward momentum somehow. Also the fluids appear to be extremely compressible as to appear bouncy, like the whole thing is breathing, so not liquids, but also non-mixing and with surface tension, so not gasses?…

> Particles go flying off into space for no reason even long after gross motion has settled on mobile. My intuition tells me this is how evaporation works.

In principle yes, but real liquid atoms never "settle down" whereas the ones in the simulation clearly do.

What is going on is that the particles in this simulation represents something more like droplets: huge quantities of atoms grouped together and treated as solid sphere with properties matching some average of the atoms it is supposed to represent.

And water doesn't evaporate a droplet at a time, thus evaporation is something that this type of simulation cannot reproduce.

Re: Fast real time fluid simulator based on MPM algorithm

#33
Hi, I made this demo. This is actually all from the paper Particle-based Viscoelastic Fluid Simulation (Simon Clavet, Philippe Beaudoin, and Pierre Poulin). It is an SPH type (particle-particle interactions), not MPM (particle-grid-particle). I do a lot of MPM nowadays, and I have a multi-grid thing to help with incompressibility, but this was me re-implementing the first fluid sim paper I ever implemented.

I did the implementation in JS to help other people reading the paper, and tried to keep everything as similar as possible to the pseudocode from just this single paper. Maybe it would be cool to integrate an additional grid on which incompressibility is enforced better but I didn't want to make the source confusing.

It is also a little difficult to do density ratios with just what is shown in the paper, here the masses are set to (1, .8, .6, .4). This is what causes the lightest particles to get launched so violently in the air. Probably would be useful to integrate some ideas from the paper Density Contrast SPH Interfaces (Barbara Solenthaler, Renato Pajarola).

I started revisiting SPH because I have some new ideas to combine it with an MPM/FLIP grid for closeups. I'm trying to do a multi-scale MPM simulation that can handle better surface tension droplets in closeups while also doing extremely large scale scenes. You can see some larger scale parallel sims on my YouTube: https://www.youtube.com/c/GrantKot

Re: Fast real time fluid simulator based on MPM algorithm

#34

I just want something like this for a pygame I'm making. But not very compue intensive.

Heightfield fluid sims are much less compute intensive. https://dl.acm.org/doi/10.1145/97880.97884

You will trade away details, so this depends entirely on what you need for visuals and interactivity; heightfield fluids won’t give you splashes or bubbles or swirling. You could try to mix a heightfield sim on most of the bottom with a thinner SPH layer on top, but that might be treading into research territory.

Re: Fast real time fluid simulator based on MPM algorithm

#37
post #33

Hi, I made this demo. This is actually all from the paper Particle-based Viscoelastic Fluid Simulation (Simon Clavet, Philippe Beaudoin, and Pierre Poulin). It is an SPH type (particle-particle interactions), not MPM (particle-grid-particle). I do a lot of MPM nowadays, and I have a multi-grid thing to help with incompressibility, but this was me re-implementing the first fluid sim paper I ever implemented. I did the…

Hey this was also the first fluid sim paper I ever implemented! I haven't done any grid-based simulations (except maybe the classic "Real-Time Fluid Dynamics for Games" by Jos Stam), but I've been able to greatly improve compressibility by using "Position-Based Fluids" by Miles Macklin. Someday I'll dive into WebGPU and post a JS version on HN...

Short clip of my implementation here: https://imgur.com/a/2IARiBq

I like the different fluids in your sim though, I may try that myself.

Re: Fast real time fluid simulator based on MPM algorithm

#38
post #33

Hi, I made this demo. This is actually all from the paper Particle-based Viscoelastic Fluid Simulation (Simon Clavet, Philippe Beaudoin, and Pierre Poulin). It is an SPH type (particle-particle interactions), not MPM (particle-grid-particle). I do a lot of MPM nowadays, and I have a multi-grid thing to help with incompressibility, but this was me re-implementing the first fluid sim paper I ever implemented. I did the…

Beautiful and mesmerizing. Well done

Re: Fast real time fluid simulator based on MPM algorithm

#39
post #33

Hi, I made this demo. This is actually all from the paper Particle-based Viscoelastic Fluid Simulation (Simon Clavet, Philippe Beaudoin, and Pierre Poulin). It is an SPH type (particle-particle interactions), not MPM (particle-grid-particle). I do a lot of MPM nowadays, and I have a multi-grid thing to help with incompressibility, but this was me re-implementing the first fluid sim paper I ever implemented. I did the…

Hey this was also the first fluid sim paper I ever implemented! I haven't done any grid-based simulations (except maybe the classic "Real-Time Fluid Dynamics for Games" by Jos Stam), but I've been able to greatly improve compressibility by using "Position-Based Fluids" by Miles Macklin. Someday I'll dive into WebGPU and post a JS version on HN... Short clip of my implementation here: https://imgur.com/a/2IARiBq I lik…

Very cool! What does the changing color of the fluid indicate, particle velocity?

Re: Fast real time fluid simulator based on MPM algorithm

#40

It's neat, but also it's unstable and hyper-energetic. Particles go flying off into space for no reason even long after gross motion has settled on mobile. Two particles falling downward past each other impart upward momentum somehow. Also the fluids appear to be extremely compressible as to appear bouncy, like the whole thing is breathing, so not liquids, but also non-mixing and with surface tension, so not gasses?…

This is true of all non-physically accurate fluid simulations which are essentially all of them.
Post reply on HN