星空屏保方程

发布于 2024-11-05 17:18:38 字数 391 浏览 0 评论 0原文

对于那些不太记得旧版 Windows Starfield 屏幕保护程序是什么样子的人,这里有一个 YouTube 视频:http://www.youtube.com/watch?v=r5AoFiVs2ME

现在,我可以在一定半径内生成随机粒子(“星星”)。我遇到的困难是找出实现上述链接视频中所见受影响的最佳方法。

问题:假设我有随机生成的粒子的坐标(向量)。 为它们提供方向(矢量)的最佳方法和/或方程式是什么,以便它们以与旧屏幕保护程序中看到的方式非常相似的方式在屏幕上移动?< /strong>

谢谢!

For those of you who don't remember exactly what the old windows Starfield screensaver looked like, here's a YouTube video: http://www.youtube.com/watch?v=r5AoFiVs2ME

Right now, I can generate random particles ("stars") inside in a certain radius. What I've having trouble doing is figuring out the best way the achieve the affected seen in the afore-linked video.

Question: Given that I have the coordinates (vectors) for my randomly generated particles. What is the best way and/or equation to give them a direction (vector) so that they move across the screen in a way which closely resembles that which is seen in the old screensaver?

Thanks!

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

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

发布评论

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

评论(2

寄居者 2024-11-12 17:18:38

他们似乎正在远离中心。您可以尝试计算从屏幕中心点到生成的粒子位置的矢量吗?然后用相同的方向移动粒子,并加速粒子,直到粒子出现在屏幕之外。

They seem to move away from the center. You could try to calculate the vector from the center point of the screen to the generated particle position? Then use the same direction to move the particle and accelerate the particle until it is outside the screen.

我三岁 2024-11-12 17:18:38

供您使用的基本算法:

  1. 在随机位置生成具有 3-D 高斯分布的星星(最有可能在屏幕中间,距离屏幕越远则不太可能)。请注意,星星的运动矢量是由该起始点决定的...运动将有效地沿着由原点和起始位置形成的线向外传播。

  2. 为每个新生成的星星分配一个距离。请注意,距离与起始位置无关。

  3. 以指数级增加的速度沿直线移动恒星,同时减小其距离。您必须自己调整这些参数。

  4. 无论速度如何,当星星穿过屏幕边界时,星星都应该消失。

A basic algorithm for you to work with:

  1. Generate stars at random location, with a 3-D gaussian distribution (middle of screen most likely, less likely as you go farther from the screen). Note that the motion vector of the star is determined by this starting point... the motion will effectively travel along the line formed by the origin point and the starting location, outward.

  2. Assign each newly generated star a distance. Note that distance is irrespective of starting location.

  3. Move the star in a straight line at an exponentially increasing speed while simultaneously decreasing it's distance. You'll have to tweak these parameters yourself.

  4. The star should disappear when it passes the boundary of the screen, regardless of speed.

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