# Creating a small 3D model (House)

**URL:** <https://discourse.processing.org/t/creating-a-small-3d-model-house/38891>\
**Category:** Project Guidance\
**Created:** [September 21, 2022, 2:38am UTC](https://discourse.processing.org/t/creating-a-small-3d-model-house/38891 "2022-09-21T02:38:48Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [September 22, 2022, 11:05am UTC](https://discourse.processing.org/t/creating-a-small-3d-model-house/38891/6 "2022-09-22T11:05:46Z")

</div>

by the way:

in 3D mode (using P3D), the point 0,0,0 is in the upper left corner  
(like in 2D) but the standard camera looks to a point right from there:

- to width/2.0, height/2.0 and a Z-Position

You can see this here:

```auto
void setup() {
  size(1600, 900, P3D);
  background(20, 22, 254);
} // func 

void draw() {
  background(20, 22, 254);
  lights(); 

  sphereParams(0, 0, 0, 
    140);
}

void sphereParams(float x, float y, float z, 
  float sizeSphere) {
  // a sphere with parameters (the fill color must be set before calling the function; noStroke() is used in the function)
  pushMatrix();
  noStroke(); 
  translate(x, y, z);
  sphere(sizeSphere);
  popMatrix();
}
//

```

The sphere is in the upper left corner.

The standard camera has these default values :

```auto
camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / 180.0), // pos
width/2.0, height/2.0, 0, // look at
0, 1, 0); // angle 

```

Therefore in the “House Sketch” the cam is looking at  
`0, GROUND_LEVEL_Y-200, 0` which is the center of the scene.

**Remark**

Remember that in a 3D Sketch,

- x is normal (left/right position)
- but y is the virtual height **above** the scene and
- Z is into the screen (away from you) (forward / backward position)

So to place something on the scene / stage we mainly change x and z (!), not so much y.

**The idea of 3D space**

The idea of 3D space (with `size(1600, 900, P3D);`) is that you draw not on a canvas but inside a box / room / stage where you can place stuff further away (away from you, into the screen depth, Z-value) or nearer to you.

Imagine the room as the _space on a table_ where you place your scene:

The idea is that

- the first parameter is x (you move something left and right on the table surface e.g.),
- the 2nd parameter (y) is the height (you move something up and down **above** the table) and
- the 3rd parameter (z) is that you move something back and forth **on** the table surface (depth).

**The camera**

The camera has 9 parameters: 3 for position, 3 for lookAt, 3 for UP vector.

**Houses**

See also houses [Some Movies I made - #23 by Chrisir](https://discourse.processing.org/t/some-movies-i-made/13306/23)

Warm regards,

Chrisir

---

_[View the full topic](https://discourse.processing.org/t/creating-a-small-3d-model-house/38891)._
