Shared Flashcard Set

Details

Clipping and visibility in computer graphics
Not all objects are visible in our world, so there's a need to eliminate objects or parts of objects that are not visible. Test algorithms for doing that.
11
Computer Science
Undergraduate 3
01/18/2013

Additional Computer Science Flashcards

 


 

Cards

Term
Explain the visibility problem.
Definition
Not everything in our world is visible. The camera has a finite length of view. Objects get in the way, sometimes of themselves. So, we need techniques to eliminate unnecessary objects or parts of objects.
Term
Explain the naive clipping algorithm.
Definition
Clip each pixel before accessing the frame buffer. The algorithm proceeds as follows:
def SetPixel(x,y, colour):
if x >=0 and x <= x_max and y >=0 and y <=y_max:
frame[x,y]= colour
Term
Explain the advantages and disadvantages of naive clipping.
Definition
It always works but it is slow because it adds unnecessary tests to the innner most loop of the output producing code.
Term
Explain Cohen-Sutherland line-clipping.
Definition
We split the world into 9 regions. The window placed in the middle one. Three regions above window, three regions below, 1 to the left, 1 to the right. This gives 4-bit out-codes. The first bit: above top edge, 2nd bit: below bottom edge, 3rd: right of right edge, 4th:left of left edge. If the condition is true bit is set.Trivial acceptance, trivial rejection. Explain the algorithm in steps.
Term
Explain the Liang-Barsky algorithm for polygon clipping.
Definition
Consider the polygon as list of vertices. Consider each line segment in turn. Only four possible cases: totally in, totally out, going in, going out.
Term
Explain backface culling.
Definition
Only draw a polygon if it's outside faces the camera.
N: normal vector,
n: direction towards the viewpoint from the centre of the polygon and th is the angle between them
N.n = |N||n|cos(th) if cos(th) is positive then polygon points towards the camera.
Term
Explain painters algorithm.
Definition
Sort the polygons according to furthest z. Draw the polygons in reverse order, starting with the furthest away. Polygons furthest away will be drawn first and then overwritten by those nearer.
Term
Problem with Painters algorithm.
Definition
Real polygons can overlap in z as well as xy. If those conditions are met:
Overlap in x or y
Is one either fully or fully behind of a plane defined by one polygon.
Then split the polygons accordingly. This is real painter's algorithm.
Term
How does the z-buffer work? Explain the algorithm.
Definition
We have a z-buffer with the same size as the frame buffer. It is used to keep the distance from the camera of the nearest object at that pixel.
Algorithm:
if z_current < z(buffer):
update the colour in the frame buffer, update the value in the z-buffer.
else
do nothing.
Term
Discuss the advantages and disadvantages of the z-buffer algorithm being used for visibility.
Definition
Advantages:
Easy to do in hardware
Can use smart memory of comparisons
Easy to do in software
No spacial cases, just pass z to set pixel routine
Works well with things other than planes, more general
Disadvantages
Must draw everything, can use back-face culling to eliminate some
Term
Explain the technique used so we don't have to calculate distance at each pixel.
Definition
Instead of calculating distance(z) at each pixel. Calculate distance at vertices and used bi-linear interpolation to find the corresponding value at the required pixel.
Supporting users have an ad free experience!