Homework 6
This assignment was to create a 3-D viewing pipeline. The process for
creating a perspective projection is (as found on the course webpage):
-
Translate the VRP to the origin: VTM = T(- vrp.x, - vrp.y, - vrp.z).
-
Align the coordinate axes:
-
Normalize the VPN and VUP.
-
Create UVEC = VUP x VPN.
-
Redo VUP' = VPN x UVEC.
-
VTM = RotateXYZ(UVEC, VUP', VPN) * VTM.
-
Translate the COP (represented by the projection distance) to the origin: VTM = T(0, 0, d) * VTM.
-
Scale to the canonical view volume [CVV]:
-
Let B = B + d.
-
VTM = Scale( 2 * d / (du * B), 2 * d / (dv * B), 1 / B) * VTM.
-
Project onto the image plane:
-
Let d = d / B.
-
VTM = PROJpersp(d) * VTM.
-
Scale to the image size*: VTM = Scale( - screenX / (2 * d), - screenY / (2 * d), 1.0) * VTM.
* As given this equation is for PPM images. For TIFF images don't invert the y coordinate.
-
Translate the lower left corner to the origin: VTM = T(screenX/2, screenY/2) * VTM.
The first required image was a one-point perspective picture, looking at a
unit cube from (.5, .5, -2) with a d of 2.
The second required image was a three-point perspective image of a unit cube.
Questions
- What are the (x,y) values for the eight corners of the cube in the first
required image?
(25,25) (75,25) (75,75) (25,75)
(30,30) (70,30) (70,70) (30,70)
- How does modifying the distance between the COP and the VRP affect
the appearance of the cube in the first required image?
Larger distances between the COP and VRP effectively "zoom in" on the
square, making both the near and far faces of the cube larger, and making
the difference between their sizes less (an infinite distance would be a
parallel projection).
- How does modifying the direction of VUP modify the appearance of the
cube in the first required image?
It rotates the cube on an axis between the viewer and the center of the cube.
- How does modifying the size of the view window modify the appearance of
the cube in the first required image?
It shrinks it or enlarges it. Smaller window = bigger square.
Extensions
We made some pretty pictures and integrated our projection with our
hierarchical modeling system. The user creates modules (with our new 3D
drawing tools--3D lines, 3D polygons, and 3D polylines--or not), and then
creates a final module which includes the Set3DTransform() call.
For our first pretty picture, we did a "drive by". The camera zips by the
cube along a line parallel to the x axis, pointing at the cube all the while.
For our second pretty picture, we did an image where the camera rotates around
the cube at an inclined angle.
For our third pretty picture, we played with the COP. This is totally
non-trivial, although it looks pretty silly. We made it so that the front
edge of the cube didn't chage while the projection distortion was increased.
This is the same effect as in the movies when they go from telephoto to
wide angle while moving toward an actor's face to make the features shrink
back around the skull (like in the episode of STTNG when Picard is captured
and tortured by the Cardassians. It was at some moment of surprise and
terror for Jean Luc, and the camera did the effect very quickly to emphasise
the horror. "There are four lights!"). We didn't feel like moving the VRP,
though, so we changed the size of du and dv accordingly, instead, using
similar triangle relations. The VRP is 2 units
from the front edge of the cube and the image is twice as tall as the cube, so
du = 2d/(d+2) will keep the front side static while distorting the back side.
The enterprise fleet, ready to take on the Romulans . . . but wait . . . the
fleet seems to be missing something . . . .