cli clipping and i d a ti li antialiasing i
play

Cli Clipping and i d A ti li Antialiasing i Werner Purgathofer - PowerPoint PPT Presentation

Einfhrung in Einfhrung in Visual Computing Visual Computing 186.822 Cli Clipping and i d A ti li Antialiasing i Werner Purgathofer g Clipping in the Rendering Pipeline object capture/creation scene objects in object space


  1. Einführung in Einführung in Visual Computing Visual Computing 186.822 Cli Clipping and i d A ti li Antialiasing i Werner Purgathofer g

  2. Clipping in the Rendering Pipeline object capture/creation scene objects in object space modeling vertex stage viewing g ( vertex shader“) („vertex shader ) projection transformed vertices in clip space transformed vertices in clip space clipping + homogenization scene in normalized device coordinates viewport transformation rasterization pixel stage p g shading shading („fragment shader“) raster image in pixel coordinates 1 Werner Purgathofer

  3. Overview: Clipping line clipping polygon clipping l li i triangle clipping g pp g 2 Werner Purgathofer

  4. Clipping partly visible or completely invisible parts must not be ignored and must not be drawn i ignored d scrolled ll d vertices edges g  must be cut off (as early as possible) (as early as possible) 3 Werner Purgathofer

  5. Clipping Operations remove objects outside a clip window clip window: rectangle polygon curved clip window: rectangle, polygon, curved boundaries applied somewhere in the viewing pipeline can be combined with scan conversion can be combined with scan conversion objects to clip: points, lines, triangles, polygons curves text polygons, curves, text, ... 4 Werner Purgathofer

  6. 3 Principle Possibilities for Clipping analytically in world coordinates reduces WC  DC transformations reduces WC  DC transformations analytically in clip coordinates simple comparisons simple comparisons d during raster conversation i t ti = as part of the rasterization algorithm may be efficient for complex primitives 5 Werner Purgathofer

  7. Line Clipping (1) P 9 P 4 P 2 P 2 P 10 P 10 P ´ 8 P 8 P 1 P 1 P 6 P 6 P 3 P 3 6 6 P ´ 5 P 5 P 7 P ´ 7 7 7 before clipping pp g after clipping pp g [line clipping against a rectangular clip window] 6 Werner Purgathofer

  8. Line Clipping (2) goals eliminate simple cases fast eliminate simple cases fast avoid intersection calculations for endpoints (x 0 ,y 0 ), (x end ,y end ) for endpoints (x 0 ,y 0 ), (x end ,y end ) intersect parametric representation x = x 0 + u · (x x x 0 + u (x end - x 0 ) x 0 ) y = y 0 + u · (y end - y 0 ) with window borders: with window borders: intersection  0 < u < 1 7 Werner Purgathofer

  9. Cohen-Sutherland Line Clipping assignment of region codes to line endpoints 1001 1000 1010 bit1: left bit2: right Window 0001 0000 0010 bit3: below bit3: below bit4: above 0101 0100 0110 0101 0100 0110 binary region codes assigned to line endpoints binary region codes assigned to line endpoints according to relative position with respect to the clipping rectangle the clipping rectangle 8 Werner Purgathofer

  10. Cohen-Sutherland Line Clipping “or” of codes of both or of codes of both points = 0000  1001 1000 1010 line entirely visible li ti l i ibl Window “and” of codes of both 0001 0000 0010 points  0000  line entirely invisible line entirely invisible 0101 0100 0110 0101 0100 0110 all others  intersect! 9 Werner Purgathofer

  11. Cohen-Sutherland Line Clipping P 2 P 2 P’ 2 [lines extending from one coordinate from one coordinate P” 2 P 2 Window Window region to another may pass through may pass through the clip window, or they may intersect they may intersect clipping boundaries P 3 P’ 1 without entering the without entering the P’ 3 window] P 1 P 4 10 Werner Purgathofer

  12. Cohen-Sutherland Line Clipping remaining lines intersection test with bounding lines of clipping intersection test with bounding lines of clipping window left, right, bottom, top discard an outside part discard an outside part repeat intersection test up to four times vertical: y = y 0 + m(xw min – x 0 ), y = y 0 + m(xw max – x 0 ) horiz.: x = x 0 + (yw min – y 0 )/m, x = x 0 + (yw max – y 0 )/m + ( )/m + ( )/m horiz : 11 Werner Purgathofer

  13. Cohen-Sutherland Line Clipping P P 2 P’ 2 passes through P” P 2 Wi d Window clipping window li i i d intersects boundaries without boundaries without entering clipping P 3 P’ 1 window window P’ 3 P 1 P 4 vertical: y = y 0 + m(xw min – x 0 ), y = y 0 + m(xw max – x 0 ) horiz.: x = x 0 + (yw min – y 0 )/m, x = x 0 + (yw max – y 0 )/m + ( )/m + ( )/m horiz : 12 Werner Purgathofer

  14. Polygon Clipping modification of line clipping goal: one or more closed areas g [display of a polygon [display of a polygon [display of a correctly [di l f l processed by a line- clipped polygon] clipping algorithm] clipping algorithm] 13 Werner Purgathofer

  15. Sutherland-Hodgman Polygon Clipping processing polygon boundary as a whole against each window edge against each window edge output: list of vertices clip original clip left clip right clip top bottom polygon polygon clipping a polygon against successive window boundaries 14 Werner Purgathofer

  16. Sutherland-Hodgman Polygon Clipping four possible edge cases V 2 V 2 V 1 V 1 V new V 2 V 1 2 1 V V 2 V V 1 V new V 1 V 2 out  in out  in in  in in  in in  out in  out out  out out  out output: V new , V 2 no output V 2 V new successive processing of pairs of polygon vertices against the left window boundary vertices against the left window boundary 15 Werner Purgathofer

  17. V 2 := 1 st vertex Sutherland-Hodgman for 1 edge: V 1 :=V 2 V 1 : V 2 V 2  result list V 2 :=next vertex no yes V 2 visible? no V 1 visible? no yes yes V 1 visible? V 1 visible? V 1 visible? V’ 1 = clip edge  V 1 V 2  result list 16 Werner Purgathofer

  18. Sutherland-Hodgman Polygon Clipping Window [clipping a polygon 3 against the left against the left 2’ 2’ boundary of a window, 1’ 2 starting with vertex 1. starting with vertex 1. Primed numbers are used to label the points used to label the points 1 1 3’ 3’ 4 4 in the output vertex list 6 for this window for this window 5’ 5 boundary] 4’ finished! 5 5 17 Werner Purgathofer

  19. Polygon Clip: Combination of 4 Passes the polygon is clipped against each of the 4 borders separately borders separately, that would produce 3 intermediate results. by calling the 4 tests recursively by calling the 4 tests recursively , (or by using a clipping pipeline) every result point is immediately processed every result point is immediately processed on, so that only one result list is produced 18 Werner Purgathofer

  20. Sutherland-Hodgman Clipping Example pipeline of Window boundary boundary 2 2 1 st clip: clippers to left left avoid avoid 2 2’ intermediate 1’ 1’ vertex lists li 2” 3 2 nd clip: 2 clip: 3’ bottom 1 [Processing the polygon vertices through a boundary-clipping pipeline. After all vertices are processed through the pipeline, the vertex list for the clipped polygon is {1’, 2, 2’, 2”} ] 19 Werner Purgathofer

  21. Sutherland-Hodgman Polygon Clipping extraneous lines for concave polygons: split into separate parts split into separate parts or or final check of output vertex list [clipping the concave polygon with the Sutherland- [ pp g p yg Hodgeman clipper produces three connected areas] 20 Werner Purgathofer

  22. Clipping of Triangles often b-reps are “triangle soups” clipping a triangle  triangle(s)  t i li i t i l l ( ) 4 possible cases: p inside (inside) o tside outside triangle quadrilateral  2 triangles 21 Werner Purgathofer

  23. Clipping of Triangles corner cases need no extra handling! 22 Werner Purgathofer

  24. From Object Space to Screen Space modeling camera transformation transformation object space world space camera space p projection j viewport transformation transformation screen space clip space 23 Werner Purgathofer

  25. Clipping in Clip-Space clipping against x = ± 1, y = ± 1, z = ± 1 ( (x,y,z) inside? ) i id ?  only compare one value! y p is done before homogenization: o oge at o x = ± h, y = ± h, z = ± h clips points that are behind the camera! reduces homogenization divisions reduces homogenization divisions 24 Werner Purgathofer

  26. Antialiasing Antialiasing

  27. Antialiasing in the Rendering Pipeline object capture/creation scene objects in object space modeling vertex stage viewing g ( vertex shader“) („vertex shader ) projection transformed vertices in clip space transformed vertices in clip space clipping + homogenization scene in normalized device coordinates viewport transformation rasterization pixel stage p g shading shading („fragment shader“) raster image in pixel coordinates 26 Werner Purgathofer

  28. Aliasing and Antialiasing what is aliasing? ['eiliæsi η ] [' ili i ] h t i li i ? what is the reason for aliasing? what can we do against it? what can we do against it? 27 Werner Purgathofer / Computergraphik 1

  29. What is Aliasing? errors that are caused by the discretization of analog data to digital data too bad resolution too bad resolution too few colors too few images / sec geometric errors g numeric errors 28 Werner Purgathofer / Computergraphik 1

  30. Aliasing: Staircase Effect 29 Werner Purgathofer / Computergraphik 1

  31. Various Aliasing Effects 30 Werner Purgathofer / Computergraphik 1

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend