Hello I have a sketch here I got watching the great Dan S. , I altered his Perlin noise terrain with some color now I want to be able to get the terrain to smooth out after going into the more extreme levels of z height. Could I put a sin function somewhere in the terrain for loop, I think that’s what is giving the z its height. any help would be greatly appreciated thank you!!!

```
int cols,rows;
int scl = 80;
int w = 10000; // where the vertexes start
int h = 40000;
float [][] terrain;
float flying = 0;
float diff = 0;
float deltaH, deltaS, f;
int nbPts;
PVector[] pts;
void setup() {
fullScreen(P3D);
// size(600, 600, P3D);
smooth();
cols = w / scl;
rows = h / scl;
terrain = new float[cols][rows];
colorMode(HSB, 3);
}
void draw() {
flying -= 0.002; // speed of your fly over
diff -= .0002;
float yoff = flying; // this is what calcuates the infinty for the scene
for (int y = 0; y < rows; y++) {
float xoff = flying;
for (int x = 0; x < cols; x++) {
terrain[x][y] = map(noise(xoff/2, yoff), 0, 1, -diff , 2000);
xoff += diff;
}
yoff += diff/2;
}
f = float(frameCount);
//stroke(1+cos(deltaH-f/280), 1+sin(deltaS+f/220), 2, .15);
for(int i = 0; i < nbPts; i ++){
pts[i].x += random(-1.5, 3);
pts[i].y += random(-3, 3);
}
background(0);
stroke(255);
// noFill();
translate(width/2, height/20+2000);
rotateX(PI/3);
//frameRate(1);
// fill(200,0,0);
translate(-w/2, -h);
for (int y =0; y < rows-1; y++) {
beginShape(TRIANGLE_STRIP);
for (int x = 0; x < cols; x++) {
stroke(1+cos(deltaH-f/140), 1+sin(deltaS+f/220), 2, 100);
noFill();
vertex(x*scl, y*scl, terrain[x][y]); // this is what is drawn / mess with
vertex(x*scl, (y+1)*scl, terrain[x][y+1]); // this is what is drawn / mess with
//rect(x*scl, y*scl, scl, scl);
}
endShape();
}
}
```