Polygon drawing method and apparatus

Abstract: A method fills a polygon and then draws edge lines while inhibiting renewal of only depth data in a depth buffer (6). Thereafter, a method fills the polygon while inhibiting renewal of only color data in a color buffer (5). The filling and drawing are performed by applying hidden surface removing processings based upon depth buffer algorithm.

Description: The present invention relates to novel methods and apparatus for three dimensionally drawing polygons with filling and for drawing a desired figure over the polygons with accentuating. In a graphics display apparatus, it is required that not only an object applied for display be merely displayed with filling but also a unit polygon which constitutes an object be displayed with accentuating its edge lines so as to easily visually recognize the size and control points and the like of the unit polygon. When two dimensional polygons are displayed, edge lines of any of the polygons are easily displayed with accentuating and no disadvantage arises. But when three dimensional polygons are displayed, a disadvantage arises in that the display of the edge lines having a predetermined width of the polygon with accentuating is remarkably difficult. More particularly, in the three dimensional graphics display apparatus, three dimensional feeling is generally represented by applying a hidden surface removal operation. When polygons are drawn with filling, depth data for each pixel of each polygon are calculated, then depth data for each pixel of a polygon are compared with depth data for corresponding pixels of other polygons, thereafter only neccessary pixels are visually displayed. Now, when polygons are displayed with filling, depth data are interpolated in a scanning line direction, while when edge lines of a polygon are displayed with accentuating, depth data are interpolated in an edge line direction. Both depth data are not assured coincidence with one another. As a result, the disadvantage arises due to the lack of coincidence of both depth data that the display quality of edge lines with accentuating is lowered, for example the edge lines may be diplayed as dotted lines. An apparatus has been proposed to eliminate the disadvantage (Japanese Patent Laid Open Sho 63-15288). The apparatus first draws only edge lines of a polygon using a depth buffer algorithm and writes flag data into an edge-flag-memory which is used to control whether or not renewal of data stored in a depth buffer memory and a frame buffer memory is permitted. The apparatus then draws the polygon accentuating its edge lines with filling using the depth buffer algorithm and taking the flag data into consideration. The apparatus finally erases all flag data. When the apparatus is employed, depth data and color data of the edge lines which are previously drawn are securely prevented from renewing despite the relationship between the interpolation operation results in the scanning direction and the interpolation operation results in the edge line direction. The disadvantage of the edge lines being displayed as dotted lines and the like is eliminated when the edge lines are displayed with accentuating for every polygon. When polygons with their edge lines accentuated and regular polygons exist, depth data of edge lines may be different from depth data in the scanning line direction. The disadvantage arises that the edge lines are partially hidden so as to display the edge lines as dotted lines when regular polygons are drawn with filling using hidden surface removal after polygons with their edge lines accentuated are drawn with filling. When polygons are displayed as translucent polygons, every polygon must be applied sorting in a depth direction (hereinafter referred to as z-sorting). In this case, depth data of edge portion of polygons with their edge lines accentuated and depth data of edge portion of regular polygons are mixed on a pixel basis, the former depth data may be greater for a pixel and the latter depth data may be greater for another pixel. The disadvantage arises in that the z-sorting of polygons becomes impossible. The EP 0 314 288 A2 discloses a drawing apparatus according the preamble of claim 6. It is an object of the present invention to accentuate the display of an arbitrary figure over polygons with high quality when the polygons are three dimensionally drawn with filling. The object is solved by the method of drawing a polygon of claim 1 and by the drawing apparatus of claim 5. Further embodiments of the invention are given in the subclaims. When the first pixel data are generated by the pixel data generating means for filling the polygon, the linear interpolation means sequentially generate three dimensional coordinates data and the color data generating means generates color data corresponding to the generated three dimensional coordinates data. The polygon is then three dimensionally filled by applying hidden surface removing operations based upon a depth buffer algorithm. Thereafter, when the second pixel data are generated by the pixel data generating means for drawing the desired figure, the linear interpolation means sequentially generate three dimensional coordinates data and the color data generating means generates color data corresponding to the generated three dimensional coordinates data. The figure is then three dimensionally drawn by applying hidden surface removing operations based upon a depth buffer algorithm. When the filling of the polygons and drawing of the desired figure are performed for the first time, renewal of only depth data is inhibited by the renewal control means. The polygons and the desired figure are accordingly drawn in a overwriting manner, the depth data are then held as of the prior condition before starting drawing. When the filling of the polygons and drawing of the desired figure are performed for the next time, renewal of only color data is inhibited by the renewal control means. Only the depth data are accordingly renewed based upon the depth buffer algorithm. The contents of the depth buffer suit the drawn polygons and the drawn figure. These and other objectives, features and advantages of the present invention will be more readily understood upon consideration of the present invention, taken in conjunction with the accompanying drawings. Figure 1 is a flowchart for a polygon filling method with accentuating of its edge lines as an embodiment of a figure drawing method according to the present invention; Figures 2-A1, 2-B1 to 2-B10 and 2-C2 to 2-C10 are diagrams useful in understanding a figure drawing method based upon a specific example; Figure 3 is a block diagram showing a polygon filling apparatus with accentuating of its edge lines as an embodiment of a figure drawing apparatus according to the present invention; and Figure 4 is a flowchart for a polygon filling method with accentuating of its edge lines as another embodiment of a figure drawing method according to the present invention. Figure 1 is a flochart for a polygon filling method with accentuating of its edge lines as an embodiment of a figure drawing method according to the present invention. In step (1), color data for accentuating is established. In step (2), a polygon is extracted which is to be drawn with accentuating of its edge lines. In step (3), renewal of color data in a color buffer is permitted while renewal of depth value in a depth buffer is inhibited. In step (4), the extracted polygon is filled by hidden surface removing processings based upon the depth buffer algorithm. In step (5), edge lines of the filled polygon are drawn with the color data for accentuating by a random vector drawing method with hidden surface removing processings based upon the depth buffer algorithm. When the operations from step (1) to step (5) are performed, the polygon accentuated in its edge lines is drawn in the color buffer. Renewal of the depth value in the depth buffer is not performed at all through the processings mentioned above. The corresponding polygon is accordingly accentuated in its edge lines with high quality. In step (6), renewal of depth value in the depth buffer is permitted while renewal of color data in a color buffer is inhibited In step (7), the extracted polygon is filled by hidden surface removing processings based upon the depth buffer algorithm. When the operations of steps (6) and (7) are performed, the depth values are renewed with depth values which are obtained by performing interpolation processings in a filling direction within the whole extent of the extracted polygon. The contants of the color buffer and the contents of the depth buffer accurately correspond to one another. After the operation in step (7) is finished, in step (8), a judgement is made as to whether or not all polygons are extracted, which are to be drawn with accentuation of their edge lines. When it is judged that there remains one or more polygons which are to be drawn with accentuation of their edge lines, the operation in step (2) is repeated. On the other hand, when it is judged in step (8) that all polygons are extracted, which are to be drawn with accentuation of their edge lines, the series of operations are then finished. As to polygons without accentuation of their edge lines, the polygons are filled by hidden surface removing processings based upon the depth buffer algorithm under the condition that renewal of color data in the color buffer and renewal of depth value in the depth buffer are permitted. Figures 2-A1, 2-B1 to 2-B5 and 2-C2 to 2-C5 are diagrams useful in understanding the figure drawing method based upon a specific example. Fig. 2-A1 shows five polygons P1, P2, P3, P4 and P5 which are disposed three dimensionally. And these polygons are displayed on a scope as shown in Fig. 2-B1. Figs. 2-B2 to 2-B10 and 2-C2 to 2-C10 explain the operations to display the five polygons shown in Fig. 2-A1 on a scope shown in Fig. 2-B1. In the following description, drawing priority order of the polygons are determined as P1, P4, P5, P2 and P3, and only the polygons P2 and P3 are to be drawn with accentuating their edge lines. Under this condition, the polygons P1, P4 and P5 are filled by the hidden surface removing processings based upon the depth buffer algorithm while permitting renewal of color data in the color buffer and renewal of depth value in the depth buffer. The polygons are accordingly displayed on the scope as is shown in Fig. 2-B2, while the contents of the depth buffer are determined as is shown in Fig. 2-C2. When the polygons P2 and P3 are drawn, filling operations of the polygons are performed by applying the hidden surface removing processings under the condition that renewal of the depth value in the depth buffer is inhibited. The polygons are accordingly displayed on the scope as is shown in Fig. 2-B3, while the contents of the depth buffer are determined as is shown in Fig. 2-C3. Then, the edge lines of the polygons P2 and P3 are drawn with accentuation by applying the hidden surface removing processings under the condition that renewal of the depth value in the depth buffer is inhibited. The polygons are accordingly displayed on the scope as is shown in Fig. 2-B4, while the contents of the depth buffer are determined as is shown in Fig. 2-C4 which is the same as Fig. 2-C3. The edge lines must be drawn on the same locus taking into account the determination of the starting point and the end point. It is accordingly sufficient for example that the edge lines are drawn by determining a point having fewer coordinate values as the starting point. Thereafter, the polygons are filled again by applying the hidden surface removing processings under the condition that renewal of only color data in the color buffer is inhibited. The polygons are accordingly displayed on the scope as is shown in Fig. 2-B5 which is the same as Fig. 2-B4, while the contents of the depth buffer are determined as is shown in Fig. 2-C5 which corresponds to the actually displayed polygons P2 and P3. As a result, the disadvantage is eliminated that the edge lines are displayed as dotted lines and the like, and the polygons with their edge lines accentuated are accodingly filled with high quality. In the figure drawing method mentioned above, it is of course possible that filling a polygon in only the color buffer, drawing edge lines in only the color buffer and filling a polygon in only the depth buffer are repeated only for the polygons P2 and P3. As is apparent from the foregoing, it is sufficient that ordinary filling and drawing processings are performed for each polygon by selecting the condition that renewal of the depth value in the depth buffer is inhibited and the condition that renewal of the color data in the color buffer is inhibited. It is not needed to especially determine different depth values from the ordinarily obtained depth value, accordingly. The illustrative drawing method is easily carried out without requiring extra equipment because the function of inhibiting renewal of data in each buffer is previously provided. Figure 3 is a block diagram showing a polygon filling apparatus for accentuating its edge lines as an embodiment of an illustrative drawing apparatus according to the present invention. The apparatus includes a processor 1 for outputting apex coordinates data and the like which are necessary for interpolation processings, interpolation operation devices (hereinafter referred to as DDA) 2x, 2z and 2c for generating plane coordinates data, depth value and color data, respectively, based upon pixel data including the apex coordinates data and the like supplied from the processor 1, an accentuating color register 4 for holding accentuating color data which are used for drawing edge lines with accentuation, a color buffer 5 for storing color data which correspond to display figures, a depth buffer 6 for storing depth values which are part of the pixel data to perform hidden surface removing processings, a selector 7 for selecting the accentuating color data read out from the accentuating color register 4 or the color data generated by the DDA 2c and a renewal control section 8 for controlling inhibition and allowance of renewal of the depth value in the depth buffer 6 and renewal of the color data in the color buffer 5. The plane coordinates data generated by the DDA 2x are supplied to the color buffer 5 and the depth buffer 6 through a double buffer register 51. The depth value generated by the DDA 2z in correspondance with the plane coordinates data are supplied to an input terminal of an operation amplifier 61, while the depth value read out from the depth buffer 6 through a bidirectional buffer 62 is supplied to another input terminal of the operation amplifier 61. The operation amplifier 61 judges which depth value is greater than the other depth value. One of the depth values which is determined based upon judgement conditions is again written into the depth buffer 6 through the bidirectional buffer 62. A flag indicative of the judgement result is output from the operation amplifier 61 and is supplied to an operation amplifier 71 for the color buffer 5 as a selection control flag. The color data output from the selector 7 are supplied to an input terminal of the operation amplifier 71, while the color data read out from the color buffer 5 are supplied to another input terminal of the operation amplifier 71. The operation amplifier 71 selects one of the color data based upon the selection control flag and writes the selected color data into the color buffer 5 through the bidirectional buffer 72. The processor 1 functions as a repetition control means. The processor 1 alternatively repetitively supplies necessary data to the DDAs so as to generate necessary pixel data once when polygons are ordinarily filled, while the processor 1 supplies necessary data to the DDAs so as to generate pixel data twice which are necessary for filling polygons and to generate pixel data once which are necessary for drawing edge lines when polygons are filled and drawn with accentuation of their edge lines. The renewal control section 8 controls data writing through the bidirectional buffers 62 and 72. The renewal control section 8 permits data writing through the bidirectional buffers 62 and 72 when polygons are ordinarily filled. On the other hand, the renewal control section 8 performs a control operation as follows when polygons are filled and drawn accentuating their edge lines. The renewal control section 8 inhibits data writing only through the bidirectional buffer 62 when polygons are filled for the first time and edge lines are drawn. The renewal control section 8 inhibits data writing only through the bidirectional buffer 72 when polygons are filled for the second time. Reference numerals 52 and 63 indicate double buffer registers and the reference numerals 64 and 74 indicate registers for temporalily holding data read out from the corresponding buffers 6 and 5. The operation of the apparatus having the arrangement described above is as follows. First, renewal of depth value, or writing the depth value, of the depth buffer 6 is inhibited by the renewal control section 8 and the DDAs 2x, 2z and 2c are operated to interpolate polygons which are to be filled and drawn with accentuation their edge lines. The output data (color data) from the DDA 2c which are selected by the selector 7 are written into the color buffer 5 by applying the hidden surface removing processings and without influencing the content of the depth buffer 6 because only the sequentially generated depth value are inhibited from writing into the depth buffer 6, while the hidden surface removing processings and renewal of color data are not inhibited. Then, the DDAs 2x, 2z and 2c are operated maintaining inhibition of renewal of the depth value in the depth buffer 6 and the read out data from the accentuating color register 4 instead of the output data from the DDA 2c is written into the color buffer 5, so as to fill and draw a polygon accentuating its edge line with high quality in the color buffer 5. In this condition, the contents of the depth buffer 6 are not renewed at all. Thereafter, the DDAs 2x, 2z and 2c are operated to fill and draw the polygon permitting depth value writing into the depth buffer 6 and with inhibiting color data writing into the color buffer 5. The contents of the depth buffer 6 are accordingly suited to the polygon which is to be filled and drawn with accentuation of its edge lines without influencing the contents of the color buffer 5. As is apparent from the foregoing, the apparatus can remarkably easily draw edge lines with high quality by using elements as they are which are arranged in conventional graphics display apparatus and merely arranging the operation control in a different manner than the conventional graphics display apparatus. The time period for filling and drawing the polygon which is to be accentuated in its edge lines is a little more than twice the time period for ordinary filling of the polygon. Filling and drawing of a polygon with accentuation of its edge lines is performed with remarkably high speed. Second Embodiment Figure 4 is a flowchart for a polygon filling method for accentuating the edge lines thereof as another embodiment of an illustrative drawing method according to the present invention. This method differs from the first embodiment in that step (17) for drawing edge lines with the hidden surface removing processings based upon depth buffer algorithm is added between steps (7) and (8). The edge lines of the polygon P3 is positioned rear side of the polygon P2 as shown in Fig. 2-B10. This method performs filling of the polygon P2 while inhibiting renewal of only the depth value in the depth buffer 6 after the polygons P1, P4 and P5 are filled by hidden surface removing processings as is shown in Figs. 2-B2 and 2-C2. The contents of the depth buffer 6 are not changed at all as are shown in Fig. 2-C6, while the content of the color buffer 5 are changed as are shown in Fig. 2-B6. Then the method draws the edge lines while inhibiting renewal of only the depth value in the depth buffer 6. The contents of the depth buffer 6 are not changed at all as are shown in Fig. 2-C7, while the contents of the color buffer 5 are changed as are shown in Fig. 2-B7. Then the method fills the polygon P2 again while inhibiting renewal of only the color data in the color buffer 5. The contents of the color buffer 5 are not changed at all as are shown in Fig. 2-B8, while the contents of the depth buffer 6 are changed as are shown in Fig. 2-C8. Thereafter, the method draws the edge lines while inhibiting renewal of only the color data in the color buffer 5. The contents of the color buffer 5 are not changed at all as are shown in Fig. 2-B9, while the contents of the depth buffer 6 are changed as are shown in Fig. 2-C9. After the filling and drawing of the polygon P2 which is to be filled and drawn accentuating its edge lines are finished, the polygon P3 is filled and drawn in the same manner. The display on the scope, or the content of the color buffer 5 is changed as is shown in Fig. 2-B10, while the contents of the depth buffer 6 are changed as are shown in Fig. 2-C10. The depth values are determined within the entire extent of the edge lines when the edge lines partially exist outside of the original polygon. The disadvantage can be eliminated that the quality of the edge lines be lowered due to other polygons being filled after the filling and drawing of the polygon accentuating its edge lines. The polygon filling apparatus for accentuating its edge lines shown in Fig. 3 may be arranged as follows. The processor 1 supplies necessary data to the DDAs 2x, 2z and 2c for generating necessary pixel data once when polygons are ordinarily filled. On the other hand, the processor 1 supplies necessary data to the DDAs 2x, 2z and 2c for generating pixel data which are necessary for filling the polygon and pixel data which are necessary for drawing the edge lines twice when polygons are filled and drawn with accentuation of their edge lines. The renewal control section 8 permits data writing into the color buffer 5 and the depth buffer 6 through the bidirectional buffers 62 and 72 when polygons are ordinarily filled. On the other hand, the renewal control section 8 performs the control operation as follows when polygons are filled and drawn with accentuating their edge lines. The renewal control section 8 inhibits data writing only through the bidirectional buffer 62 when polygons are filled for the first time and edge lines are drawn. The renewal control section 8 inhibits data writing only through the bidirectional buffer 72 when polygons are filled for the second time and edge lines are drawn. When this arrangement is employed, filling and drawing of polygons with accentuation of their edge lines are performed with high quality with the polygon filling method shown in Fig. 4. In each embodiment, the description is made for the case that polygons are filled and drawn with accentuation of their edge lines. Hidden line removing processings for a wire frame model are easily performed with high quality by filling polygons with background color. It is possible for an arbitrary line segment to be drawn inside of a polygon instead of edge lines. It is also possible that for arbitrary polygon to be drawn inside of a polygon. The terms and expressions which have been employed here are used as terms of description and not of limitations, and there is no intention, in the use of such terms and expressions of excluding equvalents of the features shown and described, or portions thereof, it being recognized that various modifications are possible within the scope of the invention as claimed.

Claims: A method of drawing a polygon, comprising the steps of: generating color data and interpolating depth data for a polygon of a three dimensional object in correspondence with scanning lines along which the polygon is filled; filling the polygon by applying a hidden surface removing process based upon a depth buffer algorithm, whereby writing of the colour data to a colour buffer (5) is allowed and updating of depth data in a depth buffer (6) is inhibited; generating color data and interpolating depth data for a line segment in correspondence with the direction of the line segment; drawing the line segment by applying said hidden surface removing process, whereby writing of the colour data of the line segment to the colour buffer (5) is allowed and updating of the depth buffer (6) is inhibited, the line segment being inside of the polygon or an edge line thereof; and filling the polygon again by applying said hidden surface removing process, whereby writing of colour data to the colour buffer (5) is inhibited and updating of the depth buffer (6) is allowed, thereby ensuring consistent depth values for the line segment and fill colour. The method as set forth in claim 1, further comprising the step of drawing the line segment again by applying said hidden surface removing process, whereby writing of said hidden surface removing process, whereby writing of the colour data of the line segment to the colour buffer (5) is inhibited and updating of the depth buffer (6) is allowed. The method as set forth in claim 1 or 2, wherein the line segment is accentuated with respect to the fill colour. The method as set forth in one of claims 1 to 3, wherein said line segment is an edge line of said polygon, or a further polygon inside said polygon. A polygon drawing apparatus comprising; pixel data generating means (1) for individually outputting first pixel data for filling polygons which represent a three dimensional object and second pixel data for drawing a first line segment; linear interpolation means (2x, 2z) for interpolating three dimensional coordinates data of a second line segment which constitutes the polygon and the first line segment based upon the three dimensional coordinates data included in each pixel data of edge points of the polygon and in each pixel data of edge points of the first line segment; color data generating means (2c) for generating color data included in each pixel data corresponding to the three dimensional coordinates data of the polygon sequentially generated by said linear interpolation means (2x, 2z); a depth buffer (6) for holding depth data included in the three dimensional coordinates data output from said linear interpolation means (2z); a color buffer (5) for holding the color data output from said color data generating means (2c); repetition control means (1) for controlling said pixel data generating means (1) to repeat outputting of each pixel data; and renewal control means (8) for selectively inhibiting renewal of the depth data and renewal of the color data corresponding to the number of times of the repetition of controlling by said repetition control means (1), characterized in that said renewal control means (8) allows writing of the colour data to said colour buffer (5) and inhibits updating of depth data in said depth buffer (6) when the polygon is filled by applying a hidden surface removing process based on a depth buffer algorithm, that said renewal control means (8) allows writing of the colour data of said first line segment to the colour buffer (5) and inhibits updating of said depth buffer (6) when said first line segment is drawn, and that said renewal control means (8) inhibits writing colour data to said colour buffer (5) and allows updating of said depth buffer (6) when the polygon is filled again by applying said hidden surface removing process.

Inventors: OBATA KOEI, OBATA, KOEI, OBATA, KOEI, DAIKIN HIGASHIKUSATSU SHATAKU 4-207
Applicants: DAIKIN IND LTD, DAIKIN INDUSTRIES, LIMITED
Application year: 1991
Main classification: G06T15
IPC codes: G06T15, G06T11, G09G5