iOS平台云光生成算法

发布于 2024-11-18 13:38:05 字数 436 浏览 9 评论 0原文

我想用动画云填充我的应用程序的背景。我做了一些研究,偶然发现了柏林噪声算法,它似乎很合适。然而,即使在第一次测试中,生成 512x512 (2D) 云图的成本也极其昂贵。我尝试了单纯形噪声,但没有解决问题。

根据 http://freespace.virgin.net/hugo.elias/models/m_clouds .htm 生成云是通过将一些 perlin/simplex 噪声图添加在一起来完成的。在 iPhone 上的应用程序中不可能做到这一点:我需要流畅的图形(我的乐观期望是 A4 上的 60 FPS)。

所以我的问题是:是否有一种更轻的算法来生成动画云,不会使我的帧速率下降太多?

提前致谢!

保罗

I'd like to fill the background of my app with animated clouds. I did some research and stumbled upon the perlin noise algorithm which seems to be fitting. However even in the first test it was extremely expensive to generate a 512x512 (2D) cloud map. I tried simplex noise but it didn't fix it.

According to http://freespace.virgin.net/hugo.elias/models/m_clouds.htm generating clouds is done by adding some perlin/simplex noise maps together. Impossible to do it on a iPhone in my app: I need fluid graphics (my optimistic expectation is 60 FPS on an A4).

So my question: Is there a lighter algorithm to generate animated clouds that does not make my frame rate drop too much?

Thanks in advance!

Paul

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

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

发布评论

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

评论(2

网名女生简单气质 2024-11-25 13:38:05

除非您所做的只是生成云,否则您肯定会希望预先计算它们。 Perlin 噪声可以通过遍历一组 3D 数据来制作漂亮的 2D 动画,但您可以只滚动一些噪声的 2D 图像或由菱形方形算法生成的分形。不管怎样,你可能应该预先计算它。

如果您想要更多变化,我会尝试在预先计算的云上放置噪声滤波器。

Unless all you're doing is generating clouds you'll definitely want them precomputed. Perlin noise can make for nice 2d animations by traversing a set of 3d data, but you could just scroll a 2d image of some noise or a fractal like is generated by the diamond-square algorithm. Either way, you should probably precompute it.

If you want some more variation, I would experiment with putting a noise filter over the precomputed clouds.

空城之時有危險 2024-11-25 13:38:05

使用核心动画或其他方式预生成云并创建 2d 精灵。然后,您可以以较低的成本制作这些动画。您可能无法达到 60 fps,但您应该接近 60 fps,具体取决于您想要的运动复杂程度或当时正在发生的其他动画。不管怎样,它都会比自己生成云更快。

Pre-generate the clouds and create 2d sprites using core animation or otherwise. You can then animate these around cheaply. You may not get 60 fps, but you should get close depending on how complex movement you want or what other animations are going on at the time. Either way, it's going to be faster than generating clouds yourself.

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