// import processing.opengl.*; // based on QUAD equation by Toxi. // http://www.toxi.co.uk/ // Future Goals, can an image be mapped to this, can we add it as a second var // for the noise [brightness values]. // use line instead of vertex, create new equations with POLYGON. // int xyBox = 10; // the size of x-y. make it bigger makes the boxes bigger,reduce the segments. int zBox = -100; // zdistance on the screen float currDensity = 0.05f; // density of the noise int numSegments = 50; //gridsize float r = 0.0f; // rotationZ turning var. float xoff = 0; // xoffset controls the x-coord wave. float yoff = 0; // yoffset controls the y-coord wave. float currZ; void setup() { size (500, 500, P3D); framerate(30); //smooth(); noStroke(); } void draw() { background(0); xoff+=0.1; yoff+=0.1; // background(255); directionalLight(126, 126, 126, 0, 0, -1); ambientLight(102, 102, 102); translate(width/2,height/2,0); rotateX(45); rotateZ(r); //rotateY(-r); r += 0.01f; pushMatrix(); translate(-width/2,-height/2,0); for (int y = 0; y < numSegments; y++) { beginShape(QUADS); for(int x = 0; x < numSegments; x++) { noiseDetail(3,0.0); currZ = noise(xoff+x*currDensity,yoff+y*currDensity,currDensity); // fill(10,200,noise(xoff+x*currDensity,yoff+(y+1)*currDensity,currDensity)*zBox); noFill(); vertex(x*xyBox,y*xyBox,currZ*zBox); vertex(x*xyBox,(y+1)*xyBox,noise(xoff+x*currDensity,yoff+(y+1)*currDensity,currDensity)*zBox); vertex((x+1)*xyBox,(y+1)*xyBox,noise(xoff+(x+1)*currDensity,yoff+(y+1)*currDensity,currDensity)*zBox); vertex((x+1)*xyBox,y*xyBox,noise(xoff+(x+1)*currDensity,yoff+y*currDensity,currDensity)*zBox); stroke(255); // line(0,0, 0,0, 0,(x+1)*xyBox); } endShape(); } popMatrix(); }