How to cheaply simulate water on iOS?
Asked Answered
L

2

9

First off, I'm not thinking about that.

I was wondering how to make a simple simulation of a waterfall onto some dunes on the iPhone.

It turns out several people tackled the issue of moving water, and GameDev has approached the idea several times. However, all these solutions seems computationally intensive (and it makes sense, given water is a fluid and fluid mechanics is complicated). I'm interested in a shortcut, since it doesn't really matter the the simulation be accurate, but just that it seems accurate.

Someone asked about simulating with (Navier-)Stokes on DirectX, using 1500 particles. He states his result is jaggy. Of course, on iPhone it would be a OpenGL ES implementation of such a thing.

Another good soul tried using Chipmunk's physics engine, but it sounds to me like using a battletank to kill a mosquito, and it still brings the issue of many, many particles. So I am now wondering if it would be reasonable to use a technique similar to this pressure management technique, in order to manage a macro-state of the fluid, and manage the edges with particles, in order to minimize the total calculations.

If you have bright ideas, please suggest things to test.

Edit 08/06/2015: I found into the Thimbleweed Park blog this great example of a very old technique done in HTML5 by Joseph Huckaby. It's only circumstantially relevant, because it's all about the look and not at all about the physics, but why not roughly simulate the fluid, and overlay the "liquid zones" with a palette cycling effect? Of course, since the technique relies much more on art elements, it moves the difficulty in the realm of artists. The rendering code however is a bit intensive when blending.

Lewanna answered 28/8, 2011 at 10:56 Comment(3)
... hover iPhone/Pad in sink, open tap; two steps to success :)Audrieaudris
@sehe: Hmmm, no thank you ;) or maybe with thepocketsolution.com/PSI-45429/3g+iPhone+Waterproof+Case.html or alike :pLewanna
+1 for the use of so many links. I like that.Elm
A
2

You could get some mileage using a static bitmap with colours chosen from a gradient;

Then instead of animating stuff, you can shift the palette (rotating) and have the visual effect of flowing.

Of course the contour/outline of the water will be static this way. You might mix this ideas with a limited number of 'static' contour animation frames.

Audrieaudris answered 28/8, 2011 at 11:25 Comment(1)
Well, this sounds like computationally cheap indeed, and may scale well with the Dwarf Fortress technique: gamasutra.com/view/feature/3549/….Lewanna
P
1

If your main concern is performance and you can do without user interaction, perhaps a better approach would be to develop one of the more computationally expensive solutions on the desktop, pre-render it into a video or a set of textures and use it on the mobile device without actually generating it there.

I know the solution is highly restrictive, I just wanted to suggest it as a variant in a worst-case scenario, that no one else comes up with better advice.

Phemia answered 28/8, 2011 at 11:20 Comment(1)
Thanks for the idea nonetheless :DLewanna

© 2022 - 2024 — McMap. All rights reserved.