【问题标题】:Analytical derivative for 3D perlin noise produces line artifacts3D perlin 噪声的解析导数产生线伪影
【发布时间】:2017-10-07 09:14:09
【问题描述】:

我正在实现一个基于 3D perlin 噪声的球形行星生成器,但在尝试利用噪声计算中的解析导数时,我得到了线伪影。我正在使用 Milo Yip 的方法计算解析导数: 3D Perlin noise analytical derivative

例如,当尝试使用 IQ 噪声时:

float IQturbulence(float3 p, int octaves, float freq, float amp, float gain, float lacunarity)
{
    float sum = 0.5;
    float3 dsum = float3(0,0,0);
    for(int i = 0; i < octaves; i++) 
    {
        float4 n = noiseDeriv((p*freq), (i)/256.0);
        dsum += n.yzw;
        sum += amp * n.x / (1 + dot(dsum,dsum));
        freq *= lacunarity;
        amp *= gain;
    }
    return sum;
}

我得到这些网格线伪影,如下所示:

https://imgur.com/CaNrdZ3

但是,这些行在我在噪声计算中利用导数的点积(标量)时出现,

(1 + dot(deriv,deriv))

是否用于调制放大、频率等。它似乎总是会产生伪像。

当使用域扭曲的导数时,我没有得到线伪影。

例如

float4 n = noiseDeriv((p + 0.15 * dsum) * freq, (i)/256.0);

这仅仅是经典 Perlin 噪声的限制吗?在我的项目的这个阶段,我有点犹豫要完全改变噪声算法。 :/

  • 注意:我在计算导数时使用的是五次函数。

【问题讨论】:

  • 有趣的是,在 this 页面上,de Carpentier 正在采用另一个导数 d(w*f)/df 并将其合并到他的最终导数计算中(参见他的 @987654327 @ 方法)。 // Get the derivative d(w*f)/df float2 dwp = f * f * f * (f * (f * 36 - 75) + 40); // 36f^5 - 75f^4 + 40f^3 这不是二阶导数,所以我不确定这条曲线的用途。是否有任何数学天才可能知道如何将其纳入 Milo Yip 的方程式? :) de Carpentier's 仅适用于 2D。

标签: 3d derivative perlin-noise procedural-generation


【解决方案1】:

所以我不确定我是否在某个地方搞砸了,但我能够通过将这一部分替换为 Milo 解决方案中的 x 导数,从而成功移除了工件:

float nx = gx000
    + uP * (dot100 - dot000)
    + u  * (gx100 - gx000)
    + v  * (gx010 - gx000)
    + w  * (gx001 - gx000)
    + uP * v * (dot110 - dot010 - dot100 + dot000)
    + u * v *  (gx110 - gx010 - gx100 + gx000)
    + uP * w * (dot101 - dot001 - dot100 + dot000)
    + u * w *  (gx101 - gx001 - gx100 - gx000)
    + v * w *  (gx011 - gx001 - gx010 + gx000)
    + uP * v * w * (dot111 - dot011 - dot101 + dot001 - dot110 + dot010 + dot100 - dot000)
    + u * v * w *  (gx111 - gx011 - gx101 + gx001 - gx110 + gx010 + gx100 - gx000);

float a = dot000;
float b = dot100;
float c = dot010;
float d = dot110;
float e = dot001;
float f = dot101;
float g = dot011;
float h = dot111;

float nx = uP*(b - a) 
    + uP*v*(a + d - b - c) 
    + uP*w*(a + f - b - e)
    + uP*v*w*(b + c + e + h - a - d - f - g);

3D IQ 噪声looks great 现在!

我得到了推导here

我不必更改 nynz 以使工件消失,但我继续更新了它们。

float ny = vP*(c - a) 
    + u*vP*(a + d - b - c)
    + vP*w*(a + g - c - e)
    + u*vP*w*(b + c + e + h - a - d - f - g);

float nz = wP*(e - a)
    + u*wP*(a + f - b - e)
    + v*wP*(a + g - c - e)
    + u*v*wP*(b + c + e + h - a - d - f - g);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-14
    • 1970-01-01
    • 2016-11-26
    • 2021-06-30
    相关资源
    最近更新 更多