# 3D Grid Design Help

Hi,

I need help designing a 3D Grid, like the pic below. I have more than half of it done, I just need the third plane.

Here’s the code I have so far:

``````int gridSize = 10;
float inc = 0.001;
int density = 10;
float znoise = 0.0;

void setup() {
size(800,800,P3D);
background(0);
smooth();
noFill();
stroke(255);
}

void draw(){
background(0,25,0);
pushMatrix();
translate(width/2, height/2);
for(int i = -width/2; i < width/2; i+=gridSize) {
for(int j = -height/2; j < height/2; j+=gridSize) {
int y = 200;
line(i, y, j, i+gridSize, y, j);
line(i, y, j, i, y, j+gridSize);
}
}
popMatrix();
float xnoise = 0.0;
float ynoise = 0.0;
for (int y = 0; y < 600; y += density) {
for (int x = 0; x < width; x += density) {
float n = noise(xnoise, ynoise, znoise) * 160;
fill(100, n, 100);
rect(x, y, density, density);
xnoise += inc;
}
xnoise = 0;
ynoise += inc;
}
znoise += inc;
}

``````

This one is more focused on the planes, the other was focused on putting circles on the planes.

Fair enough. Personally, I hate the “fake 3D” an isometric view like that has; I’d much rather have a real 3D object, like this:

``````void setup() {
size(600, 600, P3D);
stroke(255);
strokeWeight(2);
}

void draw() {
background(0);
translate(width/2, height/2, 0);
rotateY(map(mouseX, 0, width, -PI, PI));
rotateX(map(mouseY, 0, height, -HALF_PI, HALF_PI));
translate(-100,100,-100);
for (int i = 0; i<11; i++) {
line( 0, 0, 20*i, 0, -200, 20*i );
line( 0, -20*i, 0, 0, -20*i, 200 );
line( 0, -20*i, 0, 200, -20*i, 0 );
line( 20*i, 0, 0, 20*i, -200, 0  );
line( 0, 0, 20*i,  200, 0, 20*i );
line( 20*i, 0, 0,  20*i, 0, 200  );
}
}
``````

Thank you lots, I really appreciate it. This is helpful.