Download presentation
Presentation is loading. Please wait.
1
Hidden Surface Removal
고려대학교 컴퓨터 그래픽스 연구실
2
3D Rendering Pipeline Hidden surface removal can be inserted in...
3D Primitives 3D Modeling Coordinates Model Transformation 3D World Coordinates Lighting 3D World Coordinates Viewing Transformation 3D Viewing Coordinates Projection Transformation Hidden surface removal can be inserted in... 2D Projection Coordinates Clipping 2D Projection Coordinates Viewport Transformation 2D Device Coordinates Scan Conversion 2D Device Coordinates Image
3
Table of Contents Motivation Algorithms for hidden surface removal
Back-face detection Painter’s algorithm Ray casting Scan-line Z-buffer Area subdivision
4
Motivation Surfaces may be back-facing Surfaces may be occluded
Polygon Viewer Viewer Occluding Polygon Occluded Polygon
5
Motivation Surfaces may be overlapping Surfaces may be intersecting
Viewer Viewer
6
Algorithms Back-face detection Painter’s algorithm Ray casting
Scan-line Z-buffer Area subdivision
7
Viewing Transformation
Back-face Detection Do not render any surfaces oriented away from viewer Back-facing Polygon V N 3D Primitives Viewer Model Transformation Lighting Polygon is back-facing to the viewer if V•N > 0 Viewing Transformation
8
Viewport Transformation
Painter’s Algorithm Sort surfaces In order of decreasing depth Scan convert surfaces Back to front processing A D E Viewer C Viewport Transformation View Plane B Scan Conversion Depth Sort Image
9
Painter’s Algorithm Determine zmax, zmin Sort on zmax
Start with polygon with the greatest depth (S) Compare S to all other polygons in order as below There is no depth overlap The bounding rectangles in the xy plane for the two surfaces do not overlap Surface S is completely behind the overlapping surface relative to the viewing position The overlapping surface is completely in front of S relative to the viewing position The projections of the two surfaces onto the view plane do not overlap
10
Painter’s Algorithm
11
Painter’s Algorithm If all four fails, interchange S and S’
but, can we sure ? finished? wrong! good! We need to test for each surface reordered in the list
12
Painter’s Algorithm We can fail in this case occurring infinite loop
surfaces need to be subdivided
13
Viewing Transformation
Ray Casting Cast ray from viewpoint through each pixel To find front-most surface Comments O(plogn) for p pixels Conceptually simple, but not generally used A D E 3D Primitives Model Transformation Viewer C Lighting View Plane B Viewing Transformation
14
Z-Buffer (Depth Buffer)
Store depth of closest surface for each pixel In z-buffer As scan convert Update only pixels whose (interpolated) depth is closer than the depth stored in the frame buffer z=3 Viewport Transformation Scan Conversion Image z=1 z=5 z=4 z=2 z=5 z=5
15
Z-Buffer Comments Polygons can be rasterized in any order
Requires more memory, generally twice Requires per pixel processing Commonly implemented in hardware
16
Viewport Transformation
Scan-Line For each scan line Construct intersection edge table Sort by depth z=3 z=1 z=5 Scan Line z=4 Viewport Transformation Scan Conversion Image z=2 z=5 z=5 z=1.8 z=3.8 Example: Spans z=5 z=5
17
Scan-Line Comments Fully compute only front-most pixels
Coherence along scan lines Can use incremental algorithm Commonly implemented in software
18
Area Subdivision Fill area if Otherwise, subdivide
All surfaces are outside Only one surface intersects One surface occludes other surfaces within area. Otherwise, subdivide
19
Conclusion Hidden surface algorithms Hardware-implemented
Back-face detection Depth sort Ray casting Z-buffer Scan-line Area subdivision Hardware-implemented
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.