3D perlin噪声的分析导数产生线伪影

时间:2017-10-07 09:14:09

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

我正在实施一个基于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);

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

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

1 个答案:

答案 0 :(得分:0)

所以我不确定我是否搞砸了某个地方或者是什么,但我能够通过将这一部分替换为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

我没有必要更改 ny nz 以便工件消失,但我也继续更新了这些工具。

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);
相关问题