如何在球面上生成柏林噪声?

发布于 2024-11-18 12:47:38 字数 189 浏览 7 评论 0原文

我正在尝试使用柏林噪声生成地形。我了解如何使用笛卡尔坐标生成它,但无法完全理解它在球体上的工作原理。我知道你可以将 2D 表面投影到球体上,但是扭曲不会扰乱噪声分布吗?我能想到的在球体表面生成均匀噪声的最佳想法是将球体上的点映射到 3D 笛卡尔坐标并使用 3D 噪声函数。 (基本上,生成一个噪声立方体并“剃掉”角落使其变圆,就像以前一样。)我是否缺少更好的方法?

I am trying to generate terrain using Perlin noise. I understand how to generate it using Cartesian coordinates, but can't quite wrap my head around how it would work on a sphere. I know that you can project 2D surfaces onto spheres, but wouldn't the distortion mess up the noise distribution? The best idea I can come up with for generating uniform noise on the surface of a sphere is to map the point on the sphere to a 3D Cartesian coordinate and use a 3D noise function. (Basically, to generate a cube of noise and "shave away" the corners to make it round, as it were.) Is there a better method I'm missing?

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

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

发布评论

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

评论(2

彩扇题诗 2024-11-25 12:47:38

我相信该方法实际上是使用 3 维噪声场(3D 空间中的每个点都有一个标量噪声值),而不是 2 维场(2D 平面上的每个点都有一个噪声值)。

使用 2D 噪声函数生成高度图时,您可以根据噪声值偏移 z 值。

使用 3D 场时,您可以对球体表面上的点处的噪声进行采样,然后使用噪声值将每个点径向远离或靠近球体中心进行偏移。

显然,3D 噪波的产生更困难且更慢,但您不必处理将表面包裹在球体周围的复杂问题,而且由于噪波函数是连续的,因此没有接缝。

这显然可以应用于任何任意形状。

I believe the approach is to actually use a 3 dimensional noise field (every point in a 3D space has a scalar noise value) as opposed to a 2 dimensional field (every point on a 2D plane has a noise value).

When using a 2D noise function to generate a height map, you offset the z value according to the noise value.

When using a 3D field, you sample the noise at points on the surface of a sphere, then use the noise value to offset each point radially away from or towards the center of the sphere.

3D noise is harder and slower to produce obviously, but you don't have to deal with the complications of wrapping a surface around the sphere, and because the noise function is continuous there are no seams.

This can obviously be applied to any arbitrary shape.

零度° 2024-11-25 12:47:38

这里真正的难题是如何改变 Perlin 噪声基函数(称为倍频程?),这些函数是使用频率和幅度定义的,以便它们位于球体而不是 n 维平面上。

因此,我们需要在球体上定义一组基函数(给定方向、频率和幅度)。方向是一个值为零的点。对于球体上的任意点,您可以测量到方向矢量的角距离。将角距离除以频率,然后计算该角度的正弦值。最后,按幅度进行缩放。

如果您希望基函数在二维上有不同的变化,您可以做一些更奇特的事情,但是您将需要第二个方向参数来定向投影。您还需要计算两个角距离。但这可能有点矫枉过正。如果你有一堆基函数,上面算法的圆形图案可能会完全相互模糊,所以我会首先尝试简单的解决方案。

使用这些 Perlin 噪声基函数,您现在可以将球体上的 Perlin 噪声评估为这些函数的总和。是否决定对球体进行细分并评估顶点角取决于您。这就是我会做的。

The real puzzle here is how to alter the Perlin noise basis functions (called octaves?), which are defined using frequency and amplitude so that they are over a sphere instead of an n-dimensional plane.

So, we need to have a set of basis functions (given direction, frequency, and amplitude) defined over the sphere. Direction is a point with, say, zero value. For any point on the sphere, you measure the angular distance to the direction vector. You divide the angular distance by the frequency, and calculate the sin of that angle. Finally, you scale by the amplitude.

You can do something a little fancier if you want your basis functions to vary differently in two-dimensions, but you will need a second direction parameter to orient the projection. You will also need to calculate two angular distances. It might be overkill though. If you have a bunch of basis functions, the circular patterns of the algorithm above might completely blur each other out, so I would try the easy solution first.

Using these Perlin noise basis functions, you can now evaluate your Perlin noise over the sphere as the sum of a bunch of these. Whether you decide to tesselate the sphere and evaluate the vertex corners is up to you. That's what I'd do.

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