# 3D Grid Design Help

**URL:** <https://discourse.processing.org/t/3d-grid-design-help/2862>\
**Category:** Coding Questions\
**Created:** [August 22, 2018, 7:20pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862 "2018-08-22T19:20:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thedurf18](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@thedurf18](https://discourse.processing.org/u/thedurf18)\
**Post date:** [August 22, 2018, 7:20pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862/1 "2018-08-22T19:20:49Z")

</div>

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.  
 ![grid](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f8b4c4bf5bcb1ed64973c0ae1e23d6780ea48b25.png)

Here’s the code I have so far:

```auto
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;
}

```

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [August 22, 2018, 7:33pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862/2 "2018-08-22T19:33:22Z")

</div>

Don’t you have a discussion about this already?

> [@Needing help with a design](https://discourse.processing.org/t/needing-help-with-a-design/2839):
>
> Hi, I’m trying to create a 3D grid, like the pic below: [grid] But I’d also like to add circles onto each axis: X, Y, Z. I’d appreciate any help. I have more than half of it done. 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); pushMatrix(); translate(width/2, height/2); for(int i = -width/2; i \< width/…

---

<div class="post-metadata">

**Author:** ![thedurf18](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@thedurf18](https://discourse.processing.org/u/thedurf18)\
**Post date:** [August 22, 2018, 7:42pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862/3 "2018-08-22T19:42:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [August 22, 2018, 8:26pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862/4 "2018-08-22T20:26:20Z")

</div>

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:

```auto
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 );
  }
}

```

---

<div class="post-metadata">

**Author:** ![thedurf18](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@thedurf18](https://discourse.processing.org/u/thedurf18)\
**Post date:** [August 22, 2018, 8:40pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862/5 "2018-08-22T20:40:02Z")

</div>

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