Assignment 1 - Transformations

Due - February 9

In this assignment, you will produce several images of the sphereflake defined in "balls.lrt" by moving the objects and the viewpoint around with homogeneous transforms. Transform commands comprise ConcatMatrix, Rotate, Scale, Translate, etc. The full list is in Appendix C, section C.1.2 on page 656. Appendix C as a whole deals with the definition of the input text file format. All transformations affect a systemwide Current Transformation Matrix (CTM), either by setting it to some value ("Identity, LookAt, Transform") or by postmultiplying it by a specified matrix to update its value. Note that postmultiplication means that the tranform steps are applied in the opposite order they are invoked. E.g. if you specify

Translate 1 2 3
Rotate 63
Sphere ...

the sphere will first be rotated and then be translated before it is displayed. Any transformations statements that appear before the "camera" statement define the world-to-camera transformation. Thus in the file "balls.lrt" there are two statements preceding the "camera" statement,

ConcatTransform [
0.52635503 -0.48208499 -0.70038903 0
-0.85026503 -0.29843301 -0.43357399 0
7.2777104e-18 0.82372999 -0.56698197 0
0 0 0 1 ]


Translate -2.0999999 -1.3 -1.7

The first is a rotation specified by giving all 16 entries of the 4x4 homogeneous matrix (how do we know it's a rotation?), the second a translate concatenated (postmultiplied) with the rotation. Recall that the world coordinate system is left-handed, and the camera position defaults to the origin looking down the positive z axis with up along the positive y axis. Any camera transforms change these parameters from that starting point. Since in this case we're not using the default camera position, you can think of these two transforms as translating the camera position to the origin and the rotating the frame so that the camera is looking down the positive z axis with positive y as up. Another way to accomplish this would be to specify these viewing parameters using the LookAt transform which will create a similar translate and rotate sequence as describe in Chapter 2 of the book.

Objects are defined in their own local coordinate systems and moved to their desired positions in world coordinates using transforms. For instance, all spheres are centered on their own local coordinate system origins when they are created. The existing definition of the sphereflake comprises instances of a sphere with differing radii, but each is preceded by a translate command and the tranform and object definition are embedded within an "AttributeBegin" "AttributeEnd" block. This block limits the scope of attributes such as material properties and transforms to only those objects within the block. Thus the first "Translate 0 0 0" statement in the file applies only to the first sphere defined, and not to subsequent spheres. This means that each of the "Translate" statements describes a motion to an absolute position within the world coordinate system, starting with the first sphere which remains at the origin. Notice that the "shinymetal" Material declaration that precedes all the sphere invocations is outside any "AttributeBegin" block and so applies to all objects defined later in the file that don't have their own material properties defined to override the shinymetal property. All of these attribute scoping properties are accomplished by maintaining an attribute stack. "AttributeBegin" is basically a push of the existing attributes onto the stack, and "AtributedEnd" pops the stack to restore the state to a previous value. Once the push is done, any changes will be effective only until the next pop.

Your assignment is to produce two series of views, one by moving the camera around, and the other by moving the sphereflake while leaving the camera at its default position. You should create 4 views each way. These should be from viewpoints on the positive x, y and z axes of world coordinates, and from a point along the vector (1,1,1), in each case looking at the origin of world coordinates. The Y axis should be up in each case as well.

For the first series of views, all but the view from the (1,1,1) vector should be produced by a sequence of calls to Rotate and Translate as needed. The final view should be produced using a single call to LookAt. All of these will appear before the camera declaration in the file.

For the second series of views, you'll move the objects with a fixed default camera position by using Translate and Rotate commands as needed after the WorldBegin declaration. Don't use LookAt for any of these.

The sphereflake itself provides poor cues about the orientation of the world coordinate space. In order to make your job, and the grader's job, easier, you should make some colored walls similar to the one at z=-0.5 in the original file. Your walls should be at x=-1, y=-1 and z=-1 and should be distinctly different colors to identify the coordinate axes. You should also make coordinate axis indicators from cylinders and cones. These should start at the origin and end one unit along each positive principal axis. The cones should point outward along these axes. The axis indicator should be color coordinated with the plane orthogonal to each axis.

You should position the eye to that the sphereflake and its shadows fill most of the screen but are all completely visible in each image.

For efficiency's sake, do your experiments at low res, say 90 by 90 or so (this is controlled by the "integer xsamples" and "integer ysamples" parameters in the Film declaration). Turn in your final images at 900 by 900 as in the original file.

A few glitches. It appears that LookAt will make a right handed coordinate system in addition to doing what you'd expect it to. That's okay for now. Also, feel free to move the light sources as you wish to get the picture to have nice shadows. And don't forget to remove the transform commands at the beginning of the file and replace them with your own.

If it doesn't make sense to have the y axis be "up" for a particular view, make your own reasonable choice and document it.

We will still use "turnin" as described elsewhere to turn this first assignment in. Please look at that description again, one detail has changed from the original posting. I'm holding off on using URLs because of the possibility of using up too much quota-restricted disk space on the departmental machines with images.