A shading method and shading apparatus for computer graphics

Abstract: A shading method and apparatus for computer graphics for approximating a curved surface with a plurality of polygons, inputting values to vertexes of the plurality of polygons and obtaining values inside the plurality of polygons with the input values for each vertex of the plurality of polygons by means of linear interpolation. A compensating computation (3, 4; 20, 21) in the vertical direction against the value of each vertex value so as to compute the value at the end point of a scan line is conducted. A compensating computation (6; 23) in the horizontal direction against the values of the end point of the scan line so as to compute the value at a start point on a coordinate grid point is conducted. A variation (1, 2, 5) to the value of the start point is added so as to obtain the value on each coordinate gridpoint.

Description: The present invention relates to a shading method and shading apparatus for computer graphics according to claim 1 and 4, respectively, which are used for shading a three-dimensional object which is displayed on a two-dimensional display. In computer graphics, when a three-dimensional object is displayed on a two-dimensional display, the surface of the three-dimensional object is shaded so as to improve the reality and visiibility of the three-dimensional object. The method for shading the surface of a three-dimensional obfect is named shading. For example, a shading display method is used, where the position of a point light source is determined, the surface perpendiculaar to the point light source becoming bright, the brightness of the surface being proportional to the perpendicularity to the point light source. The three-dimensional object displayed on the two-dimensional display has a complicated curved surface. To naturally and optimally shade the three-dimensional object with the complicated curved surface according to the shape therof, a method for approximating the curved surface with a plurality of polygons, inputting values of vertex coordinates of the polygons and, obtaining velues inside the polygons with the values given to the vertex coordinates by means of linear interpolation is used. The linear interpolation is conducted by using DDA (digital differential analyzer) computation where the variation of each interval of the coordinate grids is successively added (for example, as disclosed in Japanese Patent Laid-Open Publication No. Sho 61-52737). To display a three-dimensional object on a two-dimensional display, pixels are provided on the coordinate grid points. Values (depth values and brightness values) according to the pixels are input. As was described above, in the method for approximating a curved surface with a plurality of polygons, inputting values of vertex coordinates of each polygon, and obtaining values inside each polygon by means of the linear interpolation, the coordinates of each vertex may deviate from a coordinate grid point. However, thus far, values cannot be input to any coordinates other than coordinate grid points. To prevent that, when the coordinates of vertexes of polygons obtained by approximating a curved surface deviate from the coordinate grid points, the values of the coordinates of vertexes of the polygons are treated as the values on the coordinate grid points nearest to the coordinates. In this case, values of the coordinates close to the coordinate grid points are input to pixels at the coordinate grid points rather than inputting correct values to pixels at the coordinate grid points. Thus, when the three-dimensional object is moved or deformed or the light source is moved, the image flickers in the accuracy of one pixel. Thus far, in a method for approximating a curved surface with a plurality of polygons, inputting values of vertex coordinates of the polygon, and obtaining values inside each polygon with the input values for each vertex coordinates by means of the linear interpolation, the curved surface is approximated by a particular polygon such as a trapezoid or a triangle. When a curved surface is approximated with any polygon, a memory with a large amount of capacity is required. In other words, to process any polygon, the memory should store values of vertexes of the polygon at the same time. Thus, to process a polygon where the number of vertexes is umlimited, infinite memory capacity is required. However, when a curved surface is approximated with a particular polygon such as a trapezoid or a triangle, the drawing efficiency becomes bad. Thus, when a curved surface could be approximated with any polygon, the drawing efficiency would be improved and a complicated curved surface would be optimal shaded in real time bases. From EP-A2-319 787 a method is known for utilizing a so called SIMD computer architecture in conjunction with a host processor and coordinate processor to render quality, three-dimensional, anti-aliased shaded color images into the frame buffer of a video display system. The method includes a parallel algorithm for rendering an important graphic primitive for accomplishing the production of a smoothly shaded colour three-dimensional triangle with anti-aliased edges. By taking advantage of the SIMD architecture and said parallel algorithm, the very time consuming pixel by pixel computations are broken down for parallel execution. From "James D. Foley et al: Fundamentals of Interactive Computer Graphics", Addison-Wesley 1984, pages 580 to 584, a shading method according to the preamble of claim 1 is known. From said document an intensity interpolation shading method (Gourand shading) is known consisting of four steps: First, surface normals are calculated. Second, the object normals are calculated by averaging the surface normals of all polygonal facets that share the vertex. Third, vertex intensities are found by using the vertex normals with any desired shading model. Finally, each polygon is shaded by linear interpolation of vertex intensities along each edge. It is the object of the present invention to improve the continuity of the patch. According to an embodiment of the present invention, when a trapezoid whose length in the vertical direction is smaller than 1 is processed, a side whose length is long, resulting in an overflow of the divider is replaced with a vertical side whose start point is the same as the former. Thus, it is possible to prevent the divider from getting overflowed. In addition, the continuity of the patch is improved. Said object is achieved by means of a method and an apparatus according to claim 1 and 4, respectively. The above and other objects, features and advantages of the present invention will become readily apparent from the following detailed description which is to be read in connection with the accompanying drawings. Fig. 1 is a schematic diagram describing a compensating computation; Fig. 2 is a block diagram of a DDA computation circuit with compensating computation function of the invention; Fig. 3 is a block diagram describing the DDA computation circuit with compensating computation function in Fig. 2; Fig. 4 is a schematic diagram describing a multiplication algorithm by the DDA computation circuit with compensating computation function; Fig. 5 is a schematic diagram describing a shading; Fig. 6 is a flow chart describing the embodiment of the present invention; Figs. 7 and 8 are schematic diagrams describing a process of any polygon in the embodiment of the present invention; Figs. 9 and 10 are schematic diagrams describing a process against a large computation error in the embodiment of the present invention; Fig. 11 is a block diagram showing an embodiment of the present invention; Fig. 12 is a block diagram of the parallel process status transition circuit according to the present invention; Fig. 13 is a block diagram of a wait circuit; Fig. 14 is a timing chart describing an example of the wait circuit; Fig. 15 is a block diagram of a jump circuit; Fig. 16 is a block diagram of a join circuit; and Fig. 17 is a block diagram of a delay circuit. An embodiment of the present invention will be described in the following order. a. Outline of a known shading method b. Compensating computation b1. Theory of compensating computation b2. DDA computation circuit with compensating computation function c. Description of shading method c1. Computations necessary for the process c2. Drawing procedure c3. Extension to any polygon c4. Process in the case where large computation error takes place d. Shading apparatus d1. Structure of shading apparatus d2. Computation accuracy and number of bits e. Parallel process status transition circuit e1. Description of basic circuits e2. Parallel process status transition circuit for shading process a. Outline of a known shading method The present invention relates to a process for approximating a curved surface with a plurality of polygons, inputting values to vertex coordinates of each polygon, and obtaining values inside the polygons with the values for the vertex coordinates by means of linear interpolation so as to naturally accomplish shading according to the shape of the curved surface. In the process for approximating a curved surface with a plurality of polygons, inputting values of vertex coordinates of each polygon, and obtaining values inside the polygons by means of linear interpolation, the coordinates of each vertex may deviate from a coordinate grid point. In an embodiment of the present invention, by inputting the integer part of a horizontal value X and vertical value Y, values can be input between coordinate grid points where there is no pixel. This process is named hereinafter subpixel addressing. Thus, even if the coordinates of vertexes of polygons obtained in the approximation of the curved surface deviate from the coordinate grid points, values according to the vertex coordinates (horizontal value X and vertical value Y) (depth value Z and brightness values R (red), G (green), and B (blue)) can be input. According to the present invention, the subpixel addressing is conducted. After that, a compensating computation is executed. Thus, an accurate pixel value at a coordinate grid point at the start point of the DDA computation of each scan line can be obtained. After that, the DDA computation is repeated so as to obtain the pixel value on each coordinate grid point. In other words, for the primitive of a trapezoid obtained by approximating the curved surface, vertical compensating computations on the left and right sides are executed. The value of the left end of a scan line (since the scanning operation is executed from the left to the right, the left end of the scan line accords with its start point) and the value of the right end of the scan line (the right end of the scan line accords with its end point) are obtained. With the left end value and the right end value of the scan line, by means of the compensating computation in the horizontal direction, the accurate pixel value at the start point at a coordinate grid point close to the left end of the scan line can be obtained. By repeating the DDA computation in the horizontal direction where variations in the horizontal direction are added to the pixel value at the start point, accurate pixel values on coordinate grid points of each scan line can be obtained. The value at the left end of the next scan line is obtained by means of the DDA computation in the vertical direction where a variation in the vertical direction on the left side is added to the value at the left end of the preceding scan line. Likewise, the value at the right end of the next scan line is obtained by means of DDA computation in the vertical direction where a variation in the vertical direction on the right side is added to the value at the right end of the preceding scan line. In this case, since the accurate pixel values at the coordinate grid points have been input, high accuracy shading is accomplished in accordance with the motions of a three-dimensional object and a light source on real time basis without flickering of the screen. In approximating a curved surface with a plurality of polygons, when it could be approximated by any polygon, the drawing efficiency would be improved. In this embodiment of the present invention, only when a vertex of the left side and that of the right side are on the same horizontal line, the value of the vertex of the left side and that of the right side are input at the same time. If the value of only one vertex is input, the value of other vertex is treated as null value. In this case, the former DDA computation is used. Thus, the computation for a trapezoid can be extended to any polygon. b. Compensating computation b1. Theory of compensating computation In the embodiment of the present invention, as was described above, by conducting the compensating computations in the vertical direction on the left side and the right side, the values of the end points of a scan line are obtained. By conducting the compensating computation in the horizontal direction, the accurate pixel value on a coordinate grid point at the start point is obtained. After that, by repeating the DDA computations in the vertical direction on the left and right sides and that in the horizontal direction, the pixel value on each coordinate grid point is obtained. Then, the compensating computation will be described before discussing the shading process. As shown in Fig. 1, assuming that values A(V) and B(V) are given to points A and B and these values linearly vary, we obtain value R(V) at point R between the points A and B. In this case, when these values linearly vary, the value R(V) at the point R between the points A and B can be obtained by means of linear interpolation. In other words, the value R(V) at the point R between the points A and B can be obtained by the following equation. R(V) = A(V)(B - R) + B(V)(R - A) B - A In the case of such linear interpolation, multiplication and division should be executed once and twice, respectively. As the number of times of multiplication and division increases, large circuit and long computing time are required. Thus, the above equation is transformed as follows. R(V) = A(V) + (R - A) x B(V) - A(V) B - A In the above equation, the term of B(V) - A(V) B - A = DD is a variation DD. Thus, the value R(V) at the point R between the points A and B can be obtained by the following equation. R(V) = A(V) + (R - A) x DD In approximating a curved surface with a plurality of polygons and obtaining values in each polygon by means of the linear interpolation so as to conduct a shading, the variation DD for conducting the DDA computation has been obtained in advance. Thus, when the compensating computation is transformed into the above equation, the compensating computation can be accomplished by only one time of multiplication. In the compensating computation process, part of a DDA computation circuit can be used. The DDA computation circuit with compensating computation function will be described in the following. b2. DDA computation circuit with compensating computation function In the compensating computation process, as was described above, the product of the distance (R - A) from initial position A to compensation position R and the variation DD is added to the value A(V) at the initial position. This process can be accomplished by a DDA computation circuit with compensating computation function as shown in Fig. 2. The DDA computation circuit with compensating computation function can be set in three modes. One mode is a compensation value computing mode for obtaining a compensation value. In the compensation value computing mode, the distance to the compensation position being input from an input terminal 30 is multiplied by the variation DD being input from an input terminal 33. Thus, the following computation is conducted. (R - A) x DD In the multiplication, the distance (R - A) to the compensation position is given as serial data from the least significant bit. Each bit of the distance (R - A) to the compensation position is multiplied by the variation DD and then shifted to the right. The resultant product is added bit by bit. In the second mode, the compensation value is added to the value at the initial position so as to obtain the compensated value. Thus, the following computation is conducted and then the value R(V) at the point R is obtained. A(V) + (R - A) x DD In the third mode, the DDA computation is conducted. In the DDA computation, the process for adding the variation DD to the former value is repeated. In Fig. 2, the value A(V) at the initial position is input from an input terminal 32 to one of input terminals of a multiplexer 31. The variation DD being input from the input terminal 33 is supplied to the other terminal of the multiplexer 31. The value A(V) at the initial position from the input terminal 32 and the variation DD from the input terminal 33 are input as parallel data. An output of the multiplexer 31 is supplied to a zero determination circuit 34. The distance (R - A) to the compensation position is supplied from the input terminal 30 as serial data starting with the least significant bit. The zero determination circuit 34 is used to multiply the distance (R - A) to the compensation position by the variation DD in the compensation value computing mode. As shown in Fig. 2, the zero determination circuit 34 is composed of AND gates 41 1 , 42 2 , 42 3 , ..., and 42 n . Each of output data bit of the multiplexer 31 is supplied to one of input terminals of each of the AND gates 42 1 , 42 2 , 42 3 , ..., and 42 n . Serial data from the input terminal 30 is supplied to the other input terminal of each of the AND gates 42 1 , 42 2 , 42 3 , ..., and 42 n . In Fig. 2, an output of the zero determination circuit 34 is supplied to an adder 35. An output of the adder 35 is supplied to a latch circuit 36. A DDA clock DDA CK is supplied from a clock input terminal 39 to the latch circuit 36. In addition, a reset signal RST is supplied from a reset terminal 40 to the latch circuit 36. An output of the latch circuit 36 is withdrawn from an output terminal 37. Moreover, the output of the latch circuit 36 is also supplied to a multiplexer 38. An compensation loop signal AJL is supplied from an input terminal 41 to the multiplexer 38. When the compensation loop signal AJL is supplied from the input terminal 41 to the multiplexer 38, the output of the latch circuit 36 is shifted bit by bit to the right in accordance with each clock and then output to the multiplexer 38. An output of the multiplexer 38 is supplied to the adder 35. First, the reset signal RST is supplied from the input terminal 40 to the latch circuit 36. This reset signal RST causes the latch circuit 36 to be reset. Then, the compensation value computing mode takes place, where the compensation value is obtained. In the compensation value computing mode, the multiplexer 31 selects the variation DD from the input terminal 33. The variation DD is supplied from the multiplexer 31 to the zero determination circuit 34 as parallel data. The distance (R - A) to the compensation position is supplied from the input terminal 30 to the zero determination circuit 34 as serial data starting with the least significant bit. In the zero determination circuit 34, the distance (R - A) to the compensation position is multiplied by the variation DD bit by bit. When one bit of the distance (R - A) to the compensation position is "1", since "1" is multiplied to the variation DD, the variation DD is output through the zero determination circuit 34 as it is. Conversely, when one bit of the distance (R - A) to the compensation position is "0", since "0" is multiplied to the variation DD, "00 ... 0" is output from the zero determination circuit 34. The output of the adder 35 is supplied to the multiplexer 38 through the latch circuit 36. The compensation loop signal AJL is supplied from the input terminal 41 to the multiplexer 38. Thus, the output of the adder 35 is shifted bit by bit to the right by the multiplexer 38 and then supplied to the adder 35. The resultant data is accumulated in the latch circuit 36. By repeating such addition, multiplication of the distance (R - A) to the compensation position by the variation DD is conducted. In other words, when assuming that the variation DD is 4-bit data "d 3 , d 2 , d 1 , d 0 " and the distance (R - A) to the compensation position is 4-bit data "a 3 , a 2 , a 1 , a 0 ", the multiplication of the distance (R - A) to the compensation position by the variation DD is conducted as shown in Fig. 4. First, the least significant bit "a 0 " of the distance (R - A) to the compensation position is supplied to the zero determination circuit 34. Then, the least significant bit "a 0 " is multiplied by "d 3 , d 2 , d 1 , d 0 " and thereby "a 0 d 3 , a 0 d 2 , a 0 d 1 , a 0 d 0 " is obtained. Then, the low order second bit "a 1 " of the distance (R - A) to the compensation position is supplied. After that, the low order second bit "a 1 " is multiplied by "d 3 , d 2 , d 1 , d 0 " and thereby "a 1 d 3 , a 1 d 2 , a 1 d 1 , a 1 d 0 " is obtained. "a 1 d 3 , a 1 d 2 , a 1 d 1 , a 1 d 0 " is added to "a 0 d 3 , a 0 d 2 , a 0 d 1 , a 0 d 0 " which was shifted by 1 bit to the right. Likewise, "a 2 d 3 , a 2 d 2 , a 2 d 1 , a 2 d 0 " and "a 3 d 3 , a 3 d 2 , a 3 d 1 , a 3 d 0 " are obtained, shifted by 1 bit to the right and then added. Thus, multiplication of "d 3 , d 2 , d 1 , d 0 " by "a 3 , a 2 , a 1 , a 0 " is conducted and then product "c 7 , c 6 , c 5 , c 4 , c 3 , c 2 , c 1 , c 0 " is obtained. In Fig. 2, the compensation value ((R - A) DD) obtained in the aforementioned manner is stored in the latch circuit 36. After the compensation value ((R - A) DD) is stored in the latch circuit 36, a mode for adding the compensation value ((R - A) DD) to the value A(V) at the initial position and for obtaining a compensated value takes place. In this mode, the value A(V) at the initial position from the input terminal 32 is output from the multiplexer 31. The value A(V) is supplied to the adder 35 through the zero determination circuit 34. In the latch circuit 36, the compensation value ((R - A) DD) obtained in the compensation value computing mode is stored. The compensation value ((R - A) DD) is supplied to the adder 35 through the multiplexer 38. In the adder 35, the compensation value ((R - A) DD) is added to the value A(V) at the initial position and then the resultant value is stored in the latch circuit 36. When the value (A(V) + (R - A) DD) where the compensation value ((R - A) DD) was added to the value A(V) is stored in the latch circuit 36, the DDA mode takes place. In the DDA mode, the variation DD from the input terminal 33 is output from the multiplexer 31. The variation DD is supplied to the adder 35 through the zero determination circuit 34. In the adder 35, the former value stored in the latch circuit 36 is added to the variation DD and then the resultant value is stored in the latch circuit 36. The computation for adding the variation DD is repeated. c. Description of shading method Then, the shading method according to the present invention will be described in the following. Now, assume that a trapezoid as shown in Fig. 5 is obtained as one primitive in approximating a curved surface with a plurality of polygons. In Fig. 5, intersections of vertical dot lines and horizontal dot lines are coordinate grids. On the coordinate grid points, there are pixels. The distance between two vertical or horizontal coordinate grids is 1. By inputting values of vertexes LS, LE, RS, and RE of the trapezoid (horizontal value X, vertical value Y, depth value Z, brightness value R (red value), G (green value), and B (blue value)), the pixel values at the coordinate grid points of the trapezoid are obtained by means of the linear interpolation. c1. Computations necessary for the process In the aforementioned shading process, the following computations are conducted. Computation of variation in vertical direction on left side (equation (11)) Computation of variation in vertical direction on right side (equation (12)) Compensating computation in vertical direction on left side (equation (13)) Compensating computation in vertical direction on right side (equation (14)) DDA computation in vertical direction on left side (equation (55)) DDA computation in vertical direction on right side (equation (16)) Computation of variation in horizontal direction (equation (17)) Compensating computation in horizontal direction (equation (18)) DDA computation in horizontal direction (equation (19)) Computation of variation in vertical direction on left side First, the computation in the vertical direction will be described. A variation DL(X, Z, R, G, B) of each value between two coordinate grid points in the vertical direction on the left side is given by the following equation. DL(X, Z, R, G, B) = LE(X, Z, R, G, B) - LS(X, Z, R, G, B) LE(Y) - LS(Y) where LS(X, Y) : Horizontal value X and vertical value Y at upper left vertex LS, LS(Z) : Depth value Z at upper left vertex LS, LS(R, G, B) : Brightness values R, G, and B at upper left vertex LS, LE(X, Y) : Horizontal value X and vertical value Y at lower left vertex LE, LE(Z) : Depth value Z at lower left vertex LE, and LE(R, G, B) : Brightness values R, G, and B at lower left vertex LE. Computation of variation in vertical direction on right side Likewise, a variation DR(X, Z, R, G, B) between two coordinate grids in the vertical direction on the right side is obtained by the following equation, DR(X, Z, R, G, B) = RE(X, Z, R, G, B) - RS(X, Z, R, G, B) RE(Y) - RS(Y) where RS(X, Y) : Horizontal value X and vertical value Y at upper right vertex RS, RS(Z): Depth value Z at upper right vertex RS, RS(R, G, B) : Brightness values R, G, and B at upper right vertex RS, RE(X, Y) : Horizontal value X and vertical value Y at lower right vertex RS, RE(Z) : Depth value Z at lower right vertex RE, and RE(R, G, B) : Brightness values R, G, and B at lower right vertex RE. DDA computation in vertical direction on left side When the subpixel addressing is conducted, since the distance between two vertical pixels or two horizontal pixels is 1, the distance from the upper left vertex LS to the nearest scan line y 0 is obtained as follows. 1 - (LS(Y) - Int(LS(Y)) where Int is a computation for setting the decimal part to 0. (In other words, (LS(Y) - Int(LS(Y))) allows the decimal part of the vertical value Y of the vertex LS to be obtained.)Thus, the value HS 0 (X, Z, R, G, B) at the left end of the scan line y 0 is obtained by the following equation. HS 0 (X, Z, R, G, B) = LS(X, Z, R, G, B) + (1 - (LS(Y) - Int(LS(Y))) x DL(X, Z, R, G, B) This equation is used to conduct the compensating computation in the vertical direction on the left side. The compensating computation is obtained in the same manner as the aforementioned equation (2). Compensating computation in vertical direction on right side Likewise, the value HE 0 (X, Z, R, G, B) at the right end of the scan line y 0 is obtained by the following equation. HE 0 (X, Z, R, G, B) = RS(X, Z, R, G, B) + (1 - (RS(Y) - Int(RS(Y))) x DR(X, Z, R, G, B) This equation is used to conduct the compensating computation in the vertical direction on the right side. DDA computation in vertical direction on left side The value HS j+1 (X, Z, R, G, B) at the left end of the next scan line y j+1 is obtained by means of the DDA computation in the vertical direction on the left side where the value HS j (X, Z, R, G, B) at the left end of the previous scan line y j is added to the variation DL(X, Z, R, G, B) in the vertical direction on the left side. In other words, the value HS j+1 (X, Z, R, G, B) at the left end of the next scan line y j+1 is obtained by the following equation. HS j+1 (X, Z, R, G, B) = HS j (X, Z, R, G, B) + DL(X, Z, R, G, B) DDA computation in vertical direction on right side Likewise, the value HE j+1 at the right end of the next scan line y j+1 is obtained by means of the DDA computation in the vertical direction on the right side. In other words, the value HE j+1 (X, Z, R, G, B) at the right end of the scan line y j+1 is obtained by the following equation. HE j+1 (X, Z, R, G, B) = HE j (X, Z, R, G, B) + DR(X, Z, R, G, B) Computation of variation in horizontal direction Then, the computation in the horizontal direction will be described. The variation DH j (Z, R, G, B) of each value between two coordinate grids in the horizontal direction of the scan line y j is obtained by the following equation along with the value HS j (X, Z, R, G, B) at the left end of the scan line y j (obtained by the equations (3) and (5)) and the value HE j (X, Z, R, G, B) at the right end of the scan line y j (obtained by the equations (14) and (16)). DH j (Z, R, G, B) = HE j (Z, R, G, B) - HS j (Z, R, G, B) HE j (X) - HS j (X) Compensating computation in horizontal direction The pixel value H j0 (Z, R, G, B) on a coordinate grid point close to the left end of the scan line y j is obtained by the following equation along with the value HS j (Z, R, G, B) at the left end of the scan line y j and the variation DH j (Z, R, G, B) in the horizontal direction. H j0 (Z, R, G, B) = HS j (Z, R, G, B) + (1 - (HS j (X) - Int(HS j (X)) x DH j (Z, R, G, B) This equation is used to conduct the compensating computation in the horizontal direction. The term H j0 (Z, R, G, B) is the value at the start point of the scan line y j . DDA computation in horizontal direction Values at the coordinate grid points following the start point of the scan line y j can be successively obtained by repeating the DDA computation in the horizontal direction. In other words, the value H ji+1 (Z, R, G, B) at the coordinate grid points of the scan line y j can be obtained by the following equation. H ji+1 (Z, R, G, B) = H ji (Z, R, G, B) + DH j (Z, R, G, B) C2. Drawing procedure By referring to Fig. 6, a drawing procedure of the shading method according to an embodiment of the present invention will be described in the following. First, according to the equation (11), the variation DL(X, Z, R, G, B) in the vertical direction on the left side, where the vertex LS and the vertex LE are connected, is obtained (in step 1). On the other hand, according to the equation (12), the variation DR(X, Z, R, G, B) in the vertical direction on the right side, where the vertex RS and the vertex RE are connected, is obtained (in step 2). Then, according to the equation (13), the compensating computation in the vertical direction on the left side is conducted and thereby the value HS 0 (X, Z, R, G, B) at the left end of the first scan line y 0 is obtained (in step 3). On the other hand, according to the equation (14), the compensating computation in the vertical direction on the right side is conducted and thereby the value HE 0 (X, Z, R, G, B) at the right end of the first scan line y 0 is obtained (in step 4). The steps 3 and 4 can be conducted in parallel. After the value HS 0 (X, Z, R, G, B) at the left end of the first scan line y 0 and the value HE 0 (X, Z, R, G, B) at the right end thereof are obtained in the steps 3 and 4, the variation DH 0 (Z, R, G, B) in the horizontal direction of the first scan line y 0 is obtained in accordance with the equation (17) (in step 5). According to the equation (18), the compensating computation in the horizontal direction of the first scan line y 0 is conducted and thereby the value H 00 (Z, R, G, B) of a coordinate grid point close to the left end of the first scan line y 0 is obtained (in step 6). After the value H 00 (Z, R, G, B) at the start point of the scan line y 0 is obtained, the DDA computation, where the variation DH 0 (Z, R, G, B) in the horizontal direction of the scan line y 0 is added, is repeated (in step 7). Thus, the values H 01 (X, Z, R, G, B), H 02 (X, Z, R, G, B), ... and so on of the coordinate grid points following the start point are successively obtained. After all the values H 00 (X, Z, R, G, B), H 01 (X, Z, R, G, B), H 02 (X, Z, R, G, B) ... and so on at the coordinate grid points of the scan line y 0 are obtained, by means of the DDA computation in the vertical direction on the left side in accordance with the equation (15), the value HS 1 (X, Z, R, G, B) at the left end of the next scan line y 1 is obtained (in step 8). On the other hand, by means of the DDA computation in the vertical direction on the right side according to the equation (16), the value HE 1 (X, Z, R, G, B) at the right end of the next scan line y 1 is obtained (in step 9). After the value HS 1 (X, Z, R, G, B) at the left end of the scan line y 1 and the value HE 1 (X, Z, R, G, B) at the right end thereof are obtained, the flow is returned back to the step 5. In the step 5, the variation DH 1 (X, Z, R, G, B) in the horizontal direction of the first scan line y 1 is obtained (in the step 5). In the step 6, according to the equation (18), the compensating computation of the next scan line y 1 is conducted and thereby the value H 10 (X, Z, R, G, B) at the start point at the coordinate grid of the first scan line y 1 is obtained. In the step 7, by repeating the DDA computation in the horizontal direction according to the equation (19), the values H 10 (X, Z, R, G, B), H 11 (X, Z, R, G, B), ... and so on at the coordinate grids of the scan line yl are successively obtained. After all the values H 10 (X, Z, R, G, B), H 11 (X, Z, R, G, B), H 12 (X, Z, R, G, B), ... and so on at the coordinate grids of the scan line y 1 are obtained, by means of the DDA computation in the vertical direction on the left side according to the equation (15), the value HS 2 (X, Z, R, G, B) at the left end of the next scan line y 2 is obtained (in the step 8). On the other hand, by means of the DDA computation in the vertical direction on the right side according to the equation (16), the value HE 2 (X, Z, R, G, B) at the right end of the next scan line y 2 is obtained (in the step 9). Then, the flow is returned back to the step 5 and the same process is repeated. C3. Extension to any polygon In this embodiment of the present invention, only when the vertex of the left side and that of the right side are on the same horizontal line, the vertex values on the left side and the right side are input at the same time. If the value of one vertex is input, the value of other vertex is treated as null. In this case, the former DDA computation is continuously used. Thus, the computation for a trapezoid can be extended to any polygon. For example, assume that a convex polygon as shown in Fig. 7 is given. The figure being given is treated as a trapezoid. While considering the sides of the trapezoid and designating the upper left vertex, the lower left vertex, the upper right vertex, and the lower right vertex to LS, LE, RS, and RE, respectively, values are input to the vertexes. On the line L1, the value of vertex A1 is input to the upper left vertex LS; the value of vertex A3 is input to the lower left vertex LE; the value of vertex A1 is input to the upper right vertex RS; and the value of vertex A2 is input to the lower right vertex RE. On the line L2, the vertex A2 on the right side is found. On the line L2, the value of the vertex A2 is input to the upper right vertex RS; and the value of the vertex A5 is input to the lower right vertex RE. On the same horizontal line as the vertex A2, no vertex is present on the left side. Thus, the left side is treated as null. On the line L3, the vertex A3 is found. On the line L3, the value of the vertex A3 is input to the upper left vertex LS; and the value of the vertex A4 is input to the lower left vertex LE. On the same horizontal line as the vertex A3, since no vertex is present on the right side, the right side is treated as null. On the line L4, the vertex A4 on the left side is found. On the line L4, the value of the vertex A4 is input to the upper left vertex LS; and the value of the vertex A6 is input to the lower left vertex LE. On the same horizontal line as the vertex A4, since no vertex is present on the right side, the right side is treated as null. On the line L5, the vertex A5 on the right side is found. On the line L5, the value of the vertex A5 is input to the upper right vertex RS; and the value of the vertex A8 is input to the lower right vertex RE. On the same horizontal line as the vertex A5, since no vertex is present on the left side, the left side is treated as null. On the line L6, the vertex A6 on the left side is found. On the line L6, the value of the vertex A6 is input to the upper left vertex LS; and the value of the vertex A7 is input to the lower left vertex LE. On the same horizontal line as the vertex A6, no vertex is present on the right side, the right side is treated as null. On the line L7, the vertex A7 on the left side is found. On the line L7, the value of the vertex A7 is input to the upper left vertex LS; and the value of the vertex A8 is input to the lower left vertex LE. On the same horizontal line as the vertex A7, since no vertex is present on the right side, the right side is treated as null. Thus, only when a vertex on the left side and a vertex on the right side are present on the same horizontal line, the vertex values on the left side and the right side are input at the same time. If the value of one vertex is input, the value of the other vertex is treated as null and then the former DDA computation is continuously used. Consequently, the computation for a trapezoid can be extended to any polygon without an increase of the memory capacity. In other words, on the lines between the lines L1 and L2, by using the values of the vertexes A1 and A3, the variation in the vertical direction on the left side is obtained and the compensating computation in the vertical direction on the left side is conducted. In addition, by using the values of the vertexes A1 and A2, the variation in the vertical direction on the right side is obtained and the compensating computation in the vertical direction on the right side is conducted. Then, the values at the left end and the right end of each scan line are obtained. By using the resultant values, the variation in the horizontal direction is obtained. Then, the compensating computation in the horizontal direction is conducted and the value at the start point is obtained. By means of the DDA computation in the horizontal direction, the pixel values at the coordinate grid points on the scan lines between the lines L1 and L2 are obtained. On the lines between the lines L2 and L3, on the left side, the former variation in the vertical direction on the left side is continuously used. By means of the DDA computation in the vertical direction on the left side, the value at the left end on the scan line is obtained. On the right side, by using the values of the vertexes A2 and A5, the variation on the right side is obtained and the compensating computation on the right side is conducted. Then, the value at the right end on the scan line is obtained. Thereby, the variation in the horizontal direction is obtained. After that, the compensating computation in the horizontal direction is conducted and the value at the start point is obtained. By means of the DDA computation in the horizontal direction, the pixel values on the coordinate grid points on the scan lines between the lines L2 and L3 are obtained. Likewise, on the lines between the lines L3 and L4, on the left side, by using the values of the vertexes A3 and A4, the variation in the vertical direction on the left side is obtained. On the right side, the former variation is continuously used. On the lines between the lines L4 and L5, on the left side, by using the values of the vertexes A4 and A6, the variation in the vertical direction on the left side is obtained. On the right side, the former variation is continuously used. On the lines between the lines L5 and L6, on the left side, the former variation is continuously used. On the right side, by using the values of the vertexes A5 and A8, the variation in the vertical direction on the right side is obtained. On the lines between the lines L6 and L7, on the left side, by using the values of the vertexes A6 and A7, the variation in the vertical direction on the left side is obtained. On the right side, the former variation is continuously used. On the lines between the lines L7 and L8, on the left side, by using the values of the vertexes A7 and A8, the variation in the vertical direction on the left side is obtained. On the right side, the former variation is continuously used. By processing any polygon in the aforementioned manner, the compensating computation is conducted only for the vertexes rather than the line sections. Thus, continuity of the figure is improved. In other words, when a curved surface is approximated by polygons, if patch 45 and patch 46 are placed as shown in Fig. 8. To process the patches by using predetermined polygons, it is necessary to divide the patch 46 into patch 46A and patch 46B. At that time, a computation error may occur at a connected portion 47 among the patch 46A, the patch 46B, and the patch 45. As described above, when any polygon is processed, no gap takes place between the line sections and the connected portion of each patch. Because, any non-vertex portion is treated as null and the former DDA computation is continuously used. c4. Process in the case where large computation error takes place In the case where the length in the vertical direction of a trapezoid obtained by approximating a curved surface is less than 1, when the variation in the vertical direction is obtained, division is conducted by using a divisor of a value close to 0. Thus, there is a high possibility where the divider gets overflowed. When a patch is displayed by using overflowed values, it is disordered. To prevent that, it is possible to ignore a patch where the length in the vertical direction is close to 0. However, when a patch where the length in the vertical direction is close to 0 is ignored, it is necessary to consider a problem with respect to the continuity of the patch. In an embodiment of the present invention, when a trapezoid whose length in the vertical direction is smaller than 1 is processed, a side whose length is long, resulting in an overflow of the divider is replaced with a vertical side whose start point is the same as the former. Thus, it is possible to prevent the divider from getting overflowed. In addition, the continuity of the patch is improved. In other words, as shown in Fig. 9, assume that a trapezoid whose length in the vertical direction is 1 or less takes place. Since this patch is not at coordinate grid points, when this patch is displayed, the problem with respect to the continuity of the patch will take place. For this patch, when obtaining the variation on the left side where the upper left vertex LS1 is connected to the lower left vertex LE1, since the left side is nearly horizontal and the length of the left side is very long in comparison with the length in the vertical direction, there is a possibility where the divider gets overflowed. To prevent that, as shown in Fig. 10, the left side line (LS1 to LE1) is replaced with a vertical line (LS1 to LE2) which starts with the start point LS1 which is the same as the former and thereby the patch is processed as a trapezoid 483. When the nearly horizontal side (LS1 to LE1) is replaced with the vertical side (LS1 to LE2), the length of the side becomes short. Thus, when obtaining the variation on the left side, the divider will not get overflowed. At that time, as shown in Fig. 10, the right side of the patch 49A adjacent to the trapezoid 48A is replaced with the vertical side (RS3 to RE4) which starts with RS3 which is the same as the former and thereby the patch is processed as a trapezoid 49B. Since the right side (LS1 to LE2) of the trapezoid 48B accords with the right side (RS3 to RE4) of the trapezoid 49B, the problem with respect to the continuity of the patch does not take place. d. Shading apparatus d1. Structure of shading apparatus Fig. 11 is a schematic showing the structure of hardware for obtaining the depth value Z and the brightness values R, G, and B of the pixel at each coordinate grid point in the aforementioned manner. In Fig. 11, to simplify the description, each value (Z, R, G, B) is processed by a single hardware unit. Actually, several hardware units for obtaining each value are provided and they are operated in parallel. In Fig. 11, the upper left vertex value LS(X, Y, Z, R, G, B) is input to an input terminal 11 and the lower left vertex value LE(X, Y, Z, R, G, B) is input to an input terminal 12. The upper right vertex value RS(X, Y, Z, R, G, B) is input to an input terminal 13 and the lower right vertex value RE(X, Y, Z, R, G, B) is input to an input terminal 14. The value from the input terminal 11 is supplied to an input terminal a of a multiplexer 15. The value from the input terminal 13 is supplied to an input terminal b of the multiplexer 15. The value from the input terminal 12 is supplied to an input terminal a of a multiplexer 16. The value from the input terminal 14 is supplied to an input terminal b of the multiplexer 16. In the multiplexer 15 the value from the input terminal 11 or the value from the input terminal 13 is selected. In the multiplexer 16 the value from the input terminal 12 or the value from the input terminal 14 is selected. Outputs of the multiplexer 15 and the multiplexer 16 are supplied to a subtracter 17. An output of the subtracter 17 is supplied to an input terminal a of a multiplexer 18. An output of a subtracter 22 is supplied to an input terminal b of the multiplexer 18. An output of the multiplexer 18 is supplied to a divider 19. An output of the divider 19 is supplied to a DDA computation circuit 20 with left side compensating computation function and a DDA computation circuit 21 with right side compensating computation function. In addition, the output of the divider 19 is supplied to a DDA computation circuit 23 with horizontal compensating computation function. Outputs of the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function are supplied to the subtracter 22. An output of the subtracter 22 is supplied to the input terminal b of the multiplexer 18. An output of the DDA computation circuit 23 with horizontal compensating computation function is output from an output terminal 24. First, the multiplexer 15 is set to the position a and the upper left vertex value LS(X, Y, Z, R, G, B) from the input terminal 11 is given to the subtracter 17. On the other hand, the multiplexer 16 is set to the position a and the lower left vertex value LE(X, Y, Z, R, G, B) is given to the subtracter 17. By the subtracter 17, the lower left vertex value is subtracted from the upper left vertex value and the resultant value of the subtraction is supplied to the input terminal a of the multiplexer 18. The multiplexer 18 is set in the position a and the resultant value of the subtraction is supplied to the divider 19. By the divider 19, the variation in the vertical direction on the left side is obtained in accordance with the equation (11). The variation in the vertical direction on the left side is set to the DDA computation circuit 20 with left side compensating computation function. After the variation in the vertical direction on the left side is set to the DDA computation circuit 20 with left side compensating computation function, the multiplexer 15 is set to the position b and then the upper right vertex value RS(X, Y, Z, R, G, B) from the input terminal 13 is given to the subtracter 17. In addition, the multiplexer 16 is set to the position b and the lower right vertex value RE(X, Y, Z, R, G, B) from the input terminal 14 is given to the subtracter 17. By the subtracter 17, the lower right vertex value is subtracted from the upper right vertex value and the resultant value of the subtraction is supplied to the input terminal a of the multiplexer 18. The multiplexer 18 is set to the position a and the resultant value of the subtraction is supplied to the divider 19. By the divider 19, the variation in the vertical direction on the right side is obtained in accordance with the equation (12). The variation in the vertical direction on the right side is set to the DDA computation circuit 21 with right side compensating computation function. The variation in the vertical direction on the left side is set to the DDA computation circuit 20 with left side compensating computation function and the variation in the vertical direction on the right side is set to the DDA computation circuit 21 with right side compensating computation function. After that, in the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function, the compensating computation in the vertical direction on the left side and that in the vertical direction on the right side are conducted, respectively. Thus, the left end value and right end value of the scan line are obtained. The left end value and the right end value of the scan line are supplied to the subtracter 22. By the subtracter 22, the right end value of the scan line is subtracted from the left end value of the scan line. By the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function, the compensating computation in the vertical direction on the left side and that in the vertical direction on the right side are conducted, respectively. After that, the multiplexer 18 is switched to the position b. Thus, the resultant value of the subtraction obtained by the subtracter 22, where the right end value of the scan line is subtracted from the left end value of the scan line, is supplied to the divider 19 through the multiplexer 18. By the divider 19, the variation in the horizontal direction is obtained in accordance with the equation (17). The variation in the horizontal direction is supplied to the DDA computation circuit 23 with horizontal compensating computation function. By the DDA computation circuit 23 with horizontal compensating computation function, the compensating computation in the horizontal direction is conducted and the value at the coordinate grid point at the start point of the scan line is obtained. By the DDA computation circuit 23 with horizontal compensating computation function, the DDA computation for the value at the start point is repeated and the values at the coordinate grid points on the scan line are successively obtained. The values are output from the output terminal 24. After all the values on the coordinate grid points of one scan line are obtained, by the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function, the DDA computation in the vertical direction on the left side and that in the vertical direction on the right side are conducted and then the right end value and the left end value of the next scan line are obtained. The left end value and the right end value of the next scan line are supplied to the subtracter 22. By the subtracter 22, the right end value of the next scan line is subtracted from the left end value of the next scan line. The resultant value of the subtraction obtained by the subtracter 22, where the right end value of the next scan line is subtracted from the left end value of the next scan line, is supplied to the divider 19 through the multiplexer 18. By the divider 19, the variation in the horizontal direction of the next scan line is obtained. The variation in the horizontal direction is supplied to the DDA computation circuit 23 with horizontal compensating computation function. By the DDA computation circuit 23 with horizontal compensating computation function, the compensating computation in the horizontal direction is conducted and the value at the coordinate grid point at the start point of the next scan line is obtained. By the DDA computation circuit 23 with horizontal compensating computation function, the DDA computation is repeated for the start point and then the values at the coordinate grid points on the scan line are successively obtained. The resultant values are output from the output terminal 24. The same operations are repeated. d2. Computation accuracy and number of bits Even if the hardware as shown in Fig. 11 is separately provided for each value (depth value Z and brightness values R, G, and B) so as to compute each value in parallel, the circuit scale is not increased. Since the number of bits of the decimal part necessary for computing each value is determined, each value can be computed in fixed decimal point arithmetic. This operation will be described in the following. First, we consider the relationship between the maximum value of the device coordinates of the horizontal value X and the vertical value Y and the number of bits of the decimal part of the depth value Z. The depth value Z is obtained by repeating the DDA computation. Thus, the error of the depth value Z is maximized when the DDA computation is repeated from one end to the other end of the screen. The maximum error should be ± 1 or less. Assume that the length of the device coordinates from one end to the other end of the screen is n bits. At that time, to obtain the depth value Z by repeating the DDA computation from one end to the other end of the screen, the DDA computation is repeated 2 n times. Thus, when the error of the DDA computation one time is e, the maximum value of the error becomes 2 n x ε. To decrease the error of the depth value Z to ± 1 or less, the error per one time the DDA computation should be (ε < 1 / 2 n ). In other words, the depth value Z should have the accuracy of (1 / 2 n ). The number of bits of the decimal part of the depth value Z should be n bits at least. Thus, the relationship between the number of bits of the decimal part of the depth value Z, namely ZFB, and the maximum value of the device coordinates of the horizontal value X and the vertical value Y should be as follows. ZFB = Max(XD, YD) where XD : Maximum value of device coordinates of horizontal value X (number of bits of integer part), and YD : Maximum value of device coordinates of vertical value Y (number of bits of integer part). Then, we consider the relationship between the maximum value of the depth value Z and the number of bits of the decimal part of the horizontal value X and the vertical value Y. As expressed by the equations (13), (14) and (18), in the compensating computation, multiplication of the decimal parts of the vertical value Y, (LS(Y) - Int (LS(Y))) and (RS(Y) - Int(RS(Y))), the decimal part of the horizontal value Y, (HS j (X) - Int(HS(X))), and the variations of the depth value Z, (DL(Z)), (DR(Z), and (DH j (Z)) are conducted. To allow the error to be ± 1 or less, it is necessary to provide the number of bits according to the number of significant bits of the variation of the depth value Z for the decimal part of the horizontal value X and that of the vertical value Y. When the variation of the depth value Z becomes maximum, all the bits of the integer part become significant bits. Thus, the number of bits of the decimal part of the horizontal value X, XFD, and that of the vertical value Y, YFD, should be the number of bits according to the maximum value of the depth value Z. In other words, the number of bits of the decimal part of X, XFD, and that of Y, YFD, should be as follows. XFD = ZD YFD = ZD where ZD : Maximum value of depth value Z. The number of bits necessary for the depth value Z was described above. The number of bits of the decimal part necessary for computing the brightness values R, G, and B can be obtained likewise. Thus, the number of bits of the decimal part necessary for computing each value is determined. Consequently, it is not necessary to conduct the computation in the floating point arithmetic. Unless the floating point arithmetic is executed, even if hardware units for computing each value are independently provided, the circuit scale will not be increased. e. Parallel process status transition circuit e1. Description of basic circuits The hardware shown in Fig. 11 is controlled by a parallel process status transition circuit shown in Fig. 12. The parallel process status transition circuit is composed of four types of circuits which are wait circuits, jump circuits, join circuits, and delay circuits. The basic circuits will be described in the following. Wait circuit The wait circuit has two inputs A and B. After the wait circuit receives an A input pulse, it stops a pulse from being output until it receives a B input pulse. When a trigger pulse for starting a particular process is output, the wait circuit stops the flow from advancing to the next process until the former process is completed. Structure of wait circuit The wait circuit is structured as shown in Fig. 13. In Fig. 13, numerals 51 and 52 are input terminals. A trigger pulse T 1 from the input terminal 51 is supplied to a flip flop 53 and one input terminal of a NOR gate 54. A trigger pulse T 2 from the input terminal 52 is supplied to a flip flop 55. A clock CLK is supplied to clock input terminals of the flip flops 53 and 55. After a trigger pulse is given to D input terminals of the flip flops 53 and 55, when the clock CLK goes high, the flip flops 53 and 55 are set and their outputs go high. Until a low level reset signal is given to each reset terminal, the output is kept high.Numeral 56 is a reset input terminal. A reset signal RST from the reset input terminal 56 is supplied to one input terminal of an OR gate 57. An output of the OR gate 57 is supplied to the other input terminal of the NOR gate 54 and an inverter 58. An output of the NOR gate 54 is supplied to a reset terminal of the flip flop 55. An output of the inverter 58 is supplied to a reset terminal of the flip flop 53 and an input terminal of a NAND gate 59. An output of the flip flop 53 is supplied to an input terminal of the NAND gate 59. An output of the flip flop 55 is supplied to an input terminal of the NAND gate 59.An output of the NAND gate 59 is supplied to an input terminal of a D flip flop 60. A clock CLK is supplied to a clock input terminal of the D flip flop 60. An output of the D flip flop 60 is output from an output terminal 62 through an inverter 61. The inverted output of the D flip flop 60 is supplied to the other input terminal of the OR gate 57.When the reset signal RST which goes high is given to the reset input terminal 56, the output of the OR gate 57 goes high, the output of the inverter 58 goes low, and the output of the NOR gate 54 goes low. Thus, the flip flops 53 and 55 are reset.When the output of the inverter 58 goes low, the output of the NAND gate 59 goes high and the output of the D flip flop 60 is kept high. Thus, the output where the output of the D flip flop 60 was inverted by the inverter 61 goes low.As shown in Fig. 14B, now, we assume that at time t 1 , the trigger pulse T 1 is supplied to the input terminal 51. Thus, as shown in Fig. 14D, at time t 2 , when the clock CLK (Fig. 14A) goes high, the trigger pulse T 1 is received by the flip flop 53 and thereby the output Q1 of the flip flop 53 goes high.At time t 3 , when the trigger pulse T 1 is supplied to the input terminal 52, as shown in Fig. 14E, at time t 4 , when the clock CLK (Fig. 14A) goes high, the trigger pulse T 2 is received by the flip flop 55 and thereby the output Q2 of the flip flop 55 goes high.At that time, as shown in Fig. 14D, the output of the flip flop 53 goes high. In addition, when the D flip flop 60 is reset, its input goes high. Thus, the inverted output of the D flip flop 60 goes low, the output of the OR gate 57 goes low, and the output of the inverter 58 goes high. Thus, when the trigger pulse T 2 is given and the output Q2 of the flip flop 55 goes high, the output of the NAND gate 59 goes low.When the output of the NAND gate 59 goes low, at time t 5 , when the clock CLK goes high, the output of the D flip flop 60 goes low. Thus, as shown in Fig. 14F, the output P of the output terminal 62 goes high.When the output of the D flip flop 60 goes low, the inverted output of the D flip flop 60 goes high and the output of the OR gate 57 goes high.When the output of the OR gate 57 goes high, the output of the inverter 58 goes low and the output of the NOR gate 54 goes low. Thus, as shown in Fig. 14D, the flip flops 53 and 55 are reset.Thus, the outputs of the flip flops 53 and 55 go low and the output of the inverter 58 goes low. Consequently, the output of the NAND gate 59 goes high. When the output of the NAND gate 59 goes high, at time t 6 , when the clock CLK goes high, the output of the D flip flop 60 goes high. Thus, at time t 6 , the output pulse P goes low. As shown in Fig. 14F, in such a wait circuit, after the trigger pulse T 1 (Fig. 14B) and the trigger pulse T 2 (Fig. 14C) are supplied in the order, the pulse P is output from the output terminal 62. Jump circuit The jump circuit has two inputs A and S. Depending on the level of the S input, an A input pulse is output selectively to one of two outputs O1 and O2. The jump circuit can be used to change the present control state depending on an external condition. Structure of jump circuit The jump circuit is structured as shown in Fig. 15. In Fig. 15, a trigger pulse T 11 is supplied to an input terminal 71. The trigger pulse T 11 is supplied to one of input terminals of an AND gate 73 and one of input terminals of an AND gate 74.A selection pulse S 11 is supplied to the input terminal 72. The selection pulse S 11 is supplied to the other input terminal of the AND gate 73 and the other terminal of the AND gate 74 through an inverter 75. An output of the AND gate 73 is output from an output terminal 76. An output of the AND gate 74 is output from an output terminal 77.While the selection pulse S 11 from the input terminal 72 goes high, when the trigger pulse T 11 is supplied from the input terminal 71, the trigger pulse T 11 is output from the output terminal 76 through the AND gate 73.While the selection pulse S 11 from the input terminal 72 goes low, when the trigger pulse T 11 is supplied from the input terminal 71, the trigger pulse T 11 is output from the output terminal 77 through the AND gate 74. Join circuit The join circuit has two inputs I1 and I2. When a pulse is input to I1 or I2, the join circuit outputs the pulse. The join circuit can be used to collect signals from several control systems to one control system. Structure of join circuit The join circuit is structured as shown in Fig. 16. In Fig. 16, a trigger pulse T 21 is supplied to an input terminal 81. The trigger pulse T 21 from the input terminal 81 is supplied to one of input terminals of an OR gate 83. A trigger pulse T 22 is supplied to an input terminal 82. The trigger pulse T 22 from the input terminal 82 is supplied to the other input terminal of the OR gate 83. An output of the OR gate 83 is output from an output terminal 84.When the trigger pulse T 21 is supplied to the input terminal 81, the trigger pulse T 21 is output from the output terminal 84 through the OR gate 83.When the trigger pulse T 22 is supplied to the input terminal 82, the trigger pulse T 22 is output from the output terminal 84 through the OR gate 83. Delay circuit The delay circuit delays an input for a predetermined time period. The delay circuit can be used to cause a process to be completed with a delay of a predetermined time period. Structure of delay circuit The delay circuit is structured as shown in Fig. 17. In Fig. 17, a trigger pulse T 31 is supplied to an input terminal 91. The trigger pulse T 31 from the input terminal 91 is supplied to a flip flop 92. An output of the flip flop 92 is output from the output terminal 93.The trigger pulse T 31 from the input terminal 91 is delayed through the flip flop 92 and then output from the output terminal 93. e2. Parallel process status transition circuit for shading process Fig. 12 shows an example of the parallel process status transition circuit for controlling the hardware shown in Fig. 11. In the parallel process status transition circuit, the aforementioned four basic circuits are used. By referring to Figs. 12 and 11, a computation control of an embodiment of the present invention will be described in the following. In Fig. 12, an external trigger pulse EXTRG is given to an input terminal 101. The external trigger pulse EXTRG is transferred to each basic circuit structuring the parallel process status transition circuit. At the time, a trigger signal for controlling each section of the hardware is output. In other words, after the external trigger pulse EXTRG from the input terminal 101 is supplied to a delay circuit 102, with a delay of a predetermined time period, a trigger signal is output from the delay circuit 102. This trigger signal is a select signal SEL ABC. The select signal SEL ABC causes the multiplexers 15 and 16 (shown in Fig. 11) to be switched to the position a and the multiplexer 18 to be switched to the position a, respectively. The value of the lower left vertex is subtracted from the value of the upper left vertex by the subtracter 17 and then the resultant value is set to to divider 19. The trigger signal from the delay circuit 102 is supplied to an A input terminal of a jump circuit 103. A null determination signal Null is supplied to an S input terminal of the jump circuit 103. When there is a vertex on the left side (see Fig. 7), a trigger pulse is output from an O1 output terminal of the jump circuit 103. This trigger pulse is a division trigger signal DIV TRG. The division trigger signal DIV TRG causes the divider 19 shown in Fig. 11 to start a division. Thus, the variation in the vertical direction on the left side is obtained. When there is no vertex on the left side and thereby the vertex on the left side is null, a trigger pulse is output from an O2 output terminal of the jump circuit 103 and then supplied to a delay circuit 105. The trigger pulse from the O1 output terminal of the jump circuit 103 is supplied to an A input terminal of a wait circuit 104. A division end signal DIV END is supplied to a B input terminal of the wait circuit 104. When the division is completed by the divider 19 and the variation in the vertical direction on the left side is obtained, the divider 19 generates the division end signal DIV END. When the division end signal DIV END occurs, the wait circuit 104 outputs a trigger pulse. This trigger pulse is a DDA set signal DDA SET A. The DDA set signal DDA SET A causes the variation in the vertical direction on the left side, obtained by the divider 19, to be set to the DDA computation circuit 20 with left side compensating computation function. The trigger pulse which is output from the wait circuit 104 is supplied to an I1 input terminal of a join circuit 106. The trigger pulse which is output from the delay circuit 105 is supplied to an I2 input terminal of the join circuit 106. When the trigger pulse from the wait circuit 104 is given to the I1 input terminal of the join circuit 106 or the trigger pulse from the delay circuit 105 is given to the I2 input terminal of the join circuit 106, a trigger pulse is output from the join circuit 106. This trigger pulse is a select signal SEL AB. The select signal SEL AB causes the multiplexers 15 and 16 to be switched to the position b. Thus, the value of the lower right vertex is subtracted from the value of the upper right vertex and then the resultant value is set to the divider 19. The trigger signal from the join circuit 106 is supplied to an A input terminal of a jump circuit 107. The null determination signal Null is supplied to an S input terminal of the jump circuit 107. When there is a vertex on the right side, a trigger pulse is output from an O1 output terminal of the jump circuit 107. This trigger pulse is a division trigger signal DIV TRG. The division trigger signal DIV TRG causes the divider 19 to start a division. Thus, the variation in the vertical direction on the right side is obtained. When there is no vertex on the right side and thereby the vertex on the right side is null, a trigger pulse is output from an O2 output terminal of the jump circuit 107. This trigger pulse is supplied to a delay circuit 109. The trigger pulse from the O1 output terminal of the jump circuit 107 is supplied to an A input terminal of the wait circuit 108. The division end signal DIV END is supplied to an B input terminal of the jump circuit 107. When the division is completed by the divider 19 and the variation in the vertical direction on the right side is obtained, the divider 19 generates the division end signal DIV END. When the division end signal DIV END occurs, the wait circuit 108 outputs a trigger pulse. The trigger pulse is a DDA set signal DDA SET B. The DDA set signal DDA SET B causes the variation in the vertical direction on the right side, which was obtained in the divider 19, to be set to the DDA computation circuit 21 with right side compensating computation function. The trigger pulse which is output from the wait circuit 108 is supplied to an I1 input terminal of the join circuit 109 is supplied to an I2 input terminal of the join circuit 110. When the trigger pulse from the wait circuit 108 is given to the I1 input terminal of the join circuit 110 or the trigger pulse from the delay circuit 109 is given to the I2 input terminal of the join circuit 110, a trigger pulse is output from the join circuit 110. This trigger pulse is a DDA compensating computation trigger signal DDA TRG AB. The DDA compensating computation trigger signal DDT TRG AB causes the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function to be triggered and the left side compensating computation and the right side compensating computation to be started, respectively. By these compensating computations, the left end value and the right end value of the scan line are obtained. The trigger pulse which is output from the join circuit 110 is supplied to an A input terminal of a wait circuit 111. An compensating computation end signal AJST END is supplied to a B input terminal of the wait circuit 111. When the left side compensating computation and the right side compensating computation are completed by the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function, respectively, they generate the compensating computation end signal AJST END. When the compensating computation end signal AJST END occurs, the wait circuit 111 outputs a trigger pulse. The trigger pulse which is output from the wait circuit 111 is supplied to an I1 input terminal of a join circuit 112. A trigger pulse which is output from a wait circuit 117 is supplied to an I2 input terminal of the join circuit 112. When the trigger pulse from the wait circuit 111 is given to the I1 input terminal of the join circuit 112 or the trigger pulse from the jump circuit 107 is given to the I2 input terminal of the join circuit 112, a trigger pulse is output from the join circuit 112. This trigger pulse is a select signal SEL C. The select signal SEL C causes the multiplexer 18 shown in Fig. 11 to be switched to the position b. When the multiplexer 18 is switched to the position b, the variation in the horizontal direction, which was obtained by the subtracter 22, is set to the divider 19. The trigger pulse which is output from the join circuit 112 is supplied to a delay circuit 113. By the delay circuit 113, the trigger pulse is delayed for a predetermined time period. After that, the delay circuit 113 outputs a trigger pulse. This trigger pulse is the division trigger signal DIV TRG. The division trigger signal DIV TRG causes the divider 19 to start a division. The trigger pulse which is output from the delay circuit 113 is supplied to an A input terminal of an wait circuit 114. The division end signal DIV END is supplied to a B input terminal of the wait circuit 114. When the division is completed by the divider 19 and the variation in the horizontal direction is obtained, the divider 19 generates the division end signal DIV END. When the division end signal DIV END occurs, the wait circuit 114 outputs a trigger pulse. This trigger pulse is a DDA set signal DDA SET H. The DDA set signal DDA SET H causes the variation in the horizontal direction, which was obtained by the divider 19, to be set to the DDA computation circuit 23 with horizontal compensating computation function. The trigger pulse which is output from the wait circuit 114 is supplied to a delay circuit 115. The trigger pulse is delayed by the delay circuit 115 for a predetermined time period. After the predetermined time period elapsed, the delay circuit 115 outputs a trigger pulse. This trigger pulse is a DDT compensating computation trigger signal DDA TRG H. The DDT compensating computation trigger signal DDA TRG H causes the DDA computation circuit 23 with horizontal compensating computation function to be triggered and the horizontal compensating computation to be started. By the DDA compensating computation, the value of the coordinate grid point at the left end of the scan line can be obtained. The trigger pulse which is output from the delay circuit 115 is supplied to an A input terminal of the wait circuit 116. The compensating computation end signal AJST END is supplied to a B input terminal of the wait circuit 116. When the horizontal compensating computation is completed by the DDA computation circuit 23 with horizontal compensating computation function, the DDA computation circuit 23 with horizontal compensating computation function generates the compensating computation end signal AJST END. When the compensating computation end signal AJST END occurs, the wait circuit 116 outputs a trigger pulse. This trigger pulse is a DDA computation trigger signal DDA H INC. The DDA computation trigger signal DDA H INC causes the DDA computation circuit 23 with horizontal compensating computation function to repeat the DDA computation. Thus, the value of each coordinate grid point of the scan line can be obtained. The trigger signal which is output from the wait circuit 116 is supplied to an A input terminal of a wait circuit 117. An signal END OF LINE for representing the end of the line is supplied to a B input terminal the wait circuit 117. When the value of the coordinate grid point at the last of the line is obtained, the signal END OF LINE for representing the last end of the line occurs. When the signal END OF LINE occurs, the wait circuit 117 outputs a trigger pulse. This trigger pulse is a DDA computation trigger signal DDA AB INC. The DDA computation trigger signal DDA AB INC causes the DDA computation circuit 20 with left side compensating computation function and the DDA computation circuit 21 with right side compensating computation function to conduct the DDA computations so as to obtain the left end value and the right end value of the next scan line, respectively. An output pulse from the wait circuit 117 is supplied to an I2 input terminal of the join circuit 112. After that, the next line is processed. According to the present invention, by the compensating computation in the vertical direction on the left side and that in the vertical direction on the right side cause values at the left and right ends of a scan line to be obtained. By using the values at the left end and right end of the scan line, the compensating computation in the horizontal direction causes a precise pixel value at the start point at a coordinate grid point close to the left end of the scan line to be obtained. By repeating the DDA computation in the horizontal direction against the pixel value at the start point, the precise pixel value on each scan line can be obtained. The values of the left end and right end of the next scan line can be obtained by the DDA computation where the variation in the vertical direction on the left side and that in the vertical direction on the right side are added to the left end value and the right end value of the former scan line, respectively. Since accurate pixel values at coordinate grid points are input, the shading has a high accuracy and smoothly accords with motions of a three-dimensional object and a light source in real time base without flickering of the screen. The shading circuit is controlled by a parallel process status transition circuit structured by four types of basic circuits, wait circuits, jump circuits, join circuits and delay circuits. By using the parallel process status transition circuit, the data flow can be easily understood and a parallel process with a high maintainability can be conducted.

Claims: A shading method of approximating a three-dimensional curved surface for computer graphics wherein shading of a two-dimensional surface is provided by varying pixel brightness values to indicate a depth dimension on the two-dimensional surface, comprising the steps of: approximating the three-dimensional curved surface by a plurality of polygons, with each polygon approximating a portion of the curved surface, and each polygon (48A, 49A) being defined by one or more trapezoids; providing a coordinate grid extending in horizontal and vertical directions with each grid point thereof representing a pixel whose brightness level is to be varied in accordance with said depth dimension and wherein scanning occurs across scan lines in a horizontal direction across the grid from grid point to grid point and parallel to parallel sides of the trapezoids; providing the trapezoids on the coordinate grid so that the addresses of vertices of the trapezoids can be determined in the coordinate grid, said vertices lying at any position in the grid not necessarily directly on a grid point at a pixel, and providing brightness values at each of the vertices; and by sub-pixel addressing, determining brightness values of respective pixels at grid points lying inside each of the trapezoids by linear interpolation based on addresses and brightness values of the trapezoid vertices, thereby shading the polygons; characterized in that, when a distance in a vertical direction of the trapezoid is less than a predetermined value causing a trapezoid side edge (LE1-LS1 in Fig. 9) to be nearly horizontal, the nearly horizontal side edge is replaced with a vertical side edge (LE2-LS1 in Fig. 10) which starts at one of the end points (LS1) of the nearly horizontal side edge, and the trapezoid adjacent the nearly horizontal edge is adapted accordingly to provide polygon continuity, so that computation errors are avoided and display continuity of the polygons is improved. A method according to claim 1 further comprising the steps of: conducting a first compensating computation (20, 21, 22) in a vertical direction of the coordinate grid by employing each of the vertex brightness values and addresses of the polygon at opposite sides of the polygon running in a primarily vertical direction so as to compute brightness values at left and right end points of a scan line intersecting said primarily left and right sides of the polygon; and conducting a second compensating computation (23) in a horizontal direction of said scan line by use of the left and right end point brightness values so as to determine brightness values at each coordinate grid point pixel on said scan line intermediate the left and right point. A method according to claim 2 wherein said vertical compensating computation includes finding left and right end points of additional scan lines by linear interpolation, and for each scan line using linear interpolation to determine pixel brightness values of pixels on the respective scan line based on the left and right end point brightness values. A shading apparatus for approximating a three-dimensional curved surface for computer graphics wherein shading of a two-dimensional surface is provided by varying pixel brigthness values to indicate a depth dimension on the two-dimensional surface, comprising: means approximating the three-dimensional curved surface by a plurality of polygons (48A, 49A), with each polygon approximating a portion of the curved surface, and each polygon being defined by one or more trapezoids; a coordinate grid extending in horizontal and vertical directions with each grid point thereof representing a pixel whose brightness level is to be varied in accordance with said depth dimension and wherein scanning occurs across scan lines in a horizontal direction across the grid from grid point to grid point and parallel to parallel sides of the trapezoids; means providing the trapezoids on the coordinate grid so that the addresses of vertices of the trapezoids can be determined in the coordinate grid, said vertices lying at any position of the grid not necessarily directly on a grid point at a pixel, and providing brightness values at each of the vertices; means arranged for sub-pixel addressing, for determining brightness values of respective pixels at grid points lying inside each of the trapezoids by linear interpolation based on addresses and brightness values of the vertices, thereby shading the polygons, caracterized in that a means (11-24; Fig. 11) is provided, which, when a distance in a vertical direction of the trapezoid is less than a predetermined value causing a trapezoid side edge (LE1-LS1 in Fig. 9) to be nearly horizontal, replaces said nearly horizontal side edge with a vertical side edge (LE2-LS1 in Fig. 10) which starts at one (LS1) of the nearly horizontal side edge, and the trapezoid adjacent the nearly horizontal edge is adapted accordingly to provide polygon continuity, so that computation errors are avoided and display continuity of the polygons is improved. An apparatus according to claim 4 further comprises: means (20, 21, 22) for conducting a first compensating computation in a vertical direction of the coordinate grid by employing each of the vertex brigthness values and addresses of the polygon at opposite sides of the polygon running in a primarily vertical direction so as to compute brigthness values at left and right end points of a scan line intersecting said primarily vertical left and right sides of the polygon; and means (23) for conducting a second compensating computation in a horizontal direction of said scan line by use of the left and right end point brigthness values so as to determine brightness values at each coordinate grid point pixel on said scan line intermediate the left and right end points.

Inventors: HIRASE HIDEHIRO, ICHIKAWA NORIHITO, IMAI MASATOSHI, OMORI MUTSUHIRO, HIRASE, HIDEHIRO, ICHIKAWA, NORIHITO, IMAI, MASATOSHI, OMORI, MUTSUHIRO
Applicants: SONY CORP, SONY CORPORATION
Application year: 1990
Main classification: G06T15
IPC codes: G06T15