CS488 Visible-Surface Determination
Luc RENAMBOT
1
CS488 Visible-Surface Determination Luc R ENAMBOT 1 - - PowerPoint PPT Presentation
CS488 Visible-Surface Determination Luc R ENAMBOT 1 Visible-Surface Determination So far in the class we have dealt mostly with simple wireframe drawings of the models The main reason for this is so that we did not have to deal with
Luc RENAMBOT
1
2
The following sets of images show a wireframe version, a wireframe version with hidden line removal, and a solid polygonal representation of the same object
3
If we do not have a way of determining which surfaces are visible then which surfaces are visible depends on the
drawn with surfaces being drawn later appearing in front
5
are hidden. If we can quickly compute which surfaces are hidden, we can bypass them and draw only the surfaces that are visible
sided cube, at most 3 of the 6 sides are visible at any one time, so at least 3 of the sides do not even need to be drawn because they are the back sides
6
in a particular order. We would like to tell the graphics routines to draw all the polygons in whatever order we choose and let the graphics routines determine which polygons are in front of which other polygons
have to compute for ourselves which order to draw the visible faces, and then tell the graphics routines to draw them in that order.
7
8
9
themselves before they are converted to pixels in the frame buffer.
calculation is done at the mathematical level of the objects
(involves comparing the polygons in object a to other polygons in a and to polygons in every other object in the scene)
10
being converted to pixels in the frame buffer
is done on a pixel by pixel basis
location
that location
11
12
13
14
15
16
17
(or polygon)
not one object to another
the endpoints of the intersection
18
19
20
21
22
23
24
polygons be drawn such that the vertices are given in counterclockwise order as you look at the visible side of polygon in order to generate the 'correct' normal.
points away from the viewer is a 'back-facing' polygon and does not need to be further investigated
25
Front facing Back facing
26
27
28
29
the inside and the outside of the box both need to be visible, so either two sets of polygons must be generated, one set facing
must be turned off to draw that object
30
holds the color for each pixel to be displayed
bytes for each pixel depending on whether it was a grayscale, RGB, or color indexed frame buffer
set to be the background color
be the color of the line or polygon at that point
31
32
'very far away’
this new color is compared to the current depth in the z- buffer
given the new color
retains its old value
33
for each polygon for each pixel p in the polygon's projection { //z ranges from -1 to 0 pz = polygon's normalized z-value at (x, y); if (pz > zBuffer[x, y]) // closer to the camera { zBuffer[x, y] = pz; framebuffer[x, y] = colour of pixel p } }
34
does not matter, the algorithm will always display the color of the closest point
precision
be as close together as possible to increase the resolution of the z-buffer within that range
mathematically be 'in front' of another that difference may disappear due to roundoff error
35
36
37
subdivision algorithm
visible in the area, they are drawn
and the algorithm recurses.
non-intersecting polygon
38
subdivided into four equal areas
put into one of four bins
contain the area
contained in the area
area
39
case 1. If all polygons are disjoint then the background color fills the area case 2. If there is a single contained polygon or intersecting polygon then the background color is used to fill the area, then the part of the polygon contained in the area is filled with the color of that polygon case 3. If there is a single surrounding polygon and no intersecting or contained polygons then the area is filled with the color of the surrounding polygon case 4. If there is a surrounding polygon in front of any other surrounding, intersecting, or contained polygons then the area is filled with the color of the front surrounding polygon
40
41
Book, pages 686-688
case 1. If all polygons are disjoint case 2. If there is a single contained polygon or intersecting polygon case 3. If there is a single surrounding polygon and no intersecting or contained polygons case 4. If there is a surrounding polygon in front of any other surrounding, intersecting, or contained polygons
height) recursive steps will be needed
which can't be divided further
intersecting,contained in, or surrounding the area is computed at the center of the polygon to determine the closest polygon and its color
polygons
42
43