1 / 40

Visible Surface Detection VSD

Viewing process so far. define a view systemprojection (parallel or perspective) on to a view-(projection) planea view volume (parallelepiped or pyramid) is defined from projectionclose the view volume. transform the closed pyramid to a parallelepiped (in case of perspective proj.)transform the

jon
Download Presentation

Visible Surface Detection VSD

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Visible Surface Detection VSD Sometimes also called Hidden Line Hidden Surface Removal HLHSR

    2. Viewing process so far define a view system projection (parallel or perspective) on to a view-(projection) plane a view volume (parallelepiped or pyramid) is defined from projection close the view volume transform the closed pyramid to a parallelepiped (in case of perspective proj.) transform the parallelepiped to a unit cube with normalized coordinates perform 3D clipping (in principle, polygon clipping)

    3. Intro to VSD In principle, VSD is equal to HLHSR No best algorithm exists! Sorting and coherence are important ingrediants Classification of algorithms: object-space methods * use object definitions directly 2) image-space methods (most common) * use the projected object images * pixel by pixel decisions

    4. Back-face detection/removal A first general step in the VSD process is to detect and remove back-faces The process (also called culling) compares the outgoing surface normal from each polygon and compare it with the viewing direction Then, if the outgoing surface normal of the polygon is in the viewing direction, the polygon is a back-face and can be removed

    5. Back-faces,cont’d Typically, if viewing in the negative z-axis direction and using a right-handed system, then if C=0 (C is the z coefficient in the plane equation) then the polygon is back-faced For all non-overlapping convex objects (polyhedrons), all hidden surfaces are identified! Generally, about half of all hidden surfaces are eliminated in this first step.

    6. Example,back-faces Assume a slice through an object where N1-N6 are the surface normals of the boundary polygons (left-handed system!)

    7. Three VSD techniques Depth-Buffer method (Z-buffer method) image space method Scan-Line method image space method Depth-Sorting method object space method

    8. Depth-Buffer method Assume Normalized projection coordinates, 0=x,y,z=1 Right-handed system (looking in the negative z-axis direction) Polygon surfaces Only non-transparent (solid) objects

    9. Depth-Buffer method,cont’d Requirements: Two buffers are needed representing all pixel positions: a depth buffer keeping the (current) z-value (depth) of each pixel a refresh buffer, typically the frame buffer, keeping the (current) intensity value of each pixel

    10. Depth-Buffer method,cont’d Initializations: the refresh buffer is initiated with the background color the depth buffer is initiated with z=0 (corresponds to the background depth)

    11. Depth-Buffer method,cont’d Strategy: Each object is processed at a time, each of its projected polygon surfaces is then processed (scan-converted along scan-lines) separately, one point (pixel) at a time. A pixel is written in the refresh buffer only if its depth position is nearer than the currently registered value for that position in the depth buffer

    12. Depth-Buffer method,cont’d

    13. Depth-Buffer method,cont’d Basic algorithm part for testing a pixel, (x,y,z), in a projected polygon with a given intensity, color: if z > depthbuffer(x,y) then begin framebuffer(x,y):=color; depthbuffer(x,y):=z; end;

    14. Depth-Buffer method,cont’d After all objects with their projected polygon surfaces have been scan-converted in this way, the correct image is in the refresh buffer Time-consuming (problem in real-time applications) and memory demanding (less of a problem today)

    15. Depth-Buffer method,cont’d Important to make use of coherence properties when testing all the points in the scan-conversion of polygons Instead of explicitly calculating the depth (z-) value for each point direct from the plane equation for the polygon, some kind of recursive process for getting the depth values will help significally

    16. Depth-Buffer method,cont’d Assume plane equation: Ax + By + Cz + D = 0 Then, the depth in (x1,y1): z1 = (-Ax1 - By1 -D)/C Next point on the same scan-line is (x1+1,y1) with depth: z2 = [-A(x1+1) - By1 -D]/C This gives: z2 = z1 - A/C, where A/C is constant for the whole polygon!

    17. Depth-Buffer method,cont’d Similar when changing scan-line (assume down the left side of the polygon with an edge slope m): z1 = (-Ax1 - By1 - D)/C and z2 = [-A(x1 - 1/m) - B(y1 - 1) - D]/C that gives: z2 = z1 + (A/m + B)/C (if vertical edge, then z2 = z1 + B/C)

    18. A-buffer method an extension of the depth-buffer method can also deal with transparent objects needs to accumulate several intensity values in each position each position references a linked list of surfaces the final pixel color will be completed as a combination of different surface data

    19. Scan-Line method An extension of the Scan-Line algorithm for polygon filling in 2D For each scan-line, all polygon intersections are examined to decide which one is the visible one (i.e. the one with the least depth) The record structure for edges in the 2D case then needs to be extended

    20. Scan-Line method,cont’d Edge record: endpoint coord’s slope inverse polygon reference Polygon record: plane equation surface properties, e.g. intensity flag (false before each new scan-line; true when scanning inside the polygon reference to edges

    21. Scan-Line method,cont’d For each scan-line, an active list of edge records is sorted on increasing x coordinates; the list is maintained and updated in the same way as for 2D filling

    22. Scan-Line method,cont’d On a new scan-line, for each edge record, the following is done: the flag related to the polygon, to which the edge belongs, is inverted, i.e. set to true on entrance of the polygon and set to false when leaving the polygon for the point determined by the x-value of the edge record and the scan-line (y-value), a depth comparision is done between those polygons having a true flag

    23. Scan-Line method,cont’d current intensity is defined by the polygon with the least depth print pixels on the scan-line by using the current intensity until the x-value of the next edge record is encountered in the list

    24. Scan-Line method,cont’d To determine the depth: use the plane equation for the polygon If no true flag, print the background intensity If only one active polygon, print the intensity of it Coherence: intensity is preserved from one scan-line to the next as long as the active list is the same

    25. Scan-Line method,cont’d

    26. Scan-Line method,cont’d The method works correctly with any number of overlapping polygon surfaces only if surfaces do not cut through or otherwise cyclically overlap each other

    27. Depth-Sorting method Also called Painter’s algorithm Assume viewing in the positive z-direction (left-handed system) Main idea: The polygons are sorted in priority order (high z-value => low priority), and they are written in the refresh buffer (frame buffer) in reverse priority order. Polygon parts that are hidden will sooner or later be overwritten

    28. Depth-Sorting method,cont’d The priority order is initially based on z-max for each polygon. Much work to examine overlappings in different respects. In the (projected) xy-plane, use a rectangle to bound the projection of a polygon => much easier examination

    29. Depth-Sorting method,cont’d Algorithm first, sort the polygons in order of decreasing zmax Then, compare the first polygon, P, in the list with the rest of the polygons whether there are any overlaps*) in depth. If so, reorder the polygons in the list so that P is exchanged with an overlapped polygon, say Q. Repeat this step with the new list.

    30. Depth-Sorting method,cont’d Algorithm,cont’d When the first polygon in the list is not overlapping , scan convert (i.e. write) the polygon in the refresh (frame) buffer and remove it from the list Repeat from step 2) until the list is empty

    31. Depth-Sorting method,cont’d *) A polygon P is not overlapping a polygon Q if any of the following tests is positive: No overlapping in depth (zQmax<zPmin) The bounding rectangles in the xy-plane do not overlap All vertices in P are lying behind the plane defined by Q

    32. Depth-Sorting method,cont’d No overlapping in depth (zQmax<zPmin)

    33. Depth-Sorting method,cont’d 2) The bounding rectangles in the xy-plane do not overlap

    34. Depth-Sorting method,cont’d All vertices in P are lying behind the plane defined by Q

    35. Depth-Sorting method,cont’d All vertices in Q are lying in front of the plane defined by P The projection of the two polygons on to the projection plane do not overlap The tests are listed in order of increasing complexity, and the first test that is true means that P and Q are changing places in the list and step 2) is repeated

    36. Depth-Sorting method,cont’d All vertices in Q are lying in front of the plane defined by P

    37. Depth-Sorting method,example

    38. Depth-Sorting example,cont’d The initial polygon list is: A B C D E F One correct order in which the polygons are written: C A E D B F No guarantee for an unambigous priority order

    39. Depth-Sorting problems Similar problems as for the Scan-Line method can also occur here. If two (or more) surfaces obscure each other, we can come into infinite loops. The solution is again to split polygons

    40. Comparing the three methods Depth-Buffer is the most general method and clearly the best when the image complexity increases Depth-Sorting is best when there are only a limited number of objects (polygons) Obscuring problems with Depth-Sorting and Scan-Line (needs extra processing) Scan-Line can take advantage of the hardware refresh cycles, but generally only second best

More Related