1 / 16

Hidden Surface Removal

Hidden Surface Removal. Why make the effort? Realistic models. Wasted time drawing. OpenGL and HSR OpenGL does handle HSR using the depth buffer. Why find other methods? Time and space. Efficiency in specific cases. So what is hidden line removal?. Object versus Image.

javan
Télécharger la présentation

Hidden Surface Removal

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. Hidden Surface Removal Why make the effort? Realistic models. Wasted time drawing. OpenGL and HSR OpenGL does handle HSR using the depth buffer. Why find other methods? Time and space. Efficiency in specific cases. So what is hidden line removal?

  2. Object versus Image Object Precision • Uses machine precision to compute the coordinates of the visible faces. • Allows for enlargement with accurate results. Image Precision • Per Pixel approach. • Precision is only to the screen coordinate system.

  3. Suggested Code class Face { int Verts; Point* pt; float* depth; Plane plane; Cuboid extent; }

  4. Hidden Line Removal HLR as HSR • Device must allow “Painting over”. Essential considerations • Only need to clip lines against “front” faces. • If the edge belongs to two back faces it is not visible. The rest of HLR is the same as HSR • Except one clips an edge instead of a face.

  5. Finally! Techniques!

  6. Depth-Buffer Pros: • No Sorting • Makes use of depth coherence • Works with many classes of objects • File saving for another session Cons: • Re-draw pixels having to re-do expensive shading calculations • Large memory usage (Precision dependant)

  7. Area Subdivision Method makes use of Area coherence. How does it work? • Divide and conquer. • Terminates on “simple” or too small regions. • Geometry of division is important. Some definitions of “Simple” • Only one face is involved • Empty • Dominating face Vertex Division Geometry • Select a vertex in the region and divide along it.

  8. More HSR Algorithms Algorithms Already Covered Depth-Buffer Area Sub-Division Algorithms To Follow A Scan Line Algorithm = good for static scenes (per pixel tests) 3 List-Priority Algorithms: 1. Heedless Painter = simple but wrong 2. Depth-Sort = improvement on painter 3. BSP Trees = elegant (dynamic)

  9. Scan-Line Algorithm 1 Brute Force Algorithm Overview: 1. depth on a per pixel basis. 2. convention – a horizontal scan lines, scanned top to bottom. Brute Force Algorithm Pseudocode:

  10. Scan-Line Algorithm 2 A Faster Algorithm Overview 1. Same as brute force (scan left to right & per pixel basis) 2. But it exploits edge-coherence along the scan-line. 3. An Active-Edge List (AEL) Is constructed AEL stores all the x values at which a given scan-line intersects an edge.

  11. Faster Scan-Line Algorithm Pseudocode:

  12. Heedless Painter Heedless Painter Algorithm Overview 1. Simple but Incorrect. 2. Sorts the array of faces by the depth of its bounding box. 3. Draws from the greatest depth to the closest depth Heedless Painter Algorithm Pseudocode:

  13. Problems with the Heedless Painter Algorithm 1. Cant deal with polygon intersections. 2. In general it cant deal with case where the z extent of the bounding boxes intersect. The algorithm draws Polygon 1 first then Polygon 2.

  14. Depth-Sort Algorithm Depth-Sort Algorithm Overview: 1. Similar to Heedless painter but it works. 2. Sorts the array of faces by the depth of its bounding box. 3. Deals with problematic faces, and re-sorts the faces. 4. Draws from the greatest depth to the closest depth It splits the faces until for any pair of faces, one lies either behind or in front of the other (removes intersections).

  15. Depth-Sort Algorithm Pseudocode:

  16. BSP Tree Algorithm BSP Tree Algorithm Overview: 1. BSP Tree (Binary-Space Partition Tree) 2. Elegant and efficient, especially in dynamic situations. 3. The faces are preprocessed into a binary-tree (each node has 2 children) 4. Some faces are split, and placed in the tree 5. Each node contains a single face 6. The tree is traversed in a particular order, such that HSR is accomplished.

More Related