Page 119 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 119

Unit 7: Implementation of Hidden Surface in 2D



            BSP Tree Display                                                                      Notes
                     showBSP( v: Viewer, T: BSPtree )
                     {
                     if T is empty then return
                     P := root of T
                     if viewer is in front of P
                     {
                     showBSP( back subtree of T )
                     draw P
                     showBSP( front subtree of T )
                     } else {
                     showBSP( front subtree of T )
                     draw P
                     showBSP( back subtree of T )
                     }
                     }

            BSP Tree Analysis
            Categorization:
               •  Easy to implement
               •  Hardware implementation

               •  Incremental drawing calculations (uses coherence)
               •  Pre-processing required
               •  On-line (does not need all objects before drawing begins)

               •  Memory intensive
               •  Handles transparency
               •  Handles refraction

               •  Polygon-based
               •  Extra work for moving objects
               •  Extra work for moving viewer

               •  Efficient shading
               •  Handles cycles and self-intersections
                          Binary Space Partition Trees (or BSP trees for short) where introduced by
                          Fuchs, Kedem, and Naylor around 1980.
            7.2.4 Ray Tracing

            Ray tracing is, in many ways, a standardized technique. Almost all ray tracing programs
            (known as “ray tracers”) use the same basic algorithm in one way or the other. This algorithm
            is presented below.






                                             LOVELY PROFESSIONAL UNIVERSITY                                   113
   114   115   116   117   118   119   120   121   122   123   124