0
votes

i'm try doing fluid simulation using particles in 2d game.but something i can't get it through. situation like this, i have larger particles, which interactive each other physically,and applying constraint on particles, cause it's more like water,then use those particles to collide with environment(e.g wall,obstacles) but draw things doesn't go well,because by using particles-based fluid simulation, it exsits gap,or hole between circle particles, anyway,i would prefer to do some graphics trick to get rid of it.as you know, maybe use blur shader,or something else to smooth particles, but it's definitely infeasible, it makes particle size,radius visualization such changed,undetermined that can't use original information of particle to collide with environment anymore. please give some hint on fluid simulation in 2d games,thank you.

EDIT:

enter image description here

too bad, it's apparently that "water" fluid was composed of several cicrle sprites.....

enter image description here

better but still gaps,holes.

i uploaded the image to illustrate this visually. as the above figures shows, green circle particle was positioned separetely.it dosn't looks like water fluid. blurring the particles it's not my choice. how can i fixed this.

1
From a previous project I found that modelling each particle as a circle and then drawing them twice the size of the actual body of the particle gives quite a nice effect but that may not be what you are looking for - Sinkingpoint
This is kind of broad for stackoverflow. Might be a better fit for gamedev? - Reto Koradi
Using longer range falloff function can create smoother surfaces. Image space metaballs can be drawn pretty easily in 2D as well. This game does a pretty good job of it. I did a similar thing here a while ago too. - jozxyqk
@jozxyqk: thank you, metaball?, is it feasible to program this on mobile phone, and is it friendly with collision, interaction.. - qxsl2000
well in 2D it's more of a metacircle :P. Yes, in image space they're quite cheap. It's a way of drawing and not related to collision or interaction, but is a very common method to draw fluid and will blob together close particles hopefully to form a single smooth surface/perimeter. - jozxyqk

1 Answers

-3
votes

You can do it solving the Navier-Stokes equation.

Google a little deeper and then you can find some examples and implementations. This is equivalent to the Netwon's F = M x A, but for fluid dynamics.