开发者

How to cheaply simulate water on iOS?

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 i开发者_运维百科dea 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜