模拟流体流动的算法

发布于 2024-07-11 16:27:27 字数 205 浏览 7 评论 0原文

我有一个游戏创意,需要对围绕各种物体流动的流体进行一些半真实的模拟。 想象一个不规则表面上的水银池,该表面朝各个方向倾斜。

这是一款游戏,因此 100% 的物理真实感是不必要的。 最重要的是,计算可以在具有 iPhone 马力的设备上实时完成。

我认为某种元胞自动机或粒子系统是可行的方法,但我不知道从哪里开始。

有什么建议么?

I've got a game idea that requires some semi-realistic simulation of a fluid flowing around various objects. Think of a pool of mercury on an irregular surface that is being tilted in various directions.

This is for a game, so 100% physical realism is not necessary. What is most important is that the calculations can be done in real time on a device with the horsepower of an iPhone.

I'm thinking that some sort of cellular automaton or particle system is the way to go, but I don't know where to start.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

风和你 2024-07-18 16:27:27

格子-玻尔兹曼方法是一种以离散、类似元胞自动机的方式模拟流体的非常常见的方法。

然而,为了在 iPhone 上实现实时性能,将流体模拟为粒子系统,然后找到一种将粒子渲染为体积质量的方法可能更有效。 我怀疑这是像 Aqua Forest 这样的游戏所采用的方法。

Lattice-Boltzmann methods are a pretty common way to simulate fluid in a discretised, cellular automaton-like way.

However, for the sake of real time performance on an iPhone, it may be more effective to simulate the fluid as a particle system and then work out a way to render the particles as a volumetric mass. I suspect this is the approach taken by games like Aqua Forest.

乖乖公主 2024-07-18 16:27:27

这不是我的研究领域,但我相信这被认为是规范的工作:

计算机图形学流体模拟

https://www.routledge.com/Fluid-Simulation-for-Computer-Graphics/Bridson/p/book/9781482232837

另外,看看伯克利动画和建模组

https:// web.archive.org/web/20090116020253/http://www.cs.berkeley.edu/b-cam/

我还推荐 Google Scholar 或 Citeseer 等工具,并查阅学术文献。

This is not my area of research but I believe this is considered the canonical work:

Fluid Simulation for Computer Graphics

https://www.routledge.com/Fluid-Simulation-for-Computer-Graphics/Bridson/p/book/9781482232837

Also, look at the Berkeley Animation and Modeling Group

https://web.archive.org/web/20090116020253/http://www.cs.berkeley.edu/b-cam/

I also recommend a tool like Google Scholar or Citeseer and persue the scholarly literature.

幻梦 2024-07-18 16:27:27

可能也令人感兴趣(演示视频演示二进制文件源代码)。

This might also be of interest (demo video, demo binary, source code).

梨涡 2024-07-18 16:27:27

也许粒子系统是一个很好的起点。 沿着这些思路,您可以将 SPH(平滑粒子流体动力学)视为一种更物理的流体模拟方法,但仍然依赖于粒子。

Probably a particle system is a good place to start. Along these lines you can look into SPH (smoothed particle hydrodynamics) as a somewhat more physical approach to fluid simulation that still relies on particles.

柳絮泡泡 2024-07-18 16:27:27

Ron Fedkiw 在这一领域的工作相当令人惊叹。

另一条评论:流体模拟是数值并行编程和超级计算机,或者至少是高功率、多核台式机。 iPhone 可能无法满足这一需求。

Ron Fedkiw's work is quite stunning in this area.

One more comment: Fluid simulations is the stuff of numerical parallel programming and supercomputers, or at the very least, high power, multi-core desktops. An iPhone probably will not cut it.

灰色世界里的红玫瑰 2024-07-18 16:27:27

带有粒子的 SPH 可能是启动和运行最快的,并且在可扩展到粘弹性和其他材料方面处于领先地位。 明天我将在我的博客上发布一份指南,这是我过去几天一直在写的关于这个主题的指南。 (http://blog.brandonpelfrey。 com)

SPH with particles is probably the fastest to get up and running with a head start on extendability into visco-elastics and other stuff. I'll be publishing a guide on my blog tomorrow that I've been writing for the last few days on this very topic. (http://blog.brandonpelfrey.com)

羞稚 2024-07-18 16:27:27

我想知道您是否正在考虑类似 Archer Maclean's Mercury 或PSP 的水星熔毁

I wonder if you're thinking of something like Archer Maclean's Mercury or Mercury Meltdown for the PSP.

饭团 2024-07-18 16:27:27

据我所知,在游戏中 De Blob 一个彩色“斑点”在白色环境中移动,为它碰到的物体着色。 当我读到你对你似乎想做的事情的描述时,这在我的脑海中以某种方式触发。 (还没有真正玩过这个游戏,所以我不知道这种配合有多好。)

话虽如此,我似乎记得该游戏中斑点的流动性主要是人为的:基本上是一个球体,尺寸很小/它的形状变换、一些动作提示和添加的“流畅的声音”,让玩家觉得游戏的主角是一些不太坚固的东西。 不涉及实际的物理或模拟类型的编程。

听起来很适合 iPhone 可运行的软件。 这对你来说可能足够了吗?

As far as I know in the game De Blob a colored "blob" moves around a white environment, coloring objects it bumps into. This was somehow triggered in my mind when I read your description of what you seem to want to do. (Haven't actually played the game, so I have no idea how well that fit is.)

Having said that, I seem to recall that the fluidity of the blob is mostly artifical in that game: basically being a sphere, some slight size/shape transformations of it, some motion cues and added "fuidy sounds" that give the player the impression that something not quite solid is the main character of the game. No actual physics or simulation type programming was involved.

Sounds like a good fit for a iphone runnable piece of software, that. Would that perhaps be enough for you?

笑叹一世浮沉 2024-07-18 16:27:27

它是如此稀疏,以至于必须对粒子进行建模?

如果是这样,我建议您查看格子气体元胞自动机(LGCA,请参阅示例视频此处)。

简而言之,LGCA 是元胞自动机的一个子类,其中细胞状态是二进制值的元组,每个元组代表一个细胞与其邻居之一之间的通道,并且粒子可以通过该通道传播(通道为1,如果它包含一个粒子,0否则)。

更新方案是一个同步并行两步函数,它重新组织每个单元内通道之间的粒子(碰撞),然后将这些粒子传播到目标邻居的相应通道(传播)。

It is so sparce you have to model particles?

If so I recommend having a look at Lattice-Gas Cellular Automata (LGCA, see example video here).

In short, LGCA are a subclass of cellular automata where cell states are tuples of binary values, each representing a channel between a cell and one of its neighbor, and through which particles can travel (channel is1if it contains a particle,0otherwise).

The updating scheme is then a synchronous parallel two-step function which reorganizes particles between channels within each cell (collision) and then propagate these particles to the corresponding channel of the targeted neighbor (propagation).

友谊不毕业 2024-07-18 16:27:27

基于网格的纳维-斯托克斯解决方案总是更快,并且计算速度是恒定的。

Grid based Navier-Stokes solution is always faster and the computation speed is constant.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文