Docsity

Final Exam with Practice Problems - Computer Graphics I | CS 4620, Exams of Computer Graphics

Toggle sidebar
bg1
CS 465 Prelim 1
Tuesday 5 October 2004
Problem 1: Image formats (18 pts)
A ray tracer computes and stores its image using this data structure to hold each pixel in the
final image:
public class RGBColor {
double r;
double g;
double b;
}
The image needs to be stored to an output file format that uses 8-bit RGB, gamma corrected
for γ= 2.2.
1. What is the ratio between the image size in memory and the size on disk?
2. If we omit gamma correction, will the image look darker than, lighter than, or the
same as the correct image?
3. Give the expression we would use to convert one of the color channels of an indi-
vidual pixel before writing to disk. Assume the functions round,pow,min, and
max are available. Don’t worry about Java type conversion rules—just compute the
integer value that needs to be stored in the file.
1
pf3
pf4

Partial preview of the text

Download Final Exam with Practice Problems - Computer Graphics I | CS 4620 and more Exams Computer Graphics in PDF only on Docsity!

Tuesday 5 October 2004

Problem 1: Image formats (18 pts)

A ray tracer computes and stores its image using this data structure to hold each pixel in the final image:

public class RGBColor { double r; double g; double b; }

The image needs to be stored to an output file format that uses 8-bit RGB, gamma corrected for γ = 2. 2.

  1. What is the ratio between the image size in memory and the size on disk?
  2. If we omit gamma correction, will the image look darker than, lighter than, or the same as the correct image?
  3. Give the expression we would use to convert one of the color channels of an indi- vidual pixel before writing to disk. Assume the functions round, pow, min, and max are available. Don’t worry about Java type conversion rules—just compute the integer value that needs to be stored in the file.

Problem 2: Ray Tracing Bugs (24 pts)

For each of the following bugs, give a simple test case that would catch the bug. Also describe how the image will be different, both visually and numerically, from the correct image.

  1. Your implementation of the Phong shading model computes the reflection vector as

vR = vL + 2((n · vL)n − vL)

where vL is the unit vector pointing toward the light and n is the surface normal. But you accidentally left out the 2.

  1. You and your partner somehow never discussed whether ray directions should be normalized. You wrote the Phong shader (which is now fixed to properly use the formula above) assuming the eye direction is always normalized. But your partner wrote the camera class, which computes the ray direction as the difference of the image plane point and the viewpoint and does not normalize it. Assume you’re testing with a camera that has an image plane distance of 1.
  2. You fix the previous bug by having the Phong shader normalize the eye vector, but you soon run into a related bug. You wrote the sphere intersection routine so that it normalizes the ray direction, then computes the correct t for the normalized ray. Your partner wrote the triangle intersection routine, and it computes t correctly but does not normalize the ray direction.
  3. You fix the previous bug by having the camera normalize ray directions. But now you have a problem with your shadows. You can’t remember who wrote the shadow ray generation code, but it does not normalize the direction of the shadow ray, leaving it as the difference between the light source position and the shading point. It tests for a shadow by looking for intersections in the interval [, 1].

Problem 4: Compositing (12 pts)

Prove that compositing with premultiplied alpha is an associative operation. That is, for any three images A, B, and C, prove that

(A over B) over C = A over (B over C).

Problem 5: Transformations (21 pts)

Classify each of the following 2D homogeneous matrices as follows: (a) rotation, (b) mirror reflection, (c) uniform scale, (d) nonuniform scale, (e) translation, (f) shear, or (g) combi- nation.

Earlier categories take precedence over later categories if more than one applies. There is not a one-to-one mapping between the matrices and the categories.