






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Exam; Professor: Brogan; Class: Introduction to Computer Graphics; Subject: Computer Science; University: University of Virginia; Term: Spring 2004;
Typology: Exams
1 / 11
This page cannot be seen from the preview
Don't miss anything!
Introduction to Computer Graphics Midterm Examination Professor Brogan
Name:____________________________
Honor Pledge: This is a closed-book, closed-notes, independent exam. Please sign the honor pledge: On my honor as a student, I have neither given nor received information on this exam. Signed, ______________________
Display Technology
A row of pixels on a raster display. Somewhat true to call a row of pixels in the frame buffer a scanline.
The number of bits used to store the color for each pixel.
A number that corresponds to an index into the color map lookup table. The lookup table is an array of color descriptions (RGB). For example, index 0 could refer to the color BLACK, while the index 1 could refer to the color SKY_BLUE. The colors in the color map are reconfigurable.
A shadow mask is a perforated metal sheet that between the electron gun and the phospher coating on the screen. The shadow mask serves to sharpen the RGB beams that are emitted from the guns.
Mathematical Foundations
Slope-intercept: y = mx + intercept m = (d-b) / (c-a) intercept: Substitute a for x and b for y (or c for x and d for y) b = [(d –b) / (c – a)] * a + intercept intercept = b – a * [(d-b) / (c-a)]
Parametric: x = a + t (c-a) y = b + t (d-b)
Algebraic:
ux vx uyvy uzv z
u v uv = + +
Geometric: Two vectors define a plane Here, we’ve aligned the defined plane with the paper v
Θ u u • v
A matrix is orthonormal if: The row and column vectors have unit length The row and column vectors are pairwise orthogonal (their dot product is 0)
1
−
Rasterization
public void lineSimple(int x0, int y0, int x1, int y1, Color color) { int pix = color.getRGB(); int dx = x1 - x0; int dy = y1 - y0;
raster.setPixel(pix, x0, y0); if (dx != 0) { float m = (float) dy / (float) dx; float b = y0 - mx0; dx = (x1 > x0)? 1 : -1; while (x0 != x1) { x0 += dx; y0 = Math.round(mx0 + b); raster.setPixel(pix, x0, y0); } } }**
a) Describe a case where the algorithm will poorly render a line between the two points.
When the slope of the line is greater than 1.0.
findBoundingBox(&xmin, &xmax, &ymin, &ymax); setupEdges (&a0,&b0,&c0,&a1,&b1,&c1,&a2,&b2,&c2);
for (int y = yMin; y <= yMax; y++) { for (int x = xMin; x <= xMax; x++) { float e0 = a0x + b0y + c0; float e1 = a1x + b1y + c1; float e2 = a2x + b2y + c2; if (e0 > 0 && e1 > 0 && e2 > 0) setPixel(x,y); } }**
findBoundingBox(&xmin, &xmax, &ymin, &ymax); setupEdges (&a0,&b0,&c0,&a1,&b1,&c1,&a2,&b2,&c2); float e0 = a0x + b0y + c0; float e1 = a1x + b1y + c1; float e2 = a2x + b2y + c2; int xflag = 0; for (int x = xMin; x <= xMax; x++) { if (e0|e1|e2 > 0) { setPixel(x,y); xflag++; } else if (xflag != 0) break; e0 += a0; e1 += a1; e2 += a2; }**
Removed explicit line equation calculation inside the loop. Replaced with discrete difference equation. Removes multiplies
Condition check simplified to bitwise OR and one zero- comparison
xflag allows for early termination when end of line is reached
Nested for loops reduced to one for loop
Geometric Transformations
A 4x4 homogeneous transformation matrix allows rotation and translation transformations to be unified in one matrix representation. This facilitates concatenation of rotations, scales, translations, etc. Use of the homogeneous coordinate in the lower-right corner of the 4x4 matrix facilitates perspective and parallel projection calculations.
First, translate house to (0,0). Then rotate 90 degrees. Then translate house back to (10,5).
sin 90 cos 90 0
cos 90 sin 90 0
Rotate about y-axis –45 degrees to bring vector into YZ plane Rotate about x-axis 45 degrees to bring vector onto z-axis Rotate about z-axis by 90 degrees Unwrap x-rotation Unwrap y-rotation
Note: Right-handed coordinate system specifies that positive rotations are Counter-Clockwise (CCW) when looking from the positive axis towards the origin
sin( 45 ) 0 cos( 45 ) 0
cos( 45 ) 0 sin( 45 ) 0
0 sin( 45 ) cos( 45 ) 0
0 cos( 45 ) sin( 45 ) 0
sin( 90 ) cos( 90 ) 0 0
cos( 90 ) sin( 90 ) 0 0
0 sin( 45 ) cos( 45 ) 0
0 cos( 45 ) sin( 45 ) 0
sin( 45 ) 0 cos( 45 ) 0
cos( 45 ) 0 sin( 45 ) 0
d
y z
z
yd y ′=
d
Color and Light
Fovea
Blue
The perceived intensity (brightness) of a pixel is not linearly related to gun voltage.
I would pick HSV because it is intuitive to select a first select a hue and subsequently pick a saturation and a value. RGB, by contrast, is more difficult to tinker with. Blending between two different colors in RGB space is not as easily accomplished as when blending between two HSV values.
Given: an incoming light intensity, I a surface normal, N a vector from the surface to the light source, L a vector from the surface to the viewer’s eye, V specular constant, ks define the intensity of the light reaching the viewer as a result of the specular effects of the Phong lighting equation. Your definition may only use these variables. I (^) viewer = ks I (^) light (cos(φ)) n I (^) viewer = ks I (^) light (V ●R) n R = 2 (N ● L) N – L
Both Gouraud and Phong Shading interpolate along polygon edges to compute intensities. But the two shading models interpolate different things.
a) What does Gouraud Shading interpolate along edges?
Color / Intensity of the vertices at the edge endpoints.
b) What does Phong Shading interpolate along edges?
Vertex normals of the edge endpoints.
False
False
Jim Kajiya