Name: _______________________________ Student ID: _______________________________

Total points: 70 (actual exam will be a bit shorter than this)
1. In your own words, compare the complementary fields of computer graphics and image analysis.

Synthesis vs. analysis: both are components of visual computing. Computer graphics starts with digital representations of objects (triangle meshes, lights, etc.) and produces images on screen. Image analysis starts with images (digital camera, satellite, MRI, etc.) and produces digital representations of the objects in the images.
2. The USC Parthenon project whose video we saw in class used a variety of visual computing techniques. For each of the following techniques, discuss whether you'd classify it as computer graphics or image analysis, or a combination thereof:
• Panoramic laser range-finder scans to construct a 3D model of the geometry of the Parthenon.

Scanning is image acquisition/analysis: the "images" are depth maps from the laser range-finder; the output is digital representation (3D model).
• Movie rendered using the Arnold global illumination software package (statistical solution to the global rendering equation).

Rendering is computer graphics: from digital representation, producing a movie.
• Time-lapse background sky images acquired in high dynamic range in Marina del Rey, California.

Acquiring images is part of image analysis: digital photography, capturing the world.
• Texture-mapping of digital photos of sculptures onto 3D models.

Texture-mapping is computer graphics: from digital photos and 3D models, producing images/movies.
(The categorizations in this problem are somewhat subjective, so you're free to disagree, as long as you provide a cogent explanation.)
3. Describe the pinhole synthetic camera model used in computer graphics.

In a real pinhole camera, light rays from the world converge at the pinhole, and are projected onto the image plane upside-down and backwards. In the synthetic camera model, we place the image plane in front of the center of projection. Rays are cast from the center of projection through each pixel of the image plane and into the world, in order to calculate the intensity value to be assigned to that pixel.
4. What is colour? Is an RGB triple (e.g., "#00FF77") a colour? Discuss.

Colour is a distribution of light energy across the visible spectrum ("frequency distribution"). An RGB triple is a point in a colour space, a combination of three chromaticities. Without specifying what those chromaticities are or how they are combined, an RGB triple is not a colour.
5. Contrast the RGB, CMYK, and HSV colour models.

All three are relative colour spaces; as in the previous question, they do not define absolute colours but are defined relative to chromaticities (e.g., to define what "Red" is). CMYK is related to RGB by the linear transform: C = 1-R, M = 1-G, Y = 1-B. (K is to make it easier to reproduce blacks.) Whereas RGB is for additive colour (e.g., phosphors on a screen), CMYK is for subtractive colour (e.g., inks on a page). HSV is again a linear transform from RGB, where Hue specifies the colour in the rainbow (e.g., red, orange, yellow, etc.), Saturation specifies how grey or coloured it is (e.g., zero saturation is shades of grey), and Value specifies the lightness (dark to bright).
6. Contrast the goals of off-line rendering vs. real-time graphics. Which is OpenGL generally used for?

Off-line rendering prioritizes photorealism and image quality over rendering time -- it's okay if each frame takes days to render, as long as it looks really good. Real-time graphics places a constraint of rendering time -- we still want it to look good, but not if that means our framerate drops below, say, 60 frames per second. OpenGL is generally used for real-time rendering.
7. Describe back-face culling. Why is it useful?

Back-face culling removes polygons whose normal vectors point away from the camera. The idea is that in a closed object, all polygons that point away from the camera are on the back side of an object and are occluded by front-facing polygons, so we won't see them, so they don't need to be rendered, so we can delete them from the graphics pipeline, which speeds up our rendering.
8. What is a fragment?

A fragment is a portion of framebuffer which corresponds to a single primitive. For instance, a triangle may project to a certain region in screen coordinates; its fragment consists of those pixels in the framebuffer, shaded and texture-mapped according to the illumination model.
9. What is clipping?

Clipping removes primitives which are outside the view frustum, the volume of space which is visible by the camera. (Note that back-face culling is different; back-face culling may remove primitives which are inside the view frustum.)
10. Describe the four types of lights offered by OpenGL.

• Point: has a location and colours (ambient, diffuse, specular). Similar to a candle.
• Directional: has a direction and colours, but no location. Similar to the sun. Specified in OpenGL the same way as point lights, but using homogeneous coordinates to specify a vector instead of a point.
• Spot: has a location, direction, cutoff depth, falloff exponent, and colours. Similar to a theatre spotlight.
• Global ambient: We can specify an ambient light that uniformly illuminates the whole scene. Similar to a very evenly lit scene like an open field on a cloudy day.
• (Area light: not offered by OpenGL, but we can model it using global illumination techniques like radiosity.)
• (Emissive OpenGL objects don't count as lights because they don't cast light on other objects.)
11. Discuss what is meant by calling OpenGL a "state machine".

Most OpenGL commands modify the current state, e.g., the current model-view matrix, or the current material properties. When a primitive is added, e.g., a vertex of a polygon, that primitive takes on whatever OpenGL state that was current at the time. The impact on coding is that we need to specify all the properties for a vertex before its glVertex() call.
12. How many parameters, and of what type, are required for the OpenGL C function glVertex3fv()?

One parameter, which is a pointer to an array of three floats.
13. Name and describe four of the nine OpenGL geometric primitives.
• GL_POINTS: a cloud of disconnected dots
• GL_LINES: a bundle of separate toothpicks
• GL_LINE_STRIP: a continuous, segmented, piecewise-linear curve
• GL_LINE_LOOP: like GL_LINE_STRIP, but the last vertex connects to the first vertex, making a loop
• GL_POLYGON: a planar filled region bounded by line segments, without self-intersection
• GL_QUADS: a bunch of disconnected four-sided polygons
• GL_TRIANGLES: a bunch of disconnected three-sided polygons
• GL_TRIANGLE_STRIP: a strip of connected triangles
• GL_TRIANGLE_FAN: a group of triangles all connected at one vertex
14. Write a short C code snippet that draws a green triangle in OpenGL, with vertices at A = (0, 0, 0), B = (1, 0, 0), and C = (0, 1, 0).
glBegin( GL_TRIANGLES );
glColor3f ( 0.0, 1.0, 0.0 );
glVertex3f( 0.0, 0.0, 0.0 );
glVertex3f( 1.0, 0.0, 0.0 );
glVertex3f( 0.0, 1.0, 0.0 );
glEnd();

15. The two most important transform matrices in OpenGL are the model-view matrix (glMatrixMode( GL_MODELVIEW )) and the projection matrix (glMatrixMode( GL_PROJECTION )). Contrast the roles of these two matrices.

The model-view matrix transforms from world coordinates to camera coordinates: it specifies the location of objects in the virtual world relative to the camera. It is also what we use to position objects relative to each other. The projection matrix transforms from camera coordinates to screen coordinates: it converts from 3D points to 2D points.
16. What does it mean for a set of vectors to be linearly independent?

A set of vectors is linearly independent if no one vector in the set can be expressed as a linear combination of the other vectors. If we were to remove any vector from the set, then the vector space spanned by the set would collapse by a dimension.
17. What is a vector basis? What is a frame? Contrast the two.

A basis for a vector space is a set of vectors such that any given vector in the space can be written as a linear combination of the basis vectors. A frame is a basis together with a point defining the origin -- the basis by itself holds no location information; with a frame, we can represent both vectors and points relative to the frame.
18. Describe the convex hull of a set of points.

The convex hull is the smallest polygon that encloses all the points. It is like a "shrink-wrap" around the points. The vertices of the convex hull are a subset of the original set of points.
19. Describe the four operations allowed in an affine space.
• Vector addition (a vector plus a vector): u + v
• Scalar multiplication (a scalar times a vector): alpha * v
• Point-vector addition (a point plus a vector): p + v
• Scalar operations (scalar times/plus a scalar): alpha * beta + gamma
20. Tell me everything you know about homogeneous coordinates.
21. Create a 4x4 matrix M that first scales a point p by a vector s = (sx, sy, sz), then translates by a vector v = (vx, vy, vz). Assume p is a column vector in homogeneous coordinates, and the transformed point is p' = M p. For example, if p is the point (1, 0, 0), the scaling is (2, 1, 1), and the translation is (3, 0, 0), then the transformed point p' should be (5, 0, 0).
22. Write OpenGL C code to do the same.
23. Describe the four ways of defining 3D rotations discussed in class.
24. Write a C function that takes two points in normalized mouse coordinates (x,y), with 0 < x, y < 1, and finds the axis-angle (vector-angle) representation of the virtual trackball rotation. Such an axis-angle representation could, for example, be passed to glRotate() to create a 4x4 rotation matrix.
25. What are OpenGL display lists? Why use them? Any disadvantages?
26. Contrast orthographic projection with perspective projection.
27. What is the global rendering equation, and why is it infeasible to solve analytically in real-time?
28. Name and describe the four terms in the OpenGL local illumination model. For each term, list what vectors, if any, are required to compute the term.
29. Name all the OpenGL material properties needed to define a surface's material. How many numbers total?