【问题标题】:SimplexNoise not giving out correct imageSimplexNoise 没有给出正确的图像
【发布时间】:2019-01-28 20:13:25
【问题描述】:

我目前正在玩弄噪音,比如 Perlin 和 SimplexNoise。 当我将 Noise 函数集成到我的代码中时,我得到了一些看起来像静态的东西,这显然不应该。

这是我当前的代码:

// Width and Height are screen width and height
// Pixelsize is 4
for (int x = 0; x < (width/pixelSize); x++) {
    for (int y = 0; y < (height/pixelSize); y++) {
        double newColor = SimplexNoise.noise(x, y);         
        if (newColor > 0) {
            g.setColor(Color.black);
        } else {
            g.setColor(Color.WHITE);
        }
        g.fillRect(x*pixelSize, y*pixelSize, pixelSize, pixelSize);
    }
}

我使用的噪音来自这里:https://github.com/SRombauts/SimplexNoise/blob/master/references/SimplexNoise.java

【问题讨论】:

    标签: java simplex-noise


    【解决方案1】:

    知道了。 我将 x 和 y 乘以 0.1,得到了我想要的输出! Yay!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-07
      • 1970-01-01
      • 2012-05-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多