introduction
play

Introduction OR Need is to eliminate ambiguity Introduction Wire - PowerPoint PPT Presentation

Introduction OR Need is to eliminate ambiguity Introduction Wire frame Hidden Line Elimination Hidden Surface Elimination Introduction Approaches Image Space Through pixel Object Space Through primitive Image Space Approach for (


  1. Introduction OR Need is to eliminate ambiguity

  2. Introduction Wire frame Hidden Line Elimination Hidden Surface Elimination

  3. Introduction Approaches • Image Space Through pixel • Object Space Through primitive

  4. Image Space Approach for ( each pixel in the image ) { determine the object closest to the viewer that is intercepted by the projector through the pixel; draw the pixel in the appropriate color; } Computational effort: np n : number of objects p : number of pixels

  5. Object Space Approach for ( each object in the world ) { determine those parts of the object whose view is unobstructed by other parts of it or any other object; draw those parts in the appropriate color; } Computational effort: n 2 n: number of objects

  6. Floating Horizon Algorithm Surface Function F(x,y,z)=0 y x x z 3 z 5 z 2 z 4 z 1 = constant z 3 z 2 z 1 = constant z z

  7. Floating Horizon Algorithm With z=constant plane closest to the viewpoint, the curve in each plane is generated (for each x coordinate in image space the appropriate y value is found). Projection on z=0 plane y Algorithm: If at any given value of x the y value of the curve in the current plane is z 5 z 4 larger than the y value for any z 3 z 2 previous curve at that x value, z 1 then the curve is visible, otherwise it is hidden. x

  8. Floating Horizon Algorithm Algorithm: If at any given value of x the y value y of the curve in the current plane is larger than the y value or smaller z 5 than the minimum y value for any z 4 z 3 previous curve at that x value, z 2 z 1 then the curve is visible, otherwise it is hidden. x Projection on z=0 plane

  9. Back Face Culling Preprocessing to eliminate faces which are not visible If a surface ’ s normal is pointing away from the eye (viewer), then this is a back face P If n V 0 then backface ⋅ < p n p V

  10. Back Face Culling Conservative algorithm x z

  11. Back Face Culling Conservative algorithm x z

  12. Z-Buffer Algorithm Proposed by Catmull 1974 Simple to implement Z-buffer is like a frame buffer, contains depth (x, y) Z b (x, y) C(x, y) (x, y)

  13. Z-Buffer Algorithm Initialize all d[i,j]=1.0 (max depth), c[i,j]=background color. for (each polygon) for (each pixel in polygon ’ s projection) { Find depth-z of polygon at (x,y) corresponding to pixel (i,j); If z < d[i,j] d[i,j] = z; p[i,j] = color; end }

  14. Z-Buffer Algorithm Computationally Ax By Cz D 0 + + + = At x ( Ax By D ) − + + z , C 0 = ≠ C At x Δ x + ( A ( x Δ x) By D ) − + + + z = 1 C A − z z Δ x − = 1 C A A z z Δ x z ( ∵ Δ x 1) = − = − = 1 C C

  15. Z-Buffer Algorithm Example T T ∞ ∞ ∞ T T T T h he e i h he h he e i e i i m i m i m m ag m ag T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m m ag m ag T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m m ag m ag T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m m ag m ag T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m T T T T ∞ ∞ ∞ ∞ h he h he e i e i i m i m m ag m ag Z-buffer Screen

  16. Z-Buffer Algorithm Example [0,7,5] [6,7,5] T T 5 5 ∞ h h e e i i T T T T 5 5 ∞ ∞ h he h h e i e e i m i i m ag m m T T T T 5 ∞ ∞ ∞ h he h h e i e e i m i i T T T T ∞ ∞ ∞ ∞ h he h h e i e e i m i i m ag m m T T T T ∞ ∞ ∞ ∞ h he h h e i e e i m i i T T T T ∞ ∞ ∞ ∞ h he h h e i e e i m i i m ag m m T T T T ∞ ∞ ∞ ∞ h he h h e i e e i m i i T T T T ∞ ∞ ∞ ∞ h he h h e i e e i m i i m ag m m [0,1,5] Z-buffer

  17. Z-Buffer Algorithm Example [0,6,7] [0,1,2] [5,1,7]

  18. Z-Buffer Algorithm Example T T T T T T T T 5 5 5 5 5 5 5 ∞ h he h h h he h he e i e e e i e i i m i i i m i m T T T T T T T T 5 5 5 5 5 5 ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m m ag m m m ag m ag T T T T T T T T 5 5 5 5 5 ∞ ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m T T T T T T T T 5 5 5 5 ∞ ∞ ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m m ag m m m ag m ag T T T T T T T T 4 5 5 7 ∞ ∞ ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m T T T T T T T T 3 4 5 6 7 ∞ ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m m ag m m m ag m ag T T T T T T T T 2 3 4 5 6 7 ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m T T T T T T T T ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ h he h h h he h he e i e e e i e i i m i i i m i m m ag m m m ag m ag Z-buffer Screen

  19. Z-Buffer Algorithm • Simple method • Complexity Time : nxm buffer k poygons O( nmk ) Space : b depth precision O( nmb )

  20. Painter ’ s Algorithm Depth Sort, List Priority Polygons are painted to the screen in the order of their distance from the viewer (More distant objects are painted first) Screen display

  21. Painter ’ s Algorithm • Sort polygons in order of increasing depth • Draw polygons in sequence, starting from the polygon (surface) of greatest depth • Careful processing of depth • Efficiency depends on sorting algorithm

  22. Painter ’ s Algorithm Z=20 Z=15 Z=10

  23. Painter ’ s Algorithm z P Q P > Q > R Draw first P then Q and then R R Q z Draw first P then Q P > Q P

  24. Painter ’ s Algorithm Cyclic overlapping May require splitting P Q

  25. Binary Space Partitioning (BSP) Space partitioning using planes BSP Tree

  26. Binary Space Partitioning (BSP) For hidden surface elimination: sets a display order P P B B F F BSP Tree

  27. Binary Space Partitioning (BSP) For hidden surface elimination: sets a display order P P B Eye B F F Display order (back to front): BPF BSP Tree

  28. Binary Space Partitioning Example 3 5 front back 5a 2 5b 3 1 4 2 5b 1 4 5a

  29. Binary Space Partitioning Example 3 5 front back 5a 2 5b 3 2 4 5b 1 4 1 5a

  30. Binary Space Partitioning Example 3 5 front back 5a 2 5b 4 3 2 1 4 5b 1 5a

  31. Binary Space Partitioning Example 3 5 front back 5a 2 5b 4 3 2 1 4 5b 1 5a V Display order: 5a 2 1 3 5b 4

  32. Binary Space Partitioning Example 5 back 5 4 2 3 3 1 4 front 1 2

  33. Binary Space Partitioning Example 5 back 5 4 2 3 3 1 4 front 1 V Display order: 5 2 1 3 4 2

  34. Binary Space Partitioning Issues How to select the root polygon? Criteria: Number of split (fragmentation) a. Arbitrary b. Heuristic based with 4-5 polygons and consider which gives the leastnumber of split Static vs Dynamic scene

  35. Area Subdivision Quad tree

  36. Area Subdivision Algorithm Warnock ’ s Algorithm Polygon Area of interest Intersecting Surrounding Contained Disjoint

  37. Area Subdivision Algorithm Consider an area of the projected image If it is easy to decide which polygons are visible in the area, display Else the area is subdivided into smaller areas and the decision is made recursively Divide and Conquer

  38. Area Subdivision Algorithm No Subdivision is required if 1. All the polygons are disjoint: background color in the area. 2. Only one intersecting or only one contained polygon: The area is filled first by background color, then the polygon part contained in the area. 3. Only one surrounding polygon (no contained and intersecting polygons): The area is filled with the color of the surrounding polygon. 4. More than one polygon is intersecting, contained in, or surrounding the area, with surrounding polygon in front: Fill the area with the color of the surrounding polygon.

  39. Warnock ’ s Algorithm Area

  40. Warnock ’ s Algorithm

  41. Warnock ’ s Algorithm

  42. Warnock ’ s Algorithm

  43. Warnock ’ s Algorithm Maximum subdivision: pixel!

  44. Weiler Atherton Algorithm Subdivision along polygon boundaries Clipping!

  45. Weiler Atherton Algorithm • Initial z-sort • Consider front most polygon, clip all polygons to generate Fragments inside polygon and outside polygon • All inside polygons if behind delete from the list • If there is an inside polygon in front (offending), clip the inside list of polygons against this polygon • Process the outside polygon(s)

  46. Weiler Atherton Algorithm B in A B out A A A as clip polygon Inside list: A, B in A Outside list: B out A Display A Process B out A

  47. Weiler Atherton Algorithm y y A B A x B x z z

  48. Weiler Atherton Algorithm A as clip polygon Inside list: A, B in A B out A Outside list: B out A B in A B in A as clip polygon Inside list: B in A, A in B Outside list: B out A, A out B Display B in A

  49. Weiler Atherton Algorithm More polygons with more fragments

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