Snailtan
Snailtan

Reputation: 1

SimplexNoise not giving out correct image

I am currently toying around with Noises, like Perlin and SimplexNoise. When I integrate the Noise function into my code, I get something that looks like static, which it clearly shouldn't be.

output

Here is my current code:

// 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);
    }
}

The Noise I used is from here: https://github.com/SRombauts/SimplexNoise/blob/master/references/SimplexNoise.java

Upvotes: 0

Views: 52

Answers (1)

Snailtan
Snailtan

Reputation: 1

Got it. I multiplied my x and y by 0.1, gave me my desired output! Yay!

Upvotes: 0

Related Questions