iDevGames Forums
Liquid physics? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Tools & Technology (/forum-10.html)
+--- Thread: Liquid physics? (/thread-298.html)



Liquid physics? - jfbaro - Feb 25, 2010 05:41 AM

Hi,

I am new to IPhone SDK and I would like to hear from you guys if that can be done.

I would like to have a transparent bottle (the more realistic the better) filled with OIL and WATER and than when someone shakes it the liquid would be mixed (kinda), just like in a real bottle+OIL+Water.

Is that easily feasible? Is there any API/Library which would help me on that?

Cheers


Liquid physics? - OneSadCookie - Feb 25, 2010 01:35 PM

It's a hard problem, computationally very intensive, possibly out of reach of even the 3GS to do "realistically", depending on the resolution of the simulation.

There may be a decent "faking it" option I suppose...


Liquid physics? - bronxbomber92 - Feb 26, 2010 06:17 PM

Perhaps you can you simulate this using Jos Stam's fluid dynamics, representing each liquid with a different color.


Liquid physics? - mikey - Mar 2, 2010 09:30 AM

If it's not too much of a strain on the iPhone the way I have seen most people do this is with small particle systems. If you want you could make some way of drawing joins between close particles. You may want to look at the way Phun does it:
http://www.youtube.com/watch?v=HbXVc7Zl-Nw


Liquid physics? - OneSadCookie - Mar 2, 2010 12:46 PM

that 48-second movie took 30 minutes of real time to render, according to the description. Not exactly useful for a game. And that's presumably on a 2+GHz desktop CPU...


Liquid physics? - Skorche - Mar 2, 2010 01:37 PM

While particle based fluids let you do some fancy-ish effects, they are also extremely computationally expensive. I've never tried it, but AquaForest did this on the iPhone: http://www.youtube.com/watch?v=hxpGdRH7J5I

It looks like it has pretty coarse particles and poor framerates when there is only a small amount of liquid on the screen. I'm guessing that it's also already highly optimized.


RE: Liquid physics? - Wolfos - Sep 25, 2010 12:41 PM

(Mar 2, 2010 01:37 PM)Skorche Wrote:  While particle based fluids let you do some fancy-ish effects, they are also extremely computationally expensive. I've never tried it, but AquaForest did this on the iPhone: http://www.youtube.com/watch?v=hxpGdRH7J5I

It looks like it has pretty coarse particles and poor framerates when there is only a small amount of liquid on the screen. I'm guessing that it's also already highly optimized.

Actually, it's the steam particles that make it lag.


RE: Liquid physics? - Charybdis - Oct 6, 2011 03:11 AM

You want to look into "smoothed particle hydrodynamics" (SPH)
There are many tutorials, videos, source codes and libraries out there


RE: Liquid physics? - timrwood - Jan 3, 2012 10:45 AM

We created a liquid/goo dynamic for our game, Critter Chaos.

http://critterchaos.infinitebeta.com

It's just a bunch of rigid bodies connected by joints, and yes, performance did suffer.

I optimized the hell out of it, and we also changed the rules of the game to limit the amount of goo that could be on the stage at one time.