Docsity

Midterm Exam Solution - Computer Graphics | ECSE 4750, Exams of Computer Graphics

Toggle sidebar
bg1
Computer Graphics ECSE-4750 Midterm – Solution
1. What do the contrasting stories of the Brooklyn Bridge and the Quebec
Bridge teach us?
Engineering grounded in reality. Good design must follow the laws. If you break
the laws in your design then bad things happen. On the other hand, a good design
can be around for a very long time.
2. Processing objects 1-by-1 with a graphics pipeline has a major advantage
and also a major disadvantage. Name them.
Advantage: Graphics pipeline are more efficient since the objects are processed
in parallel.
Disadvantage: Interactions between the objects, where light reflecting from one
object makes another one brighter, cannot be modeled.
3. Why must you remove objects that are outside the view volume?
If don’t remove them, the objects behind the camera will be projected into the
image.
4. Does a straightline always remain straight after perspective projection? Give
a reason; not just yes/no.
Yes.
Prof: Given the line equation in 3D
0
0
0
X
Y
Z
XV
X
YY V
ZV
Z
α
⎛⎞ ⎛⎞
⎛⎞⎜⎟ ⎜⎟
⎜⎟
=+
⎜⎟ ⎜⎟
⎜⎟
⎜⎟ ⎜⎟
⎜⎟
⎝⎠ ⎝⎠
⎝⎠
(1)
The perspective projection project the 3D coordinate ( , , )T
X
YZ to image
coordinate( , )T
x
y:
X
x
f
Z
= -(2) and Z
Y
fy = -(3) (f is the focus length)
Combining (1),(2) and (3):
0000
0000
()
()
XXZ
ZZ
X
XVX ZVXV
xf
ZZ V Z ZZ V
α
α
αα
+−
== =+
++i and
0000
0000
()
()
YYZ
ZZ
YY V Y ZVYV
yf
Z
ZVZZZV
α
αα
+−
== =+
++i
pf3
pf4
pf5

Partial preview of the text

Download Midterm Exam Solution - Computer Graphics | ECSE 4750 and more Exams Computer Graphics in PDF only on Docsity!

Computer Graphics ECSE-4750 Midterm – Solution

1. What do the contrasting stories of the Brooklyn Bridge and the Quebec Bridge teach us?

Engineering grounded in reality. Good design must follow the laws. If you break the laws in your design then bad things happen. On the other hand, a good design can be around for a very long time.

2. Processing objects 1-by-1 with a graphics pipeline has a major advantage and also a major disadvantage. Name them.

Advantage: Graphics pipeline are more efficient since the objects are processed in parallel.

Disadvantage: Interactions between the objects, where light reflecting from one object makes another one brighter, cannot be modeled.

3. Why must you remove objects that are outside the view volume?

If don’t remove them, the objects behind the camera will be projected into the image.

4. Does a straightline always remain straight after perspective projection? Give a reason; not just yes/no. Yes. Prof: Given the line equation in 3D 0 0 0

X Y Z

X X V

Y Y V

Z Z V

The perspective projection project the 3D coordinate ( X Y Z , , ) T to image coordinate ( , x y ) T : X x f Z

= -(2) and Z

Y

y = f -(3) (f is the focus length)

Combining (1),(2) and (3): 0 0 0 0 0 0 0 0

X X Z Z Z

X X V X Z V X V

x f Z Z V Z Z Z V

  • i +

and

0 0 0 0 0 0 0 0

Y Y Z Z Z

Y Y V Y Z V Y V

y f Z Z V Z Z Z V

  • i +

So, 0 0 0 0 0 0 0 0

X Z Y Z

x X Z Z V X V y Y Z Z V Y V

This is a 2D line equation: 0 0 0 0 0 0 0 0

X Z Y Z

x X Z Z V X V y Y Z Z V Y V

β

⎜ ⎟ =^ ⎜ ⎟ + ⎜ ⎟

5. Why do we want to make projection into a matrix multiplication?

Multiple projections (perspective projection, orthogonal projection, etc) can be systematically reduced into a single matrix multiplication. Computer hardware is also particularly efficient at matrix computation.

6. Why does OpenGL contain primitives, like triangle fans, that are not necessary (since you could draw the triangles separately)?

Performance, since using triangle fans prevents repeating unnecessary vertices. I reduce the computational cost.

7. Why do we consider color to have three dimensions, such as RGB? There are an infinite number of visible wavelengths.

Because the RGB model is representative of how the human visual system works. We see color as different intensities of red, green and blue. Therefore we can represent all visible colors using this 3 dimensional representation.

8. What is the event loop?

The event loop continuously listens for events to occur. When such an event occurs (input from mouse, keyboard, timer, etc….) the appropriate callback is executed.

9. What does this do: glutDisplayFunc(display)

It registers the display callback.

10. If you don't want to use the entire window for your image, what subroutine do you call?

glViewport

11. What does this do: glMatrixMode(GL_PROJECTION);

All subsequent transformations act on a projection matrix

12. Since the mydisplay routine takes no arguments, how do you get data from the main program to it?

  1. Easy to carry out successive transformations in 3D

20. How is the Z buffer used to make closer objects display in front of farther ones? The object is processed one by one. And the Z-buffer keeps updating if the new fragment has greater depth than the current depth in the Z-buffer. So, finally the Z-buffer saves the closest fragment and save its color in the corresponding color buffer. 21. Consider this sequence of calls: glColor3f(1.,1.,1.); glColor3f(0.,1.,0.); glVertex3f(1.,1.,1.); glVertex3f(2.,2.,2.); a. What color is the vertex (1,1,1)? Green

b. What color is the vertex (2,2,2)? Green

22. What's the point of using two color buffers, one to draw into, while the other is being displayed?

If we just use one buffer, when we change the content of the frame buffer during refreshing, maybe only part of the buffer is updated and we may see partially drawn display. Double buffer can handle these by displaying the front buffer and drawing the back buffer.

23. Why are three color buffers even better?

It can avoid tearing caused by swapping the foreground and background buffers in the middle of refreshing the image and the two buffers have different images. Using 3 buffers, you can display from the 1 st^ buffer, have the 2nd^ buffer ready to swap with the 1st in the next vertical retrace, and meanwhile compute into the 3rd buffer.

24. Give the 4x4 homogeneous matrix for a 60 degree rotation about the Y axis. cos(60) 0 sin(60) 0 0 1 0 0 sin(60) 0 cos(60) 0 0 0 0 1

25. To deal with multiple functions for a similar purpose, C++ and OpenGL take different approaches: C++ use overloading while OpenGL defined a number

of functions which differ from each other in the last letter, for example, glVertex3f, glVertex2i, glVertex3dv all create vertex but the first take different data types as input. What is an advantage of each approach?

C++ approach is easier for programmer, since you don’t need to change the code if the data type changes. OpenGL approach is more efficient. The programmer can have better control of the program, and use suitable data type for specific purpose.

26. How does the following code guarantee the correctness of the resize process?

It makes the aspect ratio of the viewpoint equal to the aspect ratio of the viewing volumn.

27. Since the Z buffer looks so useful, why is it not enabled by default?

Z-buffer is not necessary for all the cases (such as 2D case). So, for efficiency, it is not enabled by default.

28. Why do we like to group different physical input devices into the same logical input device?

We just need to care about “what is inputed” in our code. And we don’t need to know “how it is inputed”. So, when the input device is changed, we can use the same code.