+ All Categories

ftb-bsp

Date post: 06-Apr-2018
Category:
Upload: liviu7lek
View: 213 times
Download: 0 times
Share this document with a friend

of 7

Transcript
  • 8/3/2019 ftb-bsp

    1/7

    [ polygons in Sk, j I

    Front-to-Back Display of BSP TreesDan Gordon and Shuhong Chen

    Texas A&M University

    Combining polygonscan-conversion with adynamic screen datastructure led to afront-to-back approachfor displaying BSP trees.This technique improves

    significantly over theback-to-front method.

    W c developed a technique to display binary space partitioning (BSP)trees that is faster than the usual back-to-front display method. Our tech-nique-a front-to-back approach-provides significant speed-up n the dis-play time of polygonal scents that depend on BSP trees. especially in caseswhere the number of polygons is large.

    BSP trees arc one of t he most useful data structures for polygonal scenes.The structure of BSP trees embodies the geometrical priorities of a set ofpolygons in 3D space. Independent of any viewpoint, this structure (onceconstructed) enables fast display with hidden surface removal. It proves

    especially useful in applications with a fixed environment where we need togenerate many images from different viewpoints-in flight simulators, forexample.

    Once we have determined a viewpoint. we can display the scene by tra-versing the BSP tree in back-to-tront order and scan-converting each poly-gon. Since polygons closer to the viewpoint will be displayed later thanfurther ones, they will overwrite the further ones. producing correct hiddensurface removal.

  • 8/3/2019 ftb-bsp

    2/7

    rlgure 1. lnvuonment split by plane ofpk.

    In voxel and octree environments, researchers have had somesuccess with display algorithms that traverse the scene n front-to-back order (instead of back-to-front) .23 In principle, we canconvert any back-to-front display method to a front-t o-backone by a simple additional check: Before a pixel is set, it ischecked to verify that it had not already been set. However, thissimple modification has no advantage. Success ies in the use of

    certain data structures to represent the image during process-ing. These structures enable the algorithms to eliminate fromconsideration large chunks of pixels that have already been set.

    [ Polygons in Sk,i [ Polygons in S;,,]

    1PolygonPk1

    / \[ PolygonPjl [ Polygons in S\]

    Figure 3. BSP tree after the second split of polygons.

    80

    In our method for displaying BSP trees in front-to-backorder, we use the data structure introduced elsewhere forfront-t o-back display of voxel-based objects. This data struc-ture combines with polygon scan-conversion for efficient dis-play of polygonal scenes. In principle, any priority-basedalgorithm (for example, the depth-sort algorithm4,) that scan-converts polygons one at a time can be modified in this manner.

    Back-to-front displayA BSP tree, which is a data structure for polygonal objects,

    enables easy traversal in any order relative to an observer.Suppose the 3D environment is defined by a set of polygons P= bl,P2, . . ., p,). We choose an arbitrary polygon Pk from thisset to serve as the root of the tree. The plane defined by pkpartitions the rest of the three-space into two half-spaces, asshown in Figure 1. Let Sk and Sk denote the two half-spaces,which we can identify with the positive and negative sides of theplane. (If the plane equation is ax + by + cz +d = 0, then Sk = ((x,y,z)Iax+by+cz+d~O].)

    pk has two subtrees, called positive and negative, constructedas follows: If a polygon in P-(pk) lies entirely in Sk, then it isplaced in the positive subtree. If it lies entirely in Sk, then it is

    / \[ Polygons in Sk ) ( Polygons in S;, )

    Figure 2. BSP tree after the first split of polygons.

    placed in the negative subtree. If the partitioning plane cuts thepolygon, then the polygon is split into two, with one part placedin Sk and the other in Sk. Figure 2 illustrates this. In mostnormal scenes, most of the polygons will lie entirely in just oneof the two half-spaces.

    The process now continues recursively with each of the sub-sets of the polygons (see Figure 3). The resulting binary tree isa BSP tree. Note that after a BSP tree is formed, we can easilyadd new polygons to it. I n fact, we can construct the BSP tree onan on-line basis, with each additional polygon inserted into theexisting tree. Figure 4 shows an example of three polygons andthe resulting BSP tree.

    Once the viewing posit ion and orientation are given, we candetermine the visibility priorities of the polygons in the BSPtree. The calculation of the visibility priorities is a variant of an

    IEEE Computer Graphics & Applications

  • 8/3/2019 ftb-bsp

    3/7

  • 8/3/2019 ftb-bsp

    4/7

    Dynamic-screen- Min Max Link

    0

    1 +I 1 N2 11 I-

    Figure 7. The dynamic screen data structure.

    segment, and Link, a pointer to the next list element (seeFigure7). For testing purposes, we chose N = 1,500. nitially, each istcontained just one element representing the entire unlit scanline.

    We used the standard polygon scan-conversion method forpolygon display,5 with each polygon displayed separately.Edges were inserted into an edge able in the usual way, then alinked list of the active edges-th e active edge able (AET)-was swept through the scene n the usual manner.

    The only fundamental diff erence between the standard scan-conversion and our approach is that at each scan ine i, weperform a merge-like process between the AET and the listDS[i]. This Merge process orms the core of our efficient dis-play. It starts out by consideri ng the first object segment of theAET and he first contiguous unlit image segmentof DS[i]. TheMerge operat ion then calls Merge-segment, which determinesthe action that needs o be taken, based on the relative position

    of the t wo segments. The result of theMerge operation is an update d ist DS[i],

    Object segmentsin AET: -

    ---p65az\-yI

    Unlit imagesegments: 0-1-I I

    : :: : : :

    Unlit segmentsafter Merge: -n-cl

    : :: : :

    Screen pixels set: i

    Note: The arrows represent pointers.

    Figure 8. The result of a merge operation.

    and, of course, some screen pixels may beset. (See Figure 8.)

    The arg uments to Merge-segment ar ean object segment from the AET, start-ing with pixel I and ending with pixelJ,and an unlit image segment K in the listDS[i], with initial pixelK.Min and endpixel K. Max. Merge-segment comparesI and J against K. Min an d K. Max. De-pending on the out come of these com-parisons, there ar e eight distinct actionsto take, as shown n Figure 9. Note that inFigure 9 the image segments are unlitsegments of screenpixels.

    The out comes of these comparisons together with the properactions) fall into four different categori es:

    Object H t I t I

    Image I I H-

    After merging l-1 HH H

    Case 1 Case 2 Case 3

    I I H-

    I I I I I I

    H

    Case 4 Case 5 Case 6

    I I 1 I

    I I t I

    H t I

    Case Case 8

    A. One segment completely prece des another (cases 1 and 8in Figure 9). In these cases,no changes are made to the imagesegment, and nothing is drawn on the screen. In ca se 1 weadvance (along the AET) to the next object segment, and incase 8 to the next unlit image segment (along the list DS[i]).

    B. The object segment covers one end of the unlit imagesegment (cases 2,5, and 7). The co vered pixels are painted inand the image segment is shortened at one e nd by cha ngingK. Min or K. Max. These operations are performed by the pro-cedures Paint-segment and Change -segment. In case 2, weadvan ce o the next object segment, n case 7 to the next image

    segment, and in case 5 along both lists.C. The entire image segment is covered by the object seg-ment (cases 4 and 6). The image segment is painted in anddeleted from t he linked list by t he procedure Delete-segment.In case4 we advance along both lists, and in case6 we advance

    Figure 9. The eight cases arising from comparisons between a to the next image segment.projected object segment and an unlit image segment, and the D. The object segmen t ails strictly within t he image segmentresults of the merging operation. (case 3). In this case he co vered pixels are painted in and the

    82 IEEE Computer Graphics & Applications

  • 8/3/2019 ftb-bsp

    5/7

    Procedure split-segment (I, J, K)(* K.Min < I< J c K.Max- case 3 in Figure 9 *)(* split segment K into two segments *)

    beginK. Max = l-l;new(K);K.Min = J+l;K.Max = K.Max;K.Link = K.Link;K. Link = K;

    end

    Figure 10. The procedure to split a segment.

    image segment splits into two segments (corresponding to theuncovered parts). The splitting operation is performed by theprocedure Split-segment, which adds a new list element andupdates the fields of the old ones. The Merge procedure ad-vances n this case o the next object segment.

    All the above procedures are quite simple, so we only de-Figure 11. A randomly generated t riangle (ABC) inside theuniverse cube.

    scribe one of them (see Figure 10).

    Experimental resultsTo get some meaningful statistical dat a on the behavior of our

    technique, we applied it to randomly generated triangles. Theuniverse is a 1, 000 x 1,000 x 1,000 cube. Users specify the totalnumber of triangles they want to gener ate and a number S(between 10 and 500) that controls the size of the triangles. Ourprogram first genera tes three random numbers (Cl, Ca, C3)inside the universe. These three numbers specify the center of asmall cube of size S x S x S. Next, three points are randomlygenerated inside the small cube, giving the coordinates of thetriangle (see Figure 11). Each coordinate is a random number,chosen uniformly between Ci - 92 and Ci + Sl2. The programwas implemented on a Sun Spare workstation.

    We performed a series of experiments, with the size parame-ter S ranging from 50 to 500 and the number of polygons rang-ing from 100 to 500. Each BSP tree created was displayed infour different ways: back-to-front, front-to-back, constantshading, and intensity interpolation shading (see Foley et a1.5).The results of these experiments are shown graphically in Fig-ures 12 o 14 or small, medium, and large values of S. Note thatthe number of polygons specified in the figures is the numberbefore t he creation of the tree. Since many polygons split uponcreation of the BSP tree, the final number of polygons is muchhigher (almost 10,000 polygons are created from the original500 for S = 500).

    Figure 12 shows no significant difference between the two

    10

    9

    8 i

    D,

    /

    ,#

    ,

    ol,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,I,,, ,,,I, ,,,,,,,I/

    50 la3 150 ml 250 3M) 350 400 4&l 500 550Number of polygons

    @---a Bock-to-front constant shading

    0 l Front-to-back constant shodlng

    Q - - - fl Back-to-front interpolation shading

    wa Front-to-back interpolation shading

    methods for small polygons. While back- to-front is slightly bet- Figure 12. Experimental results for polygons of size 50.

    September 1991 83

  • 8/3/2019 ftb-bsp

    6/7

    ,

    60 :/,

    ,

    ,,

    (-3 0 Back-to-front constant shading. polygon size 300.

    b+ Front-to-bock constant shading, polygon size 3CQ

    [ j i j Back-to-front constant shading: polygon size XXI

    M Front-to-bock constant shading, polygon size 500.

    Figure 13. Experimental results for medium and large polygonsusing constant shading.

    ,w,,-1,,Y__--__--

    ,,:,*,

    0 C; Bock-to-front interpolotlon shading: Polygon size 300

    l l Front-to-back interpolation shading: Polygon size 300.fi a Back-to-front interpolation shoding: polygon size 500.

    1 Front-to-bock interpolation shoding: polygon Size X0

    Figure 14. Experimental results for medium and large polygonsusing interpolation shading.

    84

    ter with constant shading, the additional computations re-quired for interpolation shading make front-to-back slightlybetter.

    In Figure 13 we begin to see some significant differencesbetween the two methods, even with constant shading, espe-cially for large polygons (size parameter S = 500). The differ-ence between the two methods is much more pronounced inFigure 14 (intensity interpolation shading), where the time for

    front-to-back is about 14 percent of the time for back-to-frontfor 500 large polygons.As mentioned, the actual number of polygons in the BSP tree

    can be much higher than the original number. To control thisnumber, we also present data for parallel polygons, which donot split when a BSP tree is created. This is shown in Figures 15and 16 for constant and interpolation shading. We see rom thisdata that when the number of polygons exceeds 10,000, ront-to-back with constant shading takes approximately 30 percentof the time of back-to-front. This percentage shrinks to lessthan 8 percent for interpolation shading.

    The data for parallel polygons and interpolation shading(Figure 13) shows that the times for front-to-back are almost

    constant when compared to the times for back-to-front. Thiscan be explained by the mode of operation of the front-to-backapproach: Once (most of) the picture has been painted in, thetime requir ed to eliminate distant polygons is very small. Thisresults from the efficient elimination of hidden object segmentsas implemented by the merging operation between a dynamicscreen list and the AET. On the other hand, back-to-front labo-riously spends equal time on all polygons, even if they areoverwritten at a later stage.

    ConclusionsOur experimental data confirm that our technique can pro-

    vide a significant speed-up in the display time of BSP trees,especially in scenes with a large number of polygons. Also, wehave seen that when the shading becomes more time-consum-ing, our method again has an advantage because no time iswasted in shading pixels that eventually get overwritten. Weexpect that with more sophisticated shading-such as normalinterpolation (see Foley et al.5)-the front-to-back method willbe even more advantageous.

    However, our method involves some overhead unjustifiedfor simple images. The precise point at which our method be-gins to justify itself will vary with the system used, the quality ofthe image desired, and the complexity of the scene.

    Although we have implemented our technique on BSP trees,the core of our method is the Merge operation between theactive edge table of polygon scan-conversion and the list ofunlit image segments in a scan line. Nothing in this Mergenecessarily ties it to BSP trees, so we could use our method withany other list-priority algorithm,5 such as depth-sort.4

    Our technique also has a potential for parallel implementa-tion on specialized graphics processors such as the Silicon

    IEEE Computer Graphics & Applications

  • 8/3/2019 ftb-bsp

    7/7

    140

    120 c,

    _I,%

    100 *;I,,s ,;>: 80

    ,m ,I5s ,,i

    ; 60 ,I; ,

    ,40 .:

    , ~a,,s * ~~~

    ~

    20 ,>,*:l

    & *---a -*--*

    0 ok--- , ~-T- -.~ I5,000 10,000 15looo 20,000 25;ooo

    Number of polygons

    i~~~~~~ Back-to-front constant shading

    t @ Front-to-back constant shading

    Figure 15. Experimental results for parallel polygons using con-stant shading.

    Graphics GTX workstations.This potential arisesbecause hemerging operation of one scan ine can be done independentlyof others, hence different processors an perform it on differentscan lines. For example, in the scan-conversion subsystem ofthe Iris GTX. five different span processors work on fivedifferent (interlaced) setsof scan ines. In principle, the numberof processorscan equal the number of scan ines. 3

    AcknowledgmentsThe authors would like to thank Nat han J. PIluger for a preliminary

    version of a (back-to-front) BSP program. Under D an Gordons super-vision, Shuhong Chen implemented the computer program for thisresearch a s a project for his Master of Computer Science degree atTexas A&M University.

    References1. H. Fuchs. Z.M. Kcdem. and B. F. Naylor, On Visible Surface Genera-

    tion by A Priori Tree Structures. Corn[>lc/er Gra@ics (Proc. S&mph).July 19X0, pp. 124- 133.

    2. D. Meagher. Efficient Synthetic Image Generation of Arbitrary 3DObjects, Proc. /EEE Cornp~t~- Sociury Conj: Pattwz Recogr~rr rm rrrullmrrge trocr.w~~~, June lYX2, pp. 473.478.

    3. R.A. Reynolds. D. Gordon. and L.-S. Chen. A Dynamic Screen Technique for Shaded Graphics Displ ay of Slice-Repr esented Objects..Convoluter ti.sion. Grarhrcs. rrmf fmzee fr ocessiny. Vol. 38. No. 3. June1087: pp. 275-20X.

    ~/

    4. M.E. Newell. R.G. Newell, and T.L. Sancha. A Solution to the HiddenSurface Problem. Proc,. ACM Not/ Conf. Aug. lY72. pp. 443-450.

    5. J.D. Foley et al.. Coilrprcter Gruphics: Principles and Pracricr. 2nd ed..Addison-Wesley, Reading, Mass., 1990.

    200 I5A

    100 ;1s t m--1-~ 1 -m-~ -~- . .

    0 r -7- I 1 rm7m-7 ,

    0 5,000 10,000 15.000 20,000 25,000Number of polygons

    4Lo,

    Back-to-front interpolation shading

    n H Fron t-to-back interpolation shading

    6. Iris G TX: A Tk ,krical Report (rev. 2) and Iris G7Gtyhic.t Archirccrwr(tech. rept.). Sil icen Graphics. Mountain View, Calif.

    Dan Gordon is a senior lecturer of computerscience at the University of Haifa. Israel. Hisresearch interests include computer graphics,data structures and algorithms. and VLSI theory.He has previously taught at Texas A&M Univer-sity and at several other universities.

    Gordon received BS and MS degrees in mathe-matics from the Hebrew University of Jerusalemand a DSc degree in mathematics from the Tcch-nion-Israel Institute of Technology.

    Shuhong Chen is a development engineer withDowell Schl umberger in Tulsa, Oklahoma. Hisresearch intcrcsts incl ude computer modeling of

    complex dynamic systems and scientific visualiLa-tion.Chen recei ved a BS in physics from Zhongshan

    University. China in 1982. an MS in physics fromthe Iiniversity of Nebraska. Lincoln. in 198X, andan MS in computer science from Texas A&MUniversitv in 1990. Hc is a member of IJpsilon Pi

    Epsilon. the computing science honor society

    Figure 16. Experimental results for parallel polygons using in-terpolation shading.

    Readers may contact Gor don at Dept. of Mathematics and ComputerScience, University of Haifa, Hai fa 3190.5. Israel.

    September IYYI 85


Recommended