15
United States Patent [19] Smith et al. US005835095A 5,835,095 Nov. 10, 1998 [11] Patent Number: [45] Date of Patent: [54] VISIBLE LINE PROCESSOR [75] Inventors: Karin P. Smith; George R. Smith, Jr., both of Madison, Ala. [73] Assignee: Intergraph Corporation, Huntsville, Ala. [21] Appl. No.: 438,048 [22] Filed: May 8, 1995 [51] Int. Cl.6 ................................................... .. G06T 15/40 [52] US. Cl. ............................................................ .. 345/421 [58] Field of Search ................................... .. 395/121, 119, 395/122; 345/421, 425 [56] References Cited U.S. PATENT DOCUMENTS 3,602,702 8/1971 Warnock ............................... .. 345/421 3,621,214 11/1971 Romney et al. 345/421 3,736,564 5/1973 Watkins ...... .. 345/421 4,594,673 6/1986 Holly . 345/421 4,609,917 9/1986 Shen .... .. 345/421 4,697,178 9/1987 Heckel .... .. 345/422 5,086,496 2/1992 Mulmuley 345/421 5,113,451 5/1992 Chapman et al. .................... .. 382/145 5,369,734 11/1994 Suzuki et al. ......................... .. 345/421 5,379,371 1/1995 Usami et al. . 345/428 5,557,691 9/1996 Izuta .................................. .. 345/428 X OTHER PUBLICATIONS Hassen et al., Thresholding Based on Learning Theory, IEEE, vol. 76, No. 10, 1379—1379—81, Oct. 1988. Peters, “A Fast Algorithm for Plotting and Contour Filling Radiation Patterns in Three Dimensions,” Antennas and Propagation, 1992 IEEE Int’l Symposium. Tang et al., “An Ef?cient Hidden—Line Removal Method Based on Z—Buffer Algorithm,” Image Processing, 1994 IEEE Int’l Conference, vol. 1. Foley et al., Computer Graphics: Principles and Practice, 1990, pp. 672—697. Gordon et al., Fast Polygon Scan Conversion With Medical Applications, IEEE Computer Graphics & Applications, v.14,n.6,pp.20—27, Nov. 1994. Millar et al., A Hilbert Polygon Directed Raster Scan Dis play, Image Processing and Its Applications, pp. 357—360, 1992. James D. Foley, Andries van Dam, Steven K. Feiner, John F. Hughes, “Computer Graphics Principles and Practice,”Sec ond Edition Addison—Wesley Publishing Company, Inc., (Nov., 1992), pp. 649—686. Primary Examiner—Anton Fetting Attorney, Agent, or Firm—Philip H. Albert; Townsend and Townsend and CreW LLP [57] ABSTRACT Objects are represented in a coordinate space Which is tWice scanned by scan lines, once in one direction and then once in another direction. At each scan line, a list of line segments is generated, Where each line segment represents the inter section of the projection of a polygon and the scan line. The segments are then examined to determine Which are visible segments, using the Z values of the end points of the segments. The visible segments of a scan line are compared to the visible segments of a previous scan line or an accumulation of visible lines, and if the end points of a visible segment taken from a polygon differ by less than a threshold amount, the lines formed betWeen end points in one scan line and the adjacent scan line are considered to be visible lines. Where the tWo scans are a horizontal scan and a vertical scan, the threshold amount for vertical scans is the distance betWeen horizontal scans and the threshold amount for horizontal scans is the distance betWeen vertical scans. 11 Claims, 7 Drawing Sheets Hn

United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

Embed Size (px)

Citation preview

Page 1: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

United States Patent [19] Smith et al.

US005835095A

5,835,095 Nov. 10, 1998

[11] Patent Number:

[45] Date of Patent:

[54] VISIBLE LINE PROCESSOR

[75] Inventors: Karin P. Smith; George R. Smith, Jr., both of Madison, Ala.

[73] Assignee: Intergraph Corporation, Huntsville, Ala.

[21] Appl. No.: 438,048

[22] Filed: May 8, 1995

[51] Int. Cl.6 ................................................... .. G06T 15/40

[52] US. Cl. ............................................................ .. 345/421

[58] Field of Search ................................... .. 395/121, 119,

395/122; 345/421, 425

[56] References Cited

U.S. PATENT DOCUMENTS

3,602,702 8/1971 Warnock ............................... .. 345/421

3,621,214 11/1971 Romney et al. 345/421 3,736,564 5/1973 Watkins ...... .. 345/421

4,594,673 6/1986 Holly . 345/421 4,609,917 9/1986 Shen .... .. 345/421

4,697,178 9/1987 Heckel .... .. 345/422

5,086,496 2/1992 Mulmuley 345/421 5,113,451 5/1992 Chapman et al. .................... .. 382/145 5,369,734 11/1994 Suzuki et al. ......................... .. 345/421

5,379,371 1/1995 Usami et al. . 345/428 5,557,691 9/1996 Izuta .................................. .. 345/428 X

OTHER PUBLICATIONS

Hassen et al., Thresholding Based on Learning Theory, IEEE, vol. 76, No. 10, 1379—1379—81, Oct. 1988. Peters, “A Fast Algorithm for Plotting and Contour Filling Radiation Patterns in Three Dimensions,” Antennas and Propagation, 1992 IEEE Int’l Symposium. Tang et al., “An Ef?cient Hidden—Line Removal Method Based on Z—Buffer Algorithm,” Image Processing, 1994 IEEE Int’l Conference, vol. 1.

Foley et al., Computer Graphics: Principles and Practice, 1990, pp. 672—697.

Gordon et al., Fast Polygon Scan Conversion With Medical Applications, IEEE Computer Graphics & Applications, v.14,n.6,pp.20—27, Nov. 1994.

Millar et al., A Hilbert Polygon Directed Raster Scan Dis play, Image Processing and Its Applications, pp. 357—360, 1992.

James D. Foley, Andries van Dam, Steven K. Feiner, John F. Hughes, “Computer Graphics Principles and Practice,”Sec ond Edition Addison—Wesley Publishing Company, Inc., (Nov., 1992), pp. 649—686.

Primary Examiner—Anton Fetting Attorney, Agent, or Firm—Philip H. Albert; Townsend and Townsend and CreW LLP

[57] ABSTRACT

Objects are represented in a coordinate space Which is tWice scanned by scan lines, once in one direction and then once in another direction. At each scan line, a list of line segments is generated, Where each line segment represents the inter section of the projection of a polygon and the scan line. The segments are then examined to determine Which are visible segments, using the Z values of the end points of the segments. The visible segments of a scan line are compared to the visible segments of a previous scan line or an accumulation of visible lines, and if the end points of a visible segment taken from a polygon differ by less than a threshold amount, the lines formed betWeen end points in one scan line and the adjacent scan line are considered to be visible lines. Where the tWo scans are a horizontal scan and

a vertical scan, the threshold amount for vertical scans is the distance betWeen horizontal scans and the threshold amount for horizontal scans is the distance betWeen vertical scans.

11 Claims, 7 Drawing Sheets

Hn

Page 2: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

U.S. Patent Nov. 10,1998 Sheet 1 of7 5,835,095

Page 3: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

U.S. Patent Nov. 10,1998 Sheet 2 of7 5,835,095

FIG. 1E

Page 4: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 U.S. Patent Nov. 10,1998 Sheet 3 of7

10o /

‘I 12 14 1s \\ ‘\ / -

OBJECT I POLYGON TRIANGLE |_|ST APPROXIMATOR STRHDS

18 2O 22

\I I / /

CANDIDATE ACTIvE TRIANGLE CANDIDATE TRIANGLE ExTRACTOR TRIANGLES SELECTOR

A A I I i

28 SCAN LINE \ COUNTER

ACTIVE TRIANGLES

10\ VISIBLE LINE PROCEssOR

FIG. 2

Page 5: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

U.S. Patent Nov. 10, 1998

ACTIVE TRIANGLES

TRIANGLE 4

Sheet 4 0f 7

TRIANGLE I

,SPECIFICATIONS;

5,835,095

RANGER

V

42 SCAN LINE SEGMENTER

SEGMENT LIST

VISIBLE SEGMENT GENERATOR [STREE()]

VISIBLE SEGMENT

LIST

46 DELTA PROCESSOR

VISIBLE LINE LIST

(PARTIAL)

INTERSECTING i TFIlANGLES

28

/ SCAN LINE COUNTER

I

INCREMENT, CHANGE SCAN AXIS

CONTROLLER

______________ ______________________

TO VISIBLE LINES TABLE 26

FIG. 3

Page 6: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

U.S. Patent Nov. 10,1998 Sheet 5 of7

I START I

7

5,835,095

APPROXIMATE ALL OBJECTS AS TRIANGLES /S1

I

GENERATE LIST OF TRIANGLE STRIPS, ORDERED BY MINIMUM SCAN LINE EXTENT

Y

INIT SCAN LINE COUNTER (C)

V

MOVE/CONVERT EACH TRIANGLE STRIP WITH A MINIMUM EXTENT OF THE CURRENT SCAN

LINE AND PLACE LIST 2O (CANDIDATE TRIANGLES)

V

MOVE EACH TRIANGLE ON LIST 20 WITH V1 3 Cpos TO LIST 24 (ACTIVE TRIANGLES)

7

DELETE EACH TRIANGLE ON LIST 24 WITH v3 < CpQS

FIG. 4A

Page 7: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

U.S. Patent Nov. 10,1998 Sheet 6 of7 5,835,095

Q) I I

INTERSECT EACH TRIANGLE ON // 87 LIST 24 WITH SCAN LINE C

I /-S8 OPTIMIZE ORDER OF SEGMENTS

I

GENERATE VISIBLE SEGMENT LIST fsg FROM LIST OF SEGMENTS

I V

AccBETE END POINTS OF VISIBLE SEGMENTS / 510 TO EXISTING vISIBLE LINE STuBS

THIN POINTS ACCRETED TO / S11 VISIBLE LINE STUBS

I S12 INCREMENT SCAN LINE COUNTER /

S13

S15

/ RESET SCAN LINE

COUNTER FOR NEXT SCAN AXIS

OUTPUT VISIBLE / S16 STUBS AT vLT 26

END

FIG. 4B

Page 8: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

U.S. Patent Nov. 10,1998 Sheet 7 of7 5,835,095

Ah

// I V2

/ /\/2 v3 Hn+2 S U

FIG. 5

Page 9: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 1

VISIBLE LINE PROCESSOR

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains material Which is subject to copyright protection. The copyright oWner has no objection to the xerographic reproduction by anyone of the patent document or the patent disclosure in exactly the form it appears in the Patent and Trademark Office patent ?le or records, but otherWise reserves all copyright rights Whatsoever.

APPENDIX

This application incorporates an appendix Which is a source code listing for several programs, Which, When compiled and executed by a digital computer, create an embodiment of the present invention in the digital computer. The source code is Written in the C++ language.

BACKGROUND OF THE INVENTION

The present invention relates to the ?eld of computer graphics. More speci?cally, the present invention is directed to the problem of determining Which lines in an image are visible and Which are hidden. The invention can be used by itself or as a precursor step in an image rasteriZation process, Wherein an image (a collection of objects de?ned With reference to a vieWing surface) is reduced to an array of pixels each characteriZed by a pixel color.

The process of visible line determination is also some times referred to as hidden line removal or hidden line determination. Regardless of the name, the task is the same: determine Which lines or segments of a line are hidden, i.e., obscured by other objects in an image. This process must be done quickly, especially Where an image is part of a sequence of images or the image is complex. One of the uses of visible line determination is the generation of images Which more clearly shoW objects by just their outlines.

FIG. 1 illustrates an example of visible line determination, shoWing several images representing the same tWo objects: a cylinder 2 and a surface 4, Which is a portion of a plane. The placement of these objects is such that surface 4 cuts through cylinder 2, and from the designated vieW point, the image is such that cylinder 2 is visible above and beloW surface 4.

FIG. 1(a) is a Wire frame image of the objects, in Which all edges of the objects are visible. AWire frame image does not shoW Which surfaces are in front of other surfaces. For example, point A is a point on the top circular surface of cylinder 2 and that surface could either be the outside/top side of the surface or the inside/bottom side of the surface. In this example, the visible side of the surface containing point A is the top side. LikeWise, the visible surface con taining point B could be either the bottom side of surface 4 or the top side. In this example, it is the top side. Also shoWn are points C and D. Point C is a visible point on surface 4 Which obscures cylinder 2, and point D is a visible point on the front of the curved surface of cylinder 2. Although a Wire frame image is simple to generate, it has the disadvantage that a vieWer cannot tell Which objects are solid or Which objects are in front of other objects.

FIG. 1(b) is a Wire frame image of the objects after they are reduced to a collection of triangles. As should be apparent, planar surface 4 is representable, exactly, by tWo triangles, Whereas cylinder 2 cannot be represented exactly by a ?nite number of triangles. HoWever, it can be adequately approximated With only a small number of

10

15

25

35

45

55

65

2 triangles. In a computer memory, the objects are typically stored as parameters to mathematical functions, such as lines, vertices and curves. The Wire frame image of FIG. 1(b) can be stored as a set of triangles, Where each triangle is represented in memory by the coordinates in a three dimensional space of the triangle’s vertices.

FIG. 1(c) graphically shoWs a more ef?cient storage scheme for the triangles, that of triangle strips. A triangle strip is a list of three or more vertices, Where the ?rst three vertices de?ne a triangle, the next vertex combined With the second and third vertices de?ne the next triangle, and so on. The objects in FIG. 1 are shoWn in FIG. 1(c) represented by tWo triangle strips. In FIG. 1(c), the vertices are shoWn as points and one order of the vertices is shoWn by lines connecting the vertices. One triangle strip contains all the triangles for cylinder 2 and one triangle strip contains all the triangles for surface 4.

FIG. 1(a) graphically shoWs the desired result of hidden line removal. The input to a hidden line removal process is either the triangles of FIG. 1(b) or the triangle strips of FIG. 1(c). When the hidden lines are removed, the relative positions of cylinder 2 and surface 4 are more apparent. Note that, for some lines, part of the line is visible and part of the line is hidden.

FIG. 1(e) is the same as FIG. 1(a), except that lines from separate polygons from the same object are removed. In FIG. 1(e), the line separating the body of cylinder 2 from the top circular surface Would be removed as Well, since all the polygons on either side of the line belong to the same object. HoWever, since the ?gure lacks shading or lighting information, the line Was left in so as not to confuse the vieWer. Another Way to achieve the same effect is to have the body of the cylinder and the top surface of the cylinder designated as separate objects. The bottom surface might also be a separate object, but it Would make no difference from the particular vieWing point chosen. The input to a visible line processor is a set of objects.

Although the particular manner of storage of objects is not particularly relevant here, one example Will be described. In this example, the physical embodiment of a set of objects is a table in an object memory, With each entry in the table containing characteristics for the object. For example, a table entry for a sphere might contain the position of its center point, its radius, and data describing hoW the surface of the sphere is to be colored. Of course, other alternative expressions of objects might be used, such as expressing the sphere by four points on the surface of the sphere, and the coloring information is not needed unless the processor is also going to provide image coloration.

Graphically, the set of objects can be represented (as is done in FIG. 1) by a display of the objects relative to a vieWing surface and a vieWing point Where the objects, the vieW surface and the vieW point are all expressed by coordinates in a common coordinate system. In one arbitrary example, the coordinate system is the (x, y, Z) coordinate system, the vieWing point is located at (0, 0, 0), the vieWing surface is a rectangle bounded by the four points (—h/2, —W/2, 1), (—h/2, W/2, 1), (h/2, W/2, 1) and (h/2, —W/2, 1) and the objects are positioned Within the four rays de?ned by the vieWing point and the four corners of the vieWing surface. The objects, such as spheres, cubes, prisms, toroids, squares, circles, or more complex objects, Whose siZe and position are described by (x,y,Z) coordinates can then be easily “placed” into the coordinate space. To display the image, a graphics processor calculates Which objects, or parts of objects, are visible through the vieWing surface from the

Page 10: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 3

viewing point, following the rule that opaque objects obscure objects which are “behind” those opaque objects in the coordinate space.

In a visible line determination, lines are deemed visible if they are not obscured by any other object. Therefore, it is a simple matter to check each line against each object to see which is closest to the viewing point. In a typical graphic application, however, each object is represented by poly gons. Objects with curved surfaces or edges are approxi mated by many polygons, and checking each line against each of many polygons is time consuming. Because each line of each polygon needs to be compared with each other line or polygon, visible line determination has been a computational problem of order n2, i.e., the number of processing steps required to determine which of n line segments are visible is proportional to n2. This is because each of the n line segments must be compared to each of the n line segments.

SUMMARY OF THE INVENTION

An improved visible line processor is provided by virtue of the present invention.

In one embodiment of a visible line processor according to the present invention, objects are represented by polygons, preferably triangles. Each object is labelled with an object ID, and each triangle is characteriZed by an object ID, as well as coordinates of the three vertices of the triangle. The object space is twice scanned by scan lines, once in one direction and then once in another direction. At each scan line, a list of line segments is generated, where each line segment represents the intersection of the projec tion of a polygon and the scan line. The segments are then examined to determine which are visible segments, using the Z values of the end points of the segments. The visible segments of a scan line are compared to the visible segments of a previous scan line, and if the end points of a visible segment taken from a polygon differ by less than a threshold amount, the lines formed between points in one scan line and the adjacent scan line are considered to be visible lines. Where the two scans are a horiZontal scan and a vertical

scan, the threshold amount for vertical scans is the distance between horiZontal scans and the threshold amount for horiZontal scans is the distance between vertical scans. While the scan line spacing might correspond to a pixel spacing of a display device where the image is to be displayed, the scan lines need not be so related.

In an alternate embodiment, only one scan is performed. One speci?c embodiment uses, several layers of ?ltering

to limit the number of overlapping polygons which need to be considered at each scan line. If the triangles are provided in triangle strips, the strips are ordered by their minimum extent in the scan direction, so that entire strips can be ignored until the scan line corresponding to the minimum extent is reached. The triangles remaining for consideration can be individually eliminated if their vertices indicate that they are wholly to one side of the scan line.

In some embodiments, objects are represented by multiple polygons. If the interpolygon lines are not desired, they can be easily eliminated in the visible line determination process by combining segments of the scan line which are adjacent, have matching object ID’s and have common Z values. An added advantage of the present invention is the

generation of plane intersection lines as a by-product. A plane intersection line is a line of penetration of two or more objects. A further understanding of the nature and advantages of

the inventions herein may be realiZed by reference to the remaining portions of the speci?cation and the attached drawings.

10

15

25

35

45

55

65

4 BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1(a)—(e) show various representations of an image of two objects.

FIG. 2 is a block diagram of a graphics processing system including a visible line processor according to the present invention.

FIG. 3 shows the visible line processor of FIG. 2 in further detail.

FIG. 4A and 4B is a ?ow chart of a process of generating a visible line table from an object table.

FIG. 5 is an illustration of the scanning process.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The following description describes using the present invention to quickly determine visible lines. In these examples, the input to a visible line processor is a set of triangles, either in triangle strips or as individual triangles. For simplicity of the example, the triangles are completely opaque and viewed in a parallel projection onto the Z=0 plane. As should be apparent after reading this disclosure, the methods and apparatus can be extended in a straightfor ward manner to handle polygons with more than three sides, as well as partially or completely transparent polygons. It should also be apparent after reading this description that the invention can also be used with overlapping two dimensional objects by adding a third dimension to handle object overlap, and that the methods and apparatus can easily be modi?ed to handle visible line determination for perspective projections, either directly or after transforma tion to a parallel projection. As explained above, FIG. 1 shows a set of objects both

with hidden lines shown and with hidden lines removed. But one advantage of hidden line removal is that the objects depicted are more easily discerned. Another advantage of hidden line removal is that less processing is needed for generating color and shading an image if all the hidden lines and objects are removed.

FIG. 2 is a block diagram of a graphics processing system including a visible line processor (VLP) 10 according to the present invention. VLP 10 is shown as part of a larger graphics processing system 100 which processes an object list 12 and includes a polygon approximator 14 for gener ating a list 16 of triangle strips, a triangle extractor 18 for separating triangle strips from list 16 into their constituent triangles and storing the triangles in a list 20 of candidate triangles, and an active triangle selector 22 for transferring triangle entries from list 20 to a list 24 of active triangles. VLP 10 operates on this list 24 of active triangles to generate a visible lines table (VLT) 26. VLP 10, triangle extractor 18 and active triangle selector 22 obtain a counter value indi cating the current scan line from a scan line counter 28.

In a software embodiment, the processing apparatus (10, 14, 18, 22, 28) shown in FIG. 2 is implemented by an appropriately programmed digital computer, such as one or more microprocessors running an executable program. The lists (12, 16, 20, 24) are implemented in memory storage such as random access memory (RAM) or disk storage, or partially are implemented in read-only memory (ROM) where appropriate. In a hardware embodiment, the process ing apparatus is implemented by high-speed dedicated circuits, and the lists are stored in memory contained on an integrated circuit shared with the processing circuits. Depending on memory requirements, the integrated circuit might provide all memory storage or external memory could

Page 11: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 5

be used as Well. Whether the software embodiment is preferred over the hardware embodiment depends on factors only tangentially related to the present invention. For example, Where an object list is only infrequently processed to ?nd visible lines and Weight is a critical factor, softWare is preferred over hardWare. Where processing is done more often and speed is a primary consideration, the hardWare implementation is often preferred. In a hybrid embodiment, each process of FIG. 2 is implemented by a dedicated microprocessor temporarily programmed to perform the speci?c function shoWn, thus forming a parallel processor.

FIG. 3 shoWs VLP 10 in further detail, along With list 24 of active triangles, scan line counter 28 and VLT 26. VLP 10 is shoWn comprising a triangle ranger 40, a scan line segmenter 42, a visible segment generator 44, a delta processor 46, a visible line list memory 50 and a scan controller 52.

Triangle ranger 40 is coupled to receive triangle speci? cations from list 24 and a scan line counter value from scan line counter 28. Scan line segmenter 42 is also coupled to receive the scan line counter value from scan line counter 28, as Well as being coupled to receive a list of intersecting triangles from triangle ranger 40. Visible segment generator 44 is coupled to receive from scan line segmenter 42 a list of segments of triangles intersecting the current scan line (the current scan line is indicated by the scan line counter value). Delta processor 46 is coupled to receive a list of visible segments from visible segment generator 44 for a current line and the already determined visible line segments from visible line list 50. The end points of segments are used to extend the end points of lines in the visible line list, adding neW lines as necessary. Scan controller 52 is coupled to scan line counter 28 to increment the scan line counter value and read out the contents of visible line list 50 to VLT 26 When the scan line counter value indicates that the scans have been completed. The operation of VLP 10 Will noW be described.

FIG. 4 is a How chart of a process of generating a VLT from an object table. The steps of the How chart are labelled from S1 to S16 and are each explained in detail beloW. The process begins With a set of objects and a scan resolution. If the apparatus of FIG. 2 is used, the set of objects is represented by object list 12. In this example, the objects are ?rst scanned by horiZontal scan lines, then by vertical scan lines. It should be apparent, hoWever, that the order of the scans is not material and that the scans need not be exactly orthogonal so long as each visible line is picked up by at least one scan.

The scan resolution de?nes the spacing betWeen each successive scan line and herein the spacing betWeen hori Zontal scan lines is referred to as Ah and the spacing betWeen vertical scan lines is referred to as Av. The scan resolution, While often related to a pixel resolution (e.g., one pixel per Ah><Av rectangle), need not be so related, since the visible line table is not at the resolution of the scans but at the resolution of the original set of objects. Of course, the scan resolution does control the set of visible lines someWhat. For example, line segments smaller than the scan resolution Will not appear on the visible line table, even if they are in fact visible. Where the scan resolution is close to the eventual rasteriZation resolution (pixel resolution), these artifacts are not apparent, but Where this a large difference of magnitude, they might be visible.

In some embodiments, the visible lines are determined in a single scan, hoWever, With tWo orthogonal scans, each scan can be constrained to ignore lines Which are not Within an

10

15

25

35

55

65

6 orthogonal scan line Width. For example, during a horiZontal scan (i.e., Where the image is being scanned from top to bottom With horiZontal scan lines), only lines steeper than (or With slope equal to) Ah/Av need to be considered, as the other, ?atter lines Will be picked up in the vertical scan. One advantage to ignoring the ?atter lines is that, When continu ing a line based on end points, points more than Av aWay from the last end point need not be considered. Of course, the lines Which are ?at for the horiZontal scan are steep for the vertical scan, and vice versa.

Each triangle vertex is a point in three-dimensional space, hoWever the Z coordinate need be used only for determining overlap, since the scan is done on a parallel projection. In other Words, each scan line is actually a scan plane extend ing in the Z direction as Well as the direction of the scan line, and thus the end points of the line segment de?ned by the intersection of the scan line and a triangle are determined by the x and y coordinates of the projection.

S1: In this step, all objects are reduced to triangles (In alternate embodiments polygons With more than three sides are alloWed). Manipulating a curved object, such as a sphere or cylinder, using its exact mathematical surface description often requires trigonometric transformations, Which are simple When modelling one or tWo such shapes, but imprac tical With many curved surfaces or shapes or When many operations need to be done quickly. For ef?cient processing, curved shapes and surfaces are approximated by polygons, and typically those polygons are triangles.

If a surface requires many triangles for an acceptable approximation, the result Will be many connected triangles. See for example, FIG. 1(b), Which shoWs an approximation of a cylinder and a square formed by nothing but triangles. These connected triangles can be efficiently represented by triangle strips. Atriangle strip is a sequence of three or more vertices in Which every consecutive set of three vertices de?nes a triangle. A triangle strip of n vertices thus de?nes a connected strip of n-2 triangles. The triangle strip version of FIG. 1(b) is shoWn by FIG. 1(c).

If the apparatus of FIGS. 2—3 is used (graphics processing system 100), this step is performed by polygon approxima tor 14 and the resultant triangle strips are stored in list 16.

S2: In this step, the triangle strips are ordered by mini mum scan line extent for the current scan direction. The minimum scan line extent is the ?rst scan line Which crosses any triangle in a triangle strip, and is therefore likely to be different for each scan direction. Since a triangle strip is just a list of vertices, the minimum extent is the ?rst scan line beyond the minimum vertex for the strip. For example, if the current scan direction is horiZontal from loWer y coordinates to higher y coordinates, and a vertex Vymin is the vertex of the triangle strip With the smallest y coordinate, the mini mum scan line extent for that triangle strip Would be the scan line With the smallest y coordinate greater than Vymin. The triangle strips need not be physically reordered, as it

is suf?cient to maintain a list of Which triangle strips go With each scan line extent. This list is used to eliminate entire triangle strips from consideration When evaluating scan lines by acknoWledging that no triangle in a triangle strip can cross a scan line if the scan line has not yet reached the minimum extent of that triangle strip.

S3: In this step, a scan line counter, such as scan line counter 28, is initialiZed to point to the ?rst scan line of the ?rst scan direction. Herein, the current scan line is referred to as “C” and the coordinate of the current scan line is referred to as “Cpos” (Cpos is a y coordinate value for horiZontal scans and an x coordinate value for vertical

scans.)

Page 12: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 7

If graphics processing system 100 is used, segment list memory 48 is also initialized at this point.

S4: The list generated in step S2 is queried to determine Which, if any, triangle strips have a minimum extent of scan line C, indicating that the triangles in those strips should noW be considered as possibly intersecting the current scan line. Those triangles are then separated from their strips and placed on a list of candidate triangles.

If graphics processing system 100 is used, this step is performed by candidate triangle extractor 18 and the can didate triangles are stored in list 20.

Each extracted triangle is represented by its three vertices. These vertices are sorted such that V1 is alWays the ?rst vertex encountered, V2 is the next one, and V3 is the last vertex encountered. Depending on the triangle, the vertices might be different for each scan direction. For example, see FIG. 5, Which illustrates the scanning process. In FIG. 5, triangle T2 is shoWn With vertices V1, V2 and V3 ordered for a horiZontal scan. In a vertical scan With loWer coordi nate values being on the left, the labels for the vertices V2 and V3 Would be sWapped.

S5: In this step, each triangle in the list of candidate triangles Which has a vertex V1 less than or equal to Cpos is placed on the list of active triangles. As should be apparent, C is the ?rst scan line Which could intersect such triangles.

S6: In this step, each triangle in the list of candidate triangles Which has a vertex V3 less than Cpos is deleted from the list of active triangles, since those triangles cannot be intersected by any further scan lines. Steps S2, S4, S5 and S6 can be replaced With a one-time conversion of triangle strips to active triangles, but these steps ensure ef?cient memory usage as triangle strips are expanded only When needed, triangles are considered only When needed, and triangles are deleted once they no longer need to be con sidered.

If graphics processing system 100 is used, steps S5 and S6 are performed by active triangle selector 22, Which transfers triangles from list 20 to list 24 as part of step S5 and removes triangles from list 24 as part of step S6. Of course, the moving and deletion could be logical instead of physical. An advantage to the above steps is that all the triangles need not be in memory at once, only those that intersect the current scan line.

S7: Once a list of the active triangles is determined, a segment list is generated for the current scan line. The list of active triangles is the list of all the triangles Which intersect the current scan line, or more precisely, each triangle Whose projection overlaps the current scan line. A segment is the portion of the scan line overlapped, and for each segment, the segment list maintains tWo end points, an object iden ti?er indicating the object to Which the intersecting triangle belongs, and a triangle identi?er if necessary. The segments on the list are determined Without reference to Whether they are overlapped, eclipsed or split by other segments from other triangles. Although the horiZontal scan lines and the vertical scan lines form a grid, the resolution of the end points for a horiZontal scan is not controlled by the vertical scan resolution, and vice versa. Instead, the end points are calculated at full resolution, such as single or double ?oating point precision.

If graphics processing system 100 is used, the segment list is generated by scan line segmenter 42 from intersecting triangles read from list 24 of active triangles.

S8: In order to ef?ciently process the segment list, the segments are ordered according to optimiZation rules. The

10

15

25

35

45

55

65

8 stree( ) process inputs a list of ordered segments and this ordered list is searched during the stree( ) process. For quick searching, the segments are placed in a binary tree. HoWever, With conventional binary tree loading a sequential load of ordered elements Will result in an uneven tree. Since uneven trees increase average search times, the tree balanced by reordering the segments. As an example, suppose the segment list contains 64 entries, labelled 0 to 63. The segments are fed into the stree( ) process ordered as folloWs: 32, 16, 48, 8, 24, 40, 56, etc. Another Way of describing this ordering is that the labels are expressed in binary and the segments With labels having greater numbers of “0”’s to the right of the ?rst “1” go ?rst.

Another optimiZation rule is to order segments in the segment list With segments from previously visible triangles ?rst. A previously visible triangle is one Which contributed a visible segment for the previous scan line.

S9: The optimiZed segment list is then processed to determine Which segments are visible, resulting in a list of visible segments. The list of visible segments is not neces sarily a subset of the segment list With the totally obscured segments deleted, since some segments are partially obscured. If a segment is partially obscured from one point on the line segment to the end of the segment, the corre sponding visible segment is one With one end point moved toWard the other. If a segment is partially obscured from one point Within the segment to another point Within the segment, then tWo segments result.

This is best illustrated With an example. FIG. 5 shoWs three triangles T1, T2 and T3. Suppose the current scan line is H”. The segment list contains AC (T1), DE (T2) and BF (T3). Suppose further that T1 is in the plane Z=1, T2 is in the plane Z=2, T3 is in the plane Z=3 and the vieW plane is Z=0. In this example, then, T3 is obscured by T1 and T2 and T2 is obscured by T1. Therefore, the visible segment list for the current scan lines is AC (T2), CD (T3), DE (T1) and EF (T3). The background is handled either by a special case or the placement of a large, ?at object of a background color at a plane Z=Zmax.

If graphics processing system 100 is used, this step is performed by visible line segment generator 44. The func tion stree( ) for performing this operation is detailed beloW.

In the stree( ) process, each neW segment added to the tree is compared to the segments in the tree. HoWever, since the tree is ordered by end point, the process can quickly deter mine Which visible segments already in the tree are touched by the neW segment. Since the visible segments do not overlap, all that is needed is to look for segments Which have one end point betWeen the tWo end points of the neW segment. The neW segment Will be discarded if it is completely

hidden (as determined by comparing Z values of end points) by segments already in the tree. OtherWise, it Will be entered and other segments it obscures Will be removed. If the neW segment is only partially obscured or obscuring, no seg ments Will be deleted, but end points Will be moved. Also, if a segment is obscured only internally and not at its end points, the segment is replaced by tWo segments. An example of hoW tWo segments result from one is shoWn in FIG. 5. Ignoring the effects of T2, segment BF Would be divided into tWo segments, BD and EF upon the introduction of the segment DE into the tree.

Plane intersection is taken into account When a neW segment is tested against the tree. For example, if the neW segment’s end points de?ne a range of Z values Which overlaps a range of Z values for an existing segment and the

Page 13: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095

neW segment overlaps the existing segment on the scan line, an intersection point might exist. Intersection points can be quickly calculated for tWo line segments, and if an intersec tion point is found, the neW segment is split into a visible portion (the portion in front of the eXisting segment) and an invisible portion. The visible portion is stored on the tree and the invisible portion is discarded.

If an object Was broken into multiple triangles and the boundaries of the triangles are not of interest, they can be eliminated in this step. As an example, FIG. 1(d) shoWs tWo objects With the boundaries of the triangles and FIG. 1(e) shoWs the boundaries removed, leaving only the boundaries of the objects. To effect this, tWo visible line segments are combined into one Where they are adjacent (i.e., they have a common end point), have the same object ID, and the common end point has the same Z coordinate in each segment. The latter requirement is necessary so that When an object blocks itself (for eXample, vieWing a corrugated surface from near its edge), the line betWeen one part of the object and another part is not eliminated.

If the assumption of segment linearity in the Z direction is to be made in a later step, such as a shading step, then intra-object line elimination might be put off until linearity in Z is no longer needed.

S10: In this step, the visible segment list generated in step S9 for the current scan line is used to build a visible line list. The visible line list indicates Which visible lines have been found up to the current scan line. The visible line list contains lines Which separate objects, as Well as end points Which signal the start of a visible line. A line cannot skip a scan line and still be considered a single line, so all the non-line end points are associated With the most recently processed scan line. The visible lines are created by con necting end points from one scan line to end points on adjacent scan lines.

The visible line list is initially empty. When the ?rst scan line is processed, the end points of the visible segments for that scan line (assuming there are visible segments crossing that scan line) are added to the visible line list as end points of visible lines. No visible lines are de?ned at this point, since a line requires at least tWo points. As used here, a visible line can have more than tWo points de?ning it and it does not have to be perfectly straight. The deviation from perfect straightness could be caused either by round-off error or a visible line could be bent When the triangle it bounds is clipped by another triangle.

The processing of the neXt scan line results in another visible segment list. The end points of this neW visible segment list are compared to the end points Which are already on the visible line list. If an end point in the neW visible segment list matches up With an end point in the prior visible segment list, the points are connected as a visible line. If an end point on the scan line does not match up, it is added to the visible line list as an end point (it might be the beginning of a neW visible line). For tWo end points on adjacent scan lines to match up, their positions along their respective scan lines (X coordinate for the horiZontal scan, y coordinate for the vertical scan) must be Within an orthogo nal scan line Width (Av for the horiZontal scan, Ah for the vertical scan) of each other. To match up, the end points must also be associated With the same triangle. For eXample, in the horiZontal scan, the end points must be the left end points for the same triangle or the right end points for the same triangle. With a single scan process, the requirement that the positions of the end points match Within an orthogonal scan line Width is not used.

10

15

25

35

45

55

65

10 As each subsequent scan line is processed, the visible

segment list for the current scan line is used to eXtend the visible lines or add unmatched end points to the visible line list. As an eXample, refer again to FIG. 5. If Hn_1 is the ?rst

scan line, the visible line list is empty until the end points J and K are added to the visible line list. Since information about Which triangle they belong to is still needed, the end points might be stored as segments. When the neXt scan line, H”, is the current scan line, the neW visible segment list is AC (T2), CD (T3), DE (T1) and EF Since J and D have X coordinates Within Av of each other, are both end points on the same triangle (T1), and are end points on the same side of T1 (left), they match and form a visible line. Since K and E are Within Av of each other and are on the same side (right) as each other and on the same triangle (T1) as each other, they also match and form a visible line. The other end points on the current scan line (A, C, F) don’t match, so they are added to the visible line list as end points.

In the eXample of FIG. 5, the scan lines are much farther apart than they should be given the triangles being pro cessed. This is done to clarify the concepts involved, and in practice more scan lines Would intersect the typical triangle. For the triangles in FIG. 5, the neXt scan line results in the segment list NM (T1) and PQ (T2), and MP if the back ground is tracked. Because of the position of end points P and Q, the end points A and C are never matched. Because T3 does not eXtend to Hn+1, F is also never matched. HoWever, N is matched With D, and M is matched With E. AP and CQ are not visible lines since their X coordinates (A to P and C to Q) differ by more than Av. If one of AP and CQ differed by more than Av and the other differed by less, the one that differed by less Would be added to the visible line list With the assumption being that the other is added to the list When scanning in the other direction.

In the neXt scan line, S is matched With N, and U is matched With M. Thus, in the horiZontal scan, only the lines JDNS and KEMU are generated. In the vertical scan, other lines are generated but at the resolution shoWn some lines are missed.

If visible segments from common objects Were combined in step S9, then those end points aren’t available for gen erating visible lines, so intra-object lines do not appear.

S11: As the visible lines are generated, such as JDNS and KEMU, the visible line list can be simpli?ed by thinning. A thinning process recogniZes that J, D, N and S are collinear and replaces JDNS With JS. The thinning process also recogniZes that K, E and M are collinear, but U is not, and replaces KEMU With KMU. The test for collinearity simply checks Whether a third point is Within a small tolerance of a line de?ned by tWo other points. Since the points are equally spaced in one direction, only the position on a scan line need be checked. For eXample, to test Whether D, J and N are collinear, the X coordinates are compared. If the difference betWeen D and J is Within a tolerance of the difference betWeen D and N, the points are deemed collinear and D is eliminated. The tolerance might be Zero but for round-off error.

Another Way to simplify the visible line list is to eliminate intra-obj ect lines, if the end points causing these lines are not already eliminated in step S9.

If unmatched end points eXist Which don’t contribute any visible lines, they can be removed to save memory.

For proper display of an image, it is frequently necessary to knoW or assign a visible line segment to one of the tWo objects the visible line segment divides. For eXample, in

Page 14: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 11

FIG. 5, the line segment DR divides T1 and T3 (DR is used for an example only—it is not a line segment that Would be generated by the scanning process as R is not on a scan line). If the lines are to be colored according to Which object they belong, DR should be assigned to either T1 or T3. Since T1 is “in front” of T3, DR should be assigned to T1. The object to Which a visible line belongs is determined from the Z value of the end points of the visible segments Which Were used to generate the visible line.

S12: After the visible line list is updated, the scan line counter is incremented.

S13—S15: At step S13, the scan line counter is checked. If the last scan line has been processed, the program ?oWs to step S14, otherWise the program loops back to step S4 to process the next scan line. At step S14, if the last scan direction is complete, the program ?oWs to step S16, oth erWise the scan counter is reset at step S15 and the scan axis is changed. If, for example, the process is a tWo-pass scan process With a horiZontal scan folloWed by a vertical scan, step S15 is performed at the end of the horiZontal scan.

S16: In this step, the visible line list is output as the visible line segment table.

In summary, the process just described scans an image formed by a set of objects, ?rst by horiZontal scan lines, then vertical scan lines, to ?nd visible lines. The visible lines delineate the visible boundaries betWeen objects in the set. Those objects are represented by one or more triangles. At each scan line, the triangles Which intersect the scan line are examined to determine the extents of the line segments Which intersect the scan line. These extents are further examined to determine Which of them are visible, keeping in mind that there might be more visible segments than seg ments overall, due to splitting and overlap. Because this method determines all visible boundaries of the objects (doWn to the resolution of the scan lines), this method also provides object surface intersection lines at no additional cost. In addition, because the position of each segment along the scan line is knoWn, and visibility is determined inde pendently for each scan line, a segment does not have to be compared With a long list of other segments to determine visibility.

Although the above describes a serial process, the process of determining hidden lines can be implemented as a parallel process. For example, in a multi-threaded operating system, the process of triangle separation can be done as one thread, the active triangle selection as another, the determination of visible line segments as another, and the determination of visible lines from the visible line segments as yet another. Alternatively, the horiZontal scans can be performed by one thread and the vertical scans by another.

FIG. 5 is an illustration of a horiZontal scan. A horiZontal scan is so named because the scan lines are horiZontal. Thus, the progress of the horiZontal scan actually runs vertically, from top to bottom. Four scan lines are shoWn (Hn_1 to HMZ). Those scan lines cross the three triangles shoWn (T1, T2, T3). FIG. 5 also shoWs various points of intersection of scan lines and triangles. Strictly speaking, in a three dimensional space, if the triangles are not coplanar it is not likely that they Will all intersect the scan lines. HoWever, as used herein, it is to be understood that intersection of a scan line and an object refers to the intersection of scan line and the projection of the object onto a vieW plane (either a perspective projection or a parallel projection).

Each triangle is shoWn With three vertices, V1, V2 and V3. The vertices are ordered When the triangles are extracted from triangle strips, or before they are added to the list of active triangles, so that a test of Whether or not a triangle intersects a scan line can be easily determined by examining V1 and V3. For a horiZontal scan line to intersect a triangle,

15

25

35

45

55

65

12 the x value for the scan line must be betWeen the x values for V1 and V3, inclusive. Where V1 is equal to V3, the triangle is a Zero area triangle, since V2 must then be collinear With V1 and V3. Zero area triangles can be ignored or processed as other triangles.

Several intersection points are shoWn, such as A, B, C, D, E, F, N, M, etc. A line segment is de?ned by tWo end points and a line segment is associated With a triangle and an object. Avisible line segment is a visible portion or entirety of a line segment. Each end point is characteriZed by a three-dimensional value; hoWever, for a given horiZontal scan line, only the x and Z values need be speci?ed, as the y value is determined by the y value of the scan line. Each end point is also a point on a boundary betWeen tWo or more objects.

According to the terminology used above, AC, DE and BF are line segments of scan line H” and AC, CD, DE and EF are the visible line segments for that scan line (T3 is behind both T1 and For scan line Hn+1, the line segments are NM and PQ, and both line segments are fully visible. Because D and N belong to the same object (T1) on the same side (left) and have x values Within Av of each other, and E and M also belong to the same object and have x values Within Av of each other, DN and EM de?ne visible lines.

The scan line spacing, Ah, in FIG. 5 is exaggerated so that the examples discussed herein are clear. HoWever, for an actual scan, the scan spacing Would be much smaller relative to the objects being scanned. For example, in order to clearly handle the boundaries of T3, that triangle should be crossed by more than one scan line.

The above description is illustrative and not restrictive. Many variations of the invention Will become apparent to those of skill in the art upon revieW of this disclosure. For example, the above description describes a tWo scan method for locating visible lines, but a one scan method is also possible. The scope of the invention should, therefore, be determined not With reference to the above description, but instead should be determined With reference to the appended claims along With their full scope of equivalents. What is claimed is: 1. A method for visible line determination using a pro

grammed circuit, Wherein visible line determination is a process of determining Which lines, or segments thereof, of Which objects in an object table are visible from a vieW point Where the vieW point and the objects are speci?ed by coordinates in a coordinate space of tWo or more dimensions, the method comprising the steps of:

de?ning a scan line spacing relative to the objects in the coordinate space;

positioning a plurality of scan lines over the objects at the scan line spacing;

for each scan line, performing the folloWing steps: a) determining the objects Which are crossed by the

scan line, resulting in a list of scan line segments, Wherein a scan line segment in the list of scan line segments is a portion of the scan line Which is bounded by intersecting edges of an object crossed by the scan line, Wherein each intersecting edge is associated With a visible line or a segment of a visible or invisible line;

b) determining visible scan line segments from the list of scan line segments and distances of the scan line segments from either the vieW point or a vieW plane; and

c) matching the visible scan line segments for the scan line With the visible scan line segments from a prior scan line to determine segments of visible lines, a segment of a visible line extending over at least tWo

Page 15: United States Patent [19] [11] Patent Number: 5,835,095 ...content.equisolve.net/_cff3e83eed7598237a6f92462a7... · 5,557,691 9/1996 Izuta ... “Computer Graphics Principles and

5,835,095 13

scan lines and de?ning a visible boundary between tWo objects; and

outputting the segments of visible lines as a visible line table indicating Which lines, or segments thereof, of Which objects in the object table are visible from the vieW point.

2. The method of claim 1, Wherein the coordinate space is a three-dimensional space.

3. The method of claim 1, Wherein the coordinate space is a tWo-dimensional space With an added dimension to indi cate overlap of objects in the coordinate space.

4. The method of claim 1, Wherein all the objects are either polygons or are represented by a ?nite number of polygons.

5. The method of claim 4, Wherein all the polygons are triangles.

6. The method of claim 4, further comprising the step of removing all visible lines or segments of visible lines Which divide multiple polygons used to represent a single object.

5

15

14 7. The method of claim 1, Wherein intersecting lines are

lines Whose projections meet at a point. 8. The method of claim 1, Wherein the vieW point is

in?nitely far from the objects, thereby providing a parallel projection of the objects onto the vieW plane.

9. The method of claim 1, further comprising a ?lter step Wherein objects Which do not intersect a current scan line are not considered during the steps associated With the current scan line.

10. The method of claim 1, Wherein the image is scanned in a horiZontal direction and a vertical direction and the step of matching visible scan line segments is a step of matching visible scan line segments only When the end points of the matching visible scan line segments differ by less than a threshold.

11. The method of claim 10, Wherein the threshold is a vertical scan spacing during a horiZontal scan and the threshold is a horiZontal scan spacing during a vertical scan.

* * * * *