模拟高度图上的流体流动

发布于 2024-11-28 07:52:55 字数 436 浏览 1 评论 0原文

我正在寻找一种方法来近似在高度图上移动的流体体积。我能想到的最简单的解决方案是将其近似为大量小直径(<0.1m)的非绘制球体。然后,我将在球体的“顶部”放置一个代表水面的可见平面,即它们静止的位置。据我所知,没有托管物理引擎包含内置流体模拟器,因此出现了这个问题。

实现包括使用 JigLibX 等物理引擎,它能够模拟球体的运动。为了确定平面的高度,我正在考虑对位于分组顶层的每个球体的最大高度进行平均。

我并不期望性能会很好,但是它可以实时实现吗?如果没有,我可以使用此模拟来预烘焙流线吗?

我希望这是有道理的,我真的想要关于这是否可行,或者是否有更好的方法来解决这个问题的意见/建议。

感谢您的帮助,Venatu

(如果相关,我的目标平台是 XNA 4.0,使用 C#。此时仅使用 Windows,因此 PhysX/Havok 可以用于模拟,但我更喜欢托管解决方案)

I am looking for a way to approximate a volume of fluid moving over a heightmap. The easiest solution I can think of is to approximate it as a large number of non-drawn spheres, of small diameter (<0.1m). I would then place a visible plane representing the surface of the water on "top" of the spheres, at the locations they came to rest. To my knowledge, no managed physics engines contain a built in fluid simulator, hence the question.

Implementation would consist of using a physics engine such as JigLibX, which is capable of simulating the motion of the spheres. To determine the height of the planes, I was thinking of averaging the maximum height of each sphere that is on the top layer of a grouping.

I dont expect performance to be great, but would it be approachable for real time? If not, could I use this simulation to pre-bake lines of flow?

I hope this makes sense, I really want opinions/suggestions as to whether this is feasible, or if there is a better way of approaching this.

Thanks for any help, Venatu

(If its relevant, my target platform is XNA 4.0, using C#. Windows only at this point in time, so PhysX/Havok are possibilities for the simulation, but I would prefer a managed solution)

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

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

发布评论

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

评论(2

国际总奸 2024-12-05 07:52:55

到目前为止,如果不使用 PhysX 之类的东西,我还没有实时看到真实的流体动力学 - 可能是因为所需的计算非常复杂!在我看来,你的方法的问题在于,当所有这些球体安定下来时,它们会保持静止接触,这会占用大量的处理能力。许多静止接触点因快速消耗性能而臭名昭著,即使在最强大的台式机上也是如此。

如果您沿着这条路线走下去,那么我建议使用基于弹簧的物理原理将流体建模为弹性实体,其中施加到一部分水的力将使用弹簧传播到其余部分。这使您可以选择为弹簧设置一个断点,并在发生这种情况时将主体分成两个或多个主体(以及返回到一起的相反过程)。这可以为您提供诸如喷雾之类的东西的基础。就性能而言,它也是一种更通用的方法,因为您可以选择用于近似模型的粒子和弹簧的数量。

这是一个大而复杂的话题,但我希望至少能提供一些见解!

I haven't seen realistic fluid dynamics in real time without using something like PhysX as of yet - probably because the calculations needed are so complicated! The problem with your approach as I see it would come with the resting contact of all those spheres as they settled down, which takes up a lot of processing power. Lots of resting contact points are notorious for eating into performance very quickly, even on the most powerful of desktops.

If you are going down this route then I'd recommend modelling the fluid as an elastic but solid body using spring based physics, where the force applied to one part of the water would use springs to propagate out to the rest. This gives you the option of setting a breaking point for the springs and separating the body into two or more bodies when that happens (and the reverse for coming back together.) This can give you the foundation for things like spray. It's also a more versatile approach in terms of performance, because you can choose the number of particles and springs you use to approximate your model.

It's a big and complicated topic, but I hope that provided at least some insight!

两相知 2024-12-05 07:52:55

实时模拟流体最流行的方法是平滑粒子流体动力学

几个有用的链接:

http://en.wikipedia.org/wiki/Smoothed-article_Hydrodynamics

http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html

http://www.plunk.org/~trina/thesis/html/thesis_toc.html

除了模拟本身之外,您还需要一些专门的宽相碰撞检测算法这样的作为扫描和修剪或散列单元格。

你是对的,流体动力学没有完整的二维解决方案。

The most popular method to simulate fluids in real-time is Smoothed-particle hydrodynamics.

Several useful links:

http://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics

http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html

http://www.plunk.org/~trina/thesis/html/thesis_toc.html

In addition to simulation itself you will also need some specialized broad-phase collision detection algorithms such as sweep-and-prune or hashing cells.

And you're right, there is no completed 2d solutions for the fluid dynamics.

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