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:
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 :
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
Warm regards,
Chrisir