US 20010010517 A1 Abstract A perspective projection calculation device making a perspective correction accurately and rapidly in each plane while avoiding an increase in the number of dividing operations. The perspective projection calculation device comprises at least one plane slope element coefficient calculation unit for calculating a coefficient which implies a plane slope element of the triangle defined in the three-dimensional space usable in common in a plurality of geometrical parameters to be interpolated, at least on interpolation coefficient calculation unit for calculating an interpolation coefficient from the plane slope element coefficient calculated by the plane slope element coefficient calculation unit, and at least one correction unit for making a perspective correction, using the interpolation coefficient obtained in the interpolation coefficient calculation unit.
Claims(1) 1. A perspective projection calculation device in an image processor for perspectively projecting a triangle defined in a three-dimensional space onto a two-dimensional space and for shading the triangle in the second-dimensional space, comprising:
at least one plane slope element coefficient calculating means for calculating a coefficient which implies a plane slope element of the triangle defined in the three-dimensional space; at least on interpolation coefficient calculating means for calculating an interpolation coefficient from the plane slope element coefficient calculated by the plane slope element coefficient calculating means; and at least one correcting means for making a perspective correction, using the interpolation coefficient. Description [0001] The present invention relates to figure generating systems for image processors, and more particularly to a perspective projection calculation device and method for correcting geometrical parameters of a perspectively projected three-dimensional figure. [0002] When a perspectively projected figure, for example a triangle, is shaded, linear interpolation is generally performed for each span, using the respective vertex coordinates of a perspectively projected triangle, and geometrical parameters necessary and sufficient for shading are approximately calculated for the respective points within the perspectively projected triangle. [0003] In order to prevent reality based on perspective projection from being impaired, secondary interpolation is performed for each span, using the vertex coordinates of the perspectively projected triangle and geometrical parameters necessary and sufficient for shading are approximately calculated for the respective points within the perspectively projected triangle. [0004] For example, JP-A-3-198172 discloses a method of calculating geometrical parameters necessary and sufficient for shading on a plane figure in a three-dimensional space without interpolation for each span, but no specified method of calculating interpolation coefficients used for the interpolation. [0005] A known method of interpolation for each plane is disclosed in Juan Pineda: “A Parallel Algorithm for Polygon Rasterization”, [0006] In the above prior art, when interpolation coefficients necessary for interpolation are calculated for each span interpolation, calculations including division are required for each span. In addition, when geometrical parameters to be interpolated are different even in the interpolation for the same span, calculations including division for the interpolation coefficients are required for the respective parameters. [0007] The effects of the perspective projection in the prior art are inaccurate and approximate. [0008] It is therefore an object of the present invention to provide a perspective projection calculation device which is capable of reducing the number of times of division required for shading, and rapidly making an accurate correction on perspective projection for each plane. [0009] It is another object of the present invention to provide a perspective projection calculation method which is capable of reducing the number of times of division required for shading, and rapidly making an accurate correction on perspective projection for each plane. [0010] In order to achieve the above objects, the present invention provides a perspective projection calculation device in an image processor for perspectively projecting a triangle defined in a three-dimensional space onto a two-dimensional space and for shading the triangle in the second-dimensional space, comprising: [0011] at least one plane slope element coefficient calculating means for calculating a coefficient which implies a plane slope element of the triangle defined in the three-dimensional space; [0012] at least on interpolation coefficient calculating means for calculating an interpolation coefficient from the plane slope element coefficient calculated by the plane slope element coefficient calculating means; and [0013] at least one correcting means for making a perspective correction, using the interpolation coefficient. [0014] The plane slope element coefficient may be used in common in all parameters to be interpolated. [0015] An inverse matrix of a matrix of vertex coordinates of the triangle defined in the three-dimensional space may be used as the plane slope element coefficient. [0016] The plane slope element coefficient, the interpolation coefficient and/or an interpolation expression including the interpolation coefficient may be used in common in the triangle defined in the three-dimensional space and/or in a perspectively projected triangle in a two-dimensional space. [0017] The interpolation expression may involve only multiplication and/or addition. [0018] The geometrical parameters may be interpolated in a three-dimensional space. [0019] The interpolation expression may include a term involving a depth. More specifically, it may use the inverse of depth coordinates as geometrical parameters. [0020] The interpolation expression may interpolate the geometrical parameters while maintaining the linearity thereof on a plane. [0021] In order to achieve the above objects, the present invention provides a perspective projection calculation device in an image processor which includes at least one display, at least one frame buffer for storing an image to be displayed on the display, and at least one figure generator for generating a figure which composes the image on the frame buffer, thereby making a perspective correction on the respective pixels of the figure, [0022] wherein coefficients necessary and sufficient for perspective projection calculation are used as an interface to the figure generator. [0023] In order to achieve the above objects, the present invention provides a perspective projection calculation device in an image processor which includes a depth buffer which stores data on a depth from a viewpoint for a plane to be displayed and which removes a hidden surface, the image processor perspectively projecting a triangle defined in a three-dimensional space onto a two-dimensional space and shading the triangle in the two-dimensional space, [0024] wherein the depth buffer comprises a buffer for storing a non-linear value in correspondence to the distance from the viewpoint. [0025] The depth buffer may comprise a buffer for storing a non-linear value representing a resolution which increases toward the viewpoint in place of the depth value. More specifically, the depth buffer may comprise a buffer for storing the inverse of a depth value in place of the depth value. [0026] In order to achieve the another object, the present invention provides a perspective projection calculation method in an image processing method for perspectively projecting a triangle defined in a three-dimensional space onto a two-dimensional space and for shading the triangle in the second-dimensional space, comprising the steps of: [0027] calculating a coefficient which implies a plane slope element of the triangle defined in the three-dimensional space; [0028] calculating an interpolation coefficient from the plane slope element coefficient; and [0029] making a perspective correction, using the interpolation coefficient. [0030] The plane slope element coefficient may be used in common in all parameters to be interpolated. [0031] An inverse matrix of a matrix of vertex coordinates of the triangle defined in the three-dimensional space may be used as the plane slope element coefficient. [0032] In any perspective projection calculation device, the plane slope element coefficient, the interpolation coefficient and/or an interpolation expression including the interpolation coefficient may be used in common in the triangle defined in the three-dimensional space and/or in a perspectively projected triangle in a two-dimensional space. [0033] The interpolation expression may involve only multiplication and/or addition. [0034] The geometrical parameters may be interpolated in a three-dimensional space. [0035] The interpolation expression may include a term involving a depth. More specifically, the interpolation expression may use the inverses of depth coordinates as the geometrical parameters. [0036] The interpolation calculation expression may interpolate the geometrical parameters while maintaining the linearity thereof on a plane. [0037] In order to achieve the another object, the present invention provides a perspective projection calculation method in an image processing method which uses a depth buffer which stores data on a depth from a viewpoint for a plane to be displayed and which removes a hidden surface, a triangle defined in a three-dimensional space being perspectively projected onto a two-dimensional space and the triangle being shaded in the two-dimensional space, comprising the step of: [0038] storing a non-linear value in the depth buffer in correspondence to the distance from the viewpoint. [0039] The depth buffer may store a non-linear value representing a resolution which increases toward the viewpoint in place of the depth value. More specifically, the depth buffer may store an inverse of a depth value is stored in the depth buffer in place of the depth value. [0040] In the present invention, a plane slope element coefficient in a three-dimensional space usable in common in a plurality of geometrical parameters necessary for shading a perspectively projected figure is used to reduce the number of dividing operations, and the plurality of geometrical parameters is corrected for each plane in the three-dimensional space. Thus, correct perspective correction is made rapidly. [0041]FIG. 1 is a block diagram of an illustrative image processing system which employs one embodiment of a perspective projection calculation device according to the present invention; [0042]FIG. 2 is a block diagram of an illustrative perspective correction unit; [0043]FIG. 3 is a block diagram of an illustrative plane slope element coefficient calculation unit which is a component of the perspective correction calculation unit; [0044]FIG. 4 is a block diagram of a depth coordinate interpolation coefficient calculation unit which is a component of the interpolation coefficient calculation unit; [0045]FIG. 5 is a block diagram of a texture coordinate interpolation coefficient calculation unit which is a component of the interpolation coefficient calculation unit; [0046]FIG. 6 is a block diagram of a depth coordinate correction unit which is a component of a correction unit; [0047]FIG. 7 is a block diagram of an illustrative texture coordinate s-component correction unit for an s-component of a texture coordinate correction unit as a component of the correction unit; [0048]FIG. 8 is a block diagram of a modification of the perspective correction calculation unit of FIG. 2; [0049]FIG. 9 is a block diagram of an illustrative luminance calculation unit which cooperates with a pixel address calculation unit and the correction unit to compose a figure generator; [0050]FIGS. 10A and 10B show a triangle displayed on a display; [0051]FIG. 11 shows the relationship between geometrical parameters and the corresponding triangles to be displayed; [0052]FIGS. 12A, 12B and [0053]FIG. 13 illustrates an interpolation expression for s-components of depth and texture coordinates as typical interpolation expressions to be processed in the correction unit; [0054]FIG. 14 shows a luminance calculation expression to be processed in the luminance calculation unit; [0055]FIG. 15 is a graph of the relationship between the depth from a viewpoint of a triangle to be displayed and its inverse with z and 1/z values as parameters; [0056]FIG. 16 shows z values for several 1/z values; and [0057]FIG. 17 shows the relationship between a case in which a z value is stored in a depth buffer and a case in which a 1/z value is stored in the depth buffer. [0058] Referring to FIGS. [0059]FIG. 1 is a block diagram of an illustrative image processing system which employs one embodiment of a perspective projection calculation device according to the present invention. The system is composed of a figure vertex information inputting unit [0060]FIG. 2 is a block diagram of the perspective projection calculation unit [0061] The interpolation coefficient calculation unit [0062]FIG. 3 is a block diagram of the plane slope component coefficient calculation unit [0063]FIG. 4 is a block diagram of an illustrative depth coordinate interpolation coefficient calculation unit [0064]FIG. 5 is a block diagram of an illustrative texture coordinate interpolation coefficient calculation unit [0065]FIG. 6 is a block diagram of the depth coordinate correction unit [0066]FIG. 7 is a block diagram of an illustrative texture coordinate s-component correction unit [0067]FIG. 8 is a block diagram of a modification of the perspective correction calculation unit [0068] In this case, perspective correction is made on a light source intensity attenuation rate necessary for luminance calculation, using a similar structure to that of FIG. 8. Perspective correction is made on a normal vector [0069] The procedures for processing the vertex coordinates and vertex texture coordinates of FIG. 8 are the same as those employed in FIG. 2. The light source intensity attenuation rate and vertex regular model coordinates which are modified geometrical parameters will be processed in a manner similar to that in which the vertex texture coordinates of FIG. 2 will be done. [0070] In addition, in FIG. 8, perspective correction is made on geometrical parameters such as normals, depth coordinates, vertex texture coordinates, light source, and viewpoint necessary for calculation of luminance, using a structure similar to that of FIG. 2; more specifically, a light source intensity attenuation rate [0071]FIG. 9 is a block diagram of an illustrative luminance calculation unit [0072] A specular reflection attenuation rate calculation unit [0073] The above series of processing steps is performed by the number of light sources. A whole light source ambient component calculation unit [0074] Referring to FIGS. [0075]FIG. 10 shows a triangle [0076] The pdc [0077]FIG. 11 shows the relationship between their geometrical parameters and a triangle to be displayed. At a point (x [0078]FIGS. 12A, 12B, [0079]FIG. 13 shows interpolation expressions for a depth coordinate
[0080] where (x [0081] The texture coordinates [0082] where (x [0083]FIG. 14 shows a luminance calculation expression to be processed by the luminance calculation unit [0084] where C is composed of three components R, G and B, i is a light source number. Cai, Cdi and Csi are obtained as: [0085] where (−Ldiri·Li), (N·Li) and (V·Ri) are each an inner product; Ka, Kb and Kc are each a reflection coefficient of a material; La, Ld and Ls are each the color of the light source; Ctel is the texture color; Latt is the light source intensity attenuation rate [0086]FIG. 15 is a graph [0087]FIG. 16 shows several z values and corresponding 1/z values. A correspondence table [0088]FIG. 17 shows the relationship between the case in which z values are stored in the depth buffer [0089] Accurate perspective correction on the depth coordinates and texture coordinates [0090] The plane slope element coefficient calculation unit [0091] The plane slope element coefficient [0092] The depth coordinate interpolation coefficient calculation unit [0093] First, a process for calculating the depth coordinate interpolation coefficient [0094] Next, the texture coordinate interpolation coefficients [0095] The depth coordinates [0096] In the actual processing for the depth, the depth coordinates themselves are not used and the inverse values of the depth coordinates are handled instead. The texture coordinate [0097] As described above, the geometrical parameters are interpolated in the three-dimensional space and effects due to perspective projection for shading are accurately expressed. [0098] A plurality of geometrical parameters other than the depth coordinates and texture coordinates [0099] Since correction on geometrical parameters in the coordinates which were produced by the pixel address calculation unit [0100] Data on the colors calculated in the luminance calculation unit [0101] The depth coordinates stored in the depth buffer [0102] While in the embodiment, phong shading with texture mapping to which accurate perspective correction has been made has been illustrated, the use of colors at the triangle vertexes as geometrical parameters brings about Gouraud Shading which has subjected to accurate perspective correction. [0103] While as the geometrical parameters four kinds of data; the depth coordinates, texture coordinates [0104] While in the embodiment 1/z values or recZ which are the inverses of the depth coordinates are illustrated as being stored in the depth buffer [0105] Since the perspective projection calculation device according to the present invention includes the plane slope element coefficient calculation unit which calculates coefficients which imply a plane slope of a triangle defined in the three-dimensional space usable in common in a plurality of geometrical parameters to be interpolated, the interpolation coefficient calculation unit which calculates interpolation coefficients from the plane slope element coefficients obtained in the plane slope element coefficient calculation unit, and the correction unit which makes accurate perspective corrections, using the interpolation coefficients obtained in the interpolation coefficient calculation unit, the perspective projection calculation device is capable of accurately making perspective corrections rapidly for each plane while avoiding an increase in the number of dividing operations. Referenced by
Classifications
Rotate |