1
\$\begingroup\$

I'm trying to do fluid simulation using particles in 2d game. I have larger particles, which interactive each other physically, those particles collide with environment (e.g wall,obstacles) to simulate fluid.

enter image description here

However drawing things doesn't go well. I'm trying to figure out how to render the circles without the gaps in between. I've tried blurring the circles like so:

enter image description here

But the gaps remain. Also, blurring the particles causes the particles dimension to change visually every frame. Meaning the physics shape and the visual shape don't match up.

How can I render these objects as one?

finally, i got some effect like this, even artefacts exists: enter image description here

here is my solution, steps as following: 1.draw water or fluid with SPH. 2. blur all of it. 3. does metaball with it.

\$\endgroup\$
  • 2
    \$\begingroup\$ Why don't you make particles smaller and their render shapes bigger until there are no unwanted gaps? \$\endgroup\$ – Kromster Nov 27 '14 at 13:15
  • 2
    \$\begingroup\$ You are probably looking for something like Marching Squares - take a look at this fancy demo: jamie-wong.com/2014/08/19/metaballs-and-marching-squares. This paper by nvidia goes into details of how to apply this to 3D as well http.developer.nvidia.com/GPUGems3/gpugems3_ch30.html. \$\endgroup\$ – Jovan Nov 27 '14 at 17:04
  • \$\begingroup\$ @KromStern won't that fail as soon as you get any interaction betweent the fluid and everything else? Graphically an object would sink into the fluid before the fluid influenced it. \$\endgroup\$ – Jez Nov 27 '14 at 17:08
  • \$\begingroup\$ @Jez: You can work around that by layering (fluid first, object on top) depending on your perspective on the game. \$\endgroup\$ – Kromster Nov 27 '14 at 17:14
  • \$\begingroup\$ @Krom Sterm: to increase particles and make it smaller, that's not my preferred choice,some drawbacks, as you know. \$\endgroup\$ – qxsl2000 Nov 28 '14 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.