Hello!
I just finished the coding train’s coding challenge #11 : 3D generation with perlin noise on YouTube! I have a question. How would I make a similar image but with my own image of noise that is responsive to the grid in the same way? I’ve been taking screenshots of loading imagery and I would like to have a sculptural 3D grid which responds to my own image of noise rather than random.
Thank you for your help!
Here is the code that I have at the moment without the image!
//VARIABLES
int cols,rows;
int scl = 8; //scale
int w = 1200;
int h = 900;
float[][] terrain;
//INITIALIZE
void setup(){
size(1000,1000, P3D);
cols = w/ scl;
rows = h/ scl;
terrain = new float [cols][rows];
float yoff = 0;
for (int y = 0; y < rows; y++) {
float xoff = 0.2;
beginShape(TRIANGLE_STRIP);
for (int x = 0; x< cols; x++) {
terrain[x][y] = map(noise(xoff,yoff), 0, 1, -200, 50);
xoff += 0.2;
}
yoff += 0.1;
}
}
void draw(){
background(0);
stroke(255);
smooth();
noFill();
//rect(x*scl, y*scl, scl, scl); // grid!!
translate(width/2, height/2); //rotate perspective
//rotateX(PI/3); //rotate perspective
translate(-width/2,-height/2); //perspective
frameRate(1);
for (int y = 0; y < rows-1; y++) {
beginShape(QUAD_STRIP); // OR beginShape(QUAD_STRIP), (TRIANGLE_STRIP)
for (int x = 0; x< cols; x++) {
vertex(x*scl, y*scl, terrain[x][y]);
vertex(x*scl, (y+1)*scl, terrain[x][y+1]);
}
endShape();
}
}