Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실
3D Rendering Pipeline Model Transformation Lighting Viewing Transformation Projection Transformation Clipping Viewport Transformation Scan Conversion 3D Primitives Image 3D Modeling Coordinates 3D World Coordinates 3D World Coordinates 3D Viewing Coordinates 2D Projection Coordinates 2D Projection Coordinates 2D Device Coordinates 2D Device Coordinates Hidden Surface Removal
Hidden Surface Removal Motivation Algorithms for HSR Back-face detection Painter’s algorithm Ray casting Scan-line Z-buffer Area subdivision Tradeoffs
Motivation Surfaces may be Back-Facing: Surfaces may be Occluding: Viewer Back-Facing Polygon Viewer Occluding Polygon Occluded Polygon
Motivation Surfaces may be Overlapping: Surfaces may be Intersecting: Viewer Viewer
Algorithms Back-Face Detection Painter’s Algorithm Ray Casting Scan-Line Z-Buffer Area Subdivision
Back-Face Detection   Do not Render any Surface Oriented Away from Viewer Viewer Back-Facing Polygon N V Polygon is back-facing to the viewer if   V • N   > 0 Model Transformation Lighting Viewing Transformation 3D Primitives
Depth Sort Painter’s Algorithm: Sort surfaces in order of decreasing maximum depth Scan convert surfaces in order starting with ones of greatest depth, reordering as necessary based on overlaps Viewer View Plane Depth Sort A B C D E Viewport Transformation Scan Conversion Image
Depth Sort Comments O( n log n ) Intersecting polygons must be subdivided Sort order has lots of frame-to-frame coherence during walkthroughs Must fully compute every pixel for every polygon Used most often with BSP or static list-ordering
Ray Casting Algorithm: Cast ray from viewpoint through each pixel to find front-most surface Viewer View Plane A B C D E Model Transformation Lighting Viewing Transformation 3D Primitives
Ray Casting Comments O( p log n ) for  p  pixels May (or may not) utilize pixel-to-pixel coherence Conceptually simple, but not generally used
Z-Buffer Algorithm: Store color and depth of closest surface for each pixel in frame buffer As scan convert, update only pixels whose (interpolated) depth is closer than the depth stored in the frame buffer z=3 z=1 z=2 z=4 z=5 z=5 z=5 Viewport Transformation Scan Conversion Image
Z-Buffer Comments Polygons can be rasterized in any order Requires lots of memory Requires per pixel processing, subject to aliasing (A-buffer) Commonly implemented in hardware
Scan-Line Algorithm: For each scan line, construct spans and sort by depth z=3 z=1 z=2 z=4 z=5 z=5 z=5 Scan Line Example: Spans z=1.8 z=3.8 z=5 z=5 Viewport Transformation Scan Conversion Image
Scan-Line Comments Fully compute only front-most pixels Coherence along scan lines Commonly implemented in software
Area Subdivision Algorithm: Fill area if: All surfaces are outside Only one surface intersects One surface occludes other surfaces within area. Otherwise, subdivide
Conclusion Hidden surface algorithms Back-face detection Depth sort Ray casting Z-buffer Scan-line Area subdivision Hardware Z-buffer Software Depth sort Scan-line

Hidden Surfaces

  • 1.
    Hidden Surface Removal고려대학교 컴퓨터 그래픽스 연구실
  • 2.
    3D Rendering PipelineModel Transformation Lighting Viewing Transformation Projection Transformation Clipping Viewport Transformation Scan Conversion 3D Primitives Image 3D Modeling Coordinates 3D World Coordinates 3D World Coordinates 3D Viewing Coordinates 2D Projection Coordinates 2D Projection Coordinates 2D Device Coordinates 2D Device Coordinates Hidden Surface Removal
  • 3.
    Hidden Surface RemovalMotivation Algorithms for HSR Back-face detection Painter’s algorithm Ray casting Scan-line Z-buffer Area subdivision Tradeoffs
  • 4.
    Motivation Surfaces maybe Back-Facing: Surfaces may be Occluding: Viewer Back-Facing Polygon Viewer Occluding Polygon Occluded Polygon
  • 5.
    Motivation Surfaces maybe Overlapping: Surfaces may be Intersecting: Viewer Viewer
  • 6.
    Algorithms Back-Face DetectionPainter’s Algorithm Ray Casting Scan-Line Z-Buffer Area Subdivision
  • 7.
    Back-Face Detection Do not Render any Surface Oriented Away from Viewer Viewer Back-Facing Polygon N V Polygon is back-facing to the viewer if V • N > 0 Model Transformation Lighting Viewing Transformation 3D Primitives
  • 8.
    Depth Sort Painter’sAlgorithm: Sort surfaces in order of decreasing maximum depth Scan convert surfaces in order starting with ones of greatest depth, reordering as necessary based on overlaps Viewer View Plane Depth Sort A B C D E Viewport Transformation Scan Conversion Image
  • 9.
    Depth Sort CommentsO( n log n ) Intersecting polygons must be subdivided Sort order has lots of frame-to-frame coherence during walkthroughs Must fully compute every pixel for every polygon Used most often with BSP or static list-ordering
  • 10.
    Ray Casting Algorithm:Cast ray from viewpoint through each pixel to find front-most surface Viewer View Plane A B C D E Model Transformation Lighting Viewing Transformation 3D Primitives
  • 11.
    Ray Casting CommentsO( p log n ) for p pixels May (or may not) utilize pixel-to-pixel coherence Conceptually simple, but not generally used
  • 12.
    Z-Buffer Algorithm: Storecolor and depth of closest surface for each pixel in frame buffer As scan convert, update only pixels whose (interpolated) depth is closer than the depth stored in the frame buffer z=3 z=1 z=2 z=4 z=5 z=5 z=5 Viewport Transformation Scan Conversion Image
  • 13.
    Z-Buffer Comments Polygonscan be rasterized in any order Requires lots of memory Requires per pixel processing, subject to aliasing (A-buffer) Commonly implemented in hardware
  • 14.
    Scan-Line Algorithm: Foreach scan line, construct spans and sort by depth z=3 z=1 z=2 z=4 z=5 z=5 z=5 Scan Line Example: Spans z=1.8 z=3.8 z=5 z=5 Viewport Transformation Scan Conversion Image
  • 15.
    Scan-Line Comments Fullycompute only front-most pixels Coherence along scan lines Commonly implemented in software
  • 16.
    Area Subdivision Algorithm:Fill area if: All surfaces are outside Only one surface intersects One surface occludes other surfaces within area. Otherwise, subdivide
  • 17.
    Conclusion Hidden surfacealgorithms Back-face detection Depth sort Ray casting Z-buffer Scan-line Area subdivision Hardware Z-buffer Software Depth sort Scan-line