/* Here we're going to create basic Perlin Noise and draw it to the screen. Things to experiment with: - Instead of using X and Y as the parameters to noise(), try using different values based on X and Y: maybe x * 0.02 - Try creating variations in the color produced for our pixels by using multiple noise() statements to generate different values for R G and B - Three Dimensions? The noise method can accept 2 or 3 parameters. What happens if you use a third parameter here? What value should you use? Try using a value that is incremented by a small amount each loop through the draw method. */ void setup() { // setup our screen size(200, 200); background(0); } void draw() { // clear the screen background(0); // calling the loadPixels method lets us work with the pixels[] array loadPixels(); // loop across every pixel of the screen for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { // generate a value from 0 to 255 using Perlin Noise int noiseVal = int(noise(x, y) * 255.0); // set the pixel at (X, Y) to the grayscale value we generated with the noise method pixels[x + y * width] = color(noiseVal); } } // tell processing to update our screen updatePixels(); }