Taking 2D objects and mapping onto a 2D screen is pretty straightforward. The window is the same plane as the 2D world. Now we are taking 3D objects and mapping them onto a 2D screen.
Here is where the advantage of separating the model world from its rendered image becomes more obvious. The easiest way to think about converting 3D world into 2D image is the way we do it in real life - with a camera.
Lets say we have an object in the real world (e.g. the Sears Tower.) The tower sits there in its 3Dness. You can move around the tower, on the ground, on the water, in the air, and take pictures of it, converting it to a 2D image. Depending on where you put the camera and the settings on the camera, and other factors such as light levels, you get different looking images.
In the computer we have a synthetic camera taking still or moving pictures of a synthetic environment. While this synthetic camera gives you a much wider range of options than a real camera, you will find it is VERY easy to take a picture of nothing at all.
And a quick trip to the Renaissance ...
Albrecht Dürer, Daraughsman Drawing a Recumbent Woman (1525) Woodcut illusion from 'The Teaching of Measurements.'
projection is 'formed' on the view plane (planar geometric projection)
rays (projectors) projected from the center of projection pass through each point of the models and intersect projection plane.
Since everything is synthetic, the projection plane can be in front of the models, inside the models, or behind the models.
2 main types: perspective projection and parallel projection.
which type of projection is used depends on the needs of the user - whether the goal is the mathematically correct depiction of length and angles, or a realistic looking image of the object.
Danger, watch out for acronyms being tossed out!
Need to know the type of projection
Need to know the clipping volume
in OpenGL there are the following functions:
glFrustum(left, right, bottom, top, near, far);
glOrtho(left, right, bottom, top, near, far);
View Plane defined by:
view plane can be anywhere in the world-space
The center of projection represents the location of the viewer's eye or the camera's lens.
Need to define a 3D Viewing Reference Coordinate system
(VRC) which has axis u, v, n
since the View Plane (n=0) is infinite (as it is a plane) we need to declare a region of that plane to be our window.
Projection Reference Point (PRP) defines the Center of Projection and Direction of Projection (DOP)
Perspective projections are categorized by the number of axes the view plane cuts (ie 1-point perspective, 2-point perspective or 3-point perspective)
If the plane cuts the z axis only, then lines parallel to the z axis will meet at infinity; lines parallel to the x or y axis will not meet at infinity because they are parallel to the view plane. This is 1-point perspective.
If the plane cuts the x and z axes, then lines parallel to the x axis or the z axis will meet at infinity; lines parallel to the y axis will not meet at infinity because they are parallel to the view plane. This is 2-point perspective.
If the plane cuts the x, y, and z axis then lines parallel to the x, y, or z axis will meet at infinity. This is 3-point perspective.
The n-point perspectives can work with any combination of the x, y, z axis.
The view volume in orthographic projection:
The view volume in perspective projection:
The front plane's location is given by the front distance F
relative to the VRP
The back plane's location is given by the back distance B relative to the VRP
In both cases the positive direction is in the direction of the VPN
Viewing volume has 6 clipping planes (left, right, top, bottom,
near (hither), far (yon)) instead of the 4 clipping lines we had
in the 2D case, so clipping is a bit more complicated
perspective - viewing volume is a frustum of a 4-sided pyramid
parallel - viewing volume is a rectangular parallelepiped (ie a box)
In the red version of the Foley vanDam book see P.211-212.
In the white version of the Foley vanDam book see P.250-252.
Here are some examples using the same house as in the book (figure 6.18 in the red version of the Foley vanDam book, figure 6.24 in the white version of the Foley vanDam book, but using Andy Johnson's solution to the former HW3 as the viewing program:
The object is a house with vertices:
0, 0,30 16, 0,30 16,10,30 8,16,30 0,10,30 0, 0,54 16, 0,54 16,10,54 8,16,54 0,10,54
VRP= 0 0 54 or VRP= 8 7 54 VPN= 0 0 1 VPN= 0 0 1 VUP= 0 1 0 VUP= 0 1 0 PRP= 8 7 30 PRP= 0 0 30 U: -1 to 17 U: -9 to 9 V: -2 to 16 V: -9 to 9
VRP= 16 0 54 VPN= 1 0 0 VUP= 0 1 0 PRP= 12 8 16 U: -1 to 25 V: -5 to 21
VRP= 16 0 54 VPN= 1 0 1 VUP= 0 1 0 PRP= 6 8 10 U: -22 to 22 V: -2 to 18
For other examples, in the red version of the Foley vanDambook
In the white version of the Foley vanDam book see P.245-250.
In the red version of the Foley vanDam book see P.212-213.
In the white version of the Foley vanDam book see P.253.
with lots and lots of matrices.