Apparatus for generating images

Abstract: There is provided a method and an apparatus for generating images wherein access to a main memory is minimized during a translation of an image of a 3D object or the like on a display screen to increase the speed of the translation process. A string of draw commands for drawing an image is preceded by an offset draw command which indicates offset values for the coordinates of the vertices of the image, and the image is translated on the display screen in accordance with the offset draw command. A header portion of each of the offset draw command and the draw commands that constitute the draw command string includes data indicating the address on the main memory of the next draw command to be executed. The image generation apparatus includes a frame buffer in which an image is drawn, a CPU for generating a string of draw commands to draw the image and an offset draw command indicating offset values for the coordinates of the vertices of the image, a main memory for storing the string of draw commands and offset draw command generated by the CPU, and a drawing device portion for executing the string of draw commands and offset draw command from the main memory to draw a translated image on the frame buffer.

Description: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an apparatus for generating images suitable for use with apparatuses utilizing computer graphics such as video game machines and graphic computers which must perform a high level of visualization using limited hardware resources. 2. Description of the Related Art In video game machines and graphic computers, a drawing device portion is provided between the CPU and frame buffer (frame memory) in order to improve the processing speed. During the generation of an image, the CPU does not directly access the frame buffer, but generates commands to draw basic figures such as triangles and quadrangles and sends them to the drawing device portion. The drawing device portion interprets those commands from the CPU and draws the figures on the frame buffer. The smallest unit of figure processed by the drawing device portion is referred to as a polygon or primitive and a command to draw it is referred to as a draw command or display list. In a 3D (three-dimensional) graphics system in which an object is drawn on a two-dimensional display screen with a three-dimensional appearance, the surface of the 3D object to be rendered is divided into a plurality of polygons, and the polygons are sequentially drawn on a frame buffer to reconstruct an image having a three-dimensional appearance. For example, when a 3D object OJ as shown at (A) in Fig. 6 is drawn, as shown at (B) in Fig. 6, the surface of the object OJ is divided into a polygon Pa with vertices A, B, D, and C, a polygon Pb with vertices D, C, E, and F, and a polygon Pc with vertices B, C. G, and F. Then, as shown at (C) in Fig. 6, draw commands IPa, IPb. and IPc associated with the polygons Pa, Pb, and Pc, respectively, are sequentially transferred to a drawing device portion 62 to sequentially draw the polygons Pa, Pb, and Pc on a frame buffer 66. In the draw commands IPa, IPb, and IPc, the coordinates of the vertices of the respective polygons Pa, Pb, and Pc are added to respective indication codes INCO indicating that the subsequent data is polygon draw commands. In applications such as video game machines, scenes wherein 3D objects as described above are displayed by simply translating them frequently appear. In such a case, the coordinates of the vertices of all of the polygons that constitute the object have been rewritten on a frame-by-frame basis. Specifically, assume that the object OJ as shown at (A) in Fig. 6 is translated on the display screen in X and Y directions by amounts dx and dy, respectively. In the main memory, as shown in Fig. 7, the coordinate values of each vertices in the draw commands IPa, IPb, and IPc associated respectively with the polygons Pa, Pb, and Pc which constitute the object OJ are greater respectively by dx and dy in the frame Fb after the translation than in the frame Fa before the translation. The applicant has made the following Japanese patent applications which are related to the drawing device according to this application. JP 7085308 (published on March 31, 1995) JP 7073333 (published on March 17, 1995) JP 7114654 (published on May 2, 1995) JP 7219894 (published on August 18, 1995) Each of the above applications is owned by the assignee of the present invention. When an object is translated on a display screen by rewriting the coordinates of the vertices of all of the polygons that constitute the object on a frame-by-frame basis as described above, the main memory must be frequently accessed, and this results in a problem in that the translation process can not be performed at high speed. The EP-A-0 676 722, which forms prior art according to Art.54(3) EPC, describes an image generating method and apparatus wherein drawing instructions and control instructions generated by a CPU are transferred to a drawing device section which generates an image by sequentially performing drawing operations in accordance with the drawing instructions and the control instructions. In the book "Computer Graphics" by James D. Foley, in particular on pages 201-204 and 304-308, there are described 2D and 3D geometrical transformations used in computer graphics to change the position, orientation, and size of objects in a drawing. Also disclosed is a computer graphics program named SPHIGS which performs translations of the object by use of transformation matrices. It is an object of the present invention to minimize access to a main memory during a translation of an image of a 3D object or the like on a display screen to increase the speed of the translation process. SUMMARY OF THE INVENTION An image generation apparatus according to the present invention comprises the features of the appended claim 1. According to the apparatus for generating images of the present invention, when an image of a 3D object or the like is translated on a display screen, it is necessary only to rewrite the offset values for the coordinates of the vertices in the offset draw command that precedes the string of draw commands. This minimizes access to the main memory and makes it possible to perform the translation process at high speed. In addition, since the main memory is accessed according to the address data in the header portion of each of the offset draw command and the draw commands that constitute the string, the offset draw command and the draw commands constituting the string can be obtained in a linked form in the order in which they are to be executed. As a result, it is not necessary to place the offset draw command and the draw commands that constitute the string in consecutive memory areas of the main memory in the order of execution. Even when a need for a translation arises on the way of the execution, it is not required to change the positions of the subsequent draw commands in the main memory, and the order of the execution of the offset draw command and the draw commands that constitute the draw command string can be easily changed by rewriting the address data in the header portions of those draw commands without changing their positions in the main memory. As apparent from the above, the present invention minimizes access to the main memory during a translation of an image of a 3D object or the like on a display screen to allow the translation process to be performed at high speed. Further, even when a need for a translation arises on the way of the execution, it is not required to change the positions of the subsequent draw commands in the main memory, and the order of the execution of the draw commands can be easily changed by rewriting the address data in the header portions of the draw commands without changing their positions in the main memory. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram of an image generation apparatus according to an embodiment of the present invention. Fig. 2 illustrates an example of the configuration of offset draw commands and polygon draw commands in the case of a translation of an object. Fig. 3 illustrates another example of the configuration of offset draw commands and polygon draw commands in the case of a translation of an object. Fig. 4 illustrates an example of a method of dividing one frame of image during a translation of a background image. Fig. 5 illustrates an example of a draw command for a background image in the case of a translation of a background image. Fig. 6 illustrates a method of drawing an object. Fig. 7 illustrates an example of offset draw commands and polygon draw commands in the case of a translation of an object according to a conventional method. DETAILED DESCRIPTION OF PREFERRED EMBODIMENT Fig. 1 shows an image generation apparatus according to an embodiment of the present invention which is configured as a video game machine. A CPU 11 is connected to a system bus (main bus) 1. A cache memory 12 is connected to the CPU 11 which controls the system as a whole. Further, a coordinate conversion portion 13 for performing calculations for converting the coordinates of a polygon and the like is connected to the CPU 11. For example, a 32-bit CPU may be used as the CPU 11. A main memory 21 is also connected to the system bus 1. Further, a CD-ROM decoder 31 and a DMA (direct memory access) controller 41 are connected to the system bus 1. A CD-ROM driver 32 is connected to the CD-ROM decoder 31. A CD-ROM is loaded in the CD-ROM driver 32. CD-ROM contains an application program including polygon draw commands and data including image data which has been compressed using, for example, discrete cosine transformation (DCT). The application program and data are decoded by the CD-ROM decoder 31 and are transferred to the main memory 21 by the DMA controller 41. An image decompression portion 53 is also connected to the system bus 1 through an FIFO buffer 51 and an FIFO buffer 52 at input and output ends thereof, respectively. The image decompression portion 53 decompresses the above-described compressed image data. A drawing device portion 62 is also connected to the system bus 1 through an FIFO buffer 61. A frame buffer 66 is connected to the drawing device portion 62. A D-A converter 67 is connected to the frame buffer 66. An image display monitor 68 is connected to the D-A converter 67. The drawing device portion 62 executes draw commands which have been received from the main memory 21 through the DMA controller 41 to draw an image on the frame buffer 66. In the present embodiment, it includes an offset register 63 for storing offset values for the coordinates of vertices included in a offset draw command to be described later and an adder 64 for adding the offset values to the coordinates of each vertices included in each draw command that forms a part of a draw command string for drawing the image. The frame buffer 66 is constituted by a frame buffer having areas which are switched at each vertical period. Image data output by the frame buffer 66 is converted by the D-A converter 67 into an analog video signal which is output to the image display monitor 68. A control pad 72 as a control input means for the video game machine is also connected to the system bus 1 through an interface 71. Also connected to the system bus 1 is a boot ROM 73 in which a program for starting up the video game machine is stored. In the above-described image generation apparatus, draw commands are generated by the CPU 11 in the main memory 21; the draw commands are transferred to the drawing device portion 62 by the DMA controller 41; the drawing device portion 62 executes the draw commands to draw an image on the frame buffer 66; and the image is displayed on the image display monitor 66. The draw commands transferred from the main memory 21 to the drawing device portion 62 include offset draw commands which precede respective strings of draw commands to draw an image. Assume that, in one frame, an object OI is followed by an object OJ which is divided into polygons Pa, Pb, and Pc as shown in Fig. 6 and another object OK is subsequently drawn. Then, as shown in Fig. 2, a draw command string Aoi for the object OI is preceded by an offset draw command Ooi; a draw command string Aoj for the object OJ that follows the draw command string Aoi is preceded by an offset draw command Ooj inserted therebetween; and a draw command string Aok for the object OK that follows the draw command string Aoj is preceded by an offset draw command Ook inserted therebetween. A header portion of each of the offset draw commands Ooi, Ooj, and Ook includes data AD that indicates the address in the main memory 21 of the next draw command to be executed. Specifically, the header portion of the offset draw command Ooj includes the address of the first draw command IPa in the draw command string Aoj for the object OJ. The header portions are followed by indication codes OFIN indicating that the subsequent data is offset draw commands which are in turn followed by offset values dx and dy for the coordinates of the vertices of the respective objects OI, OJ, and OK. In this embodiment, the offset values dx and dy are generated by the CPU 11 in accordance with input operations using the control pad 72, stored in combination with the respective address data AD and indication codes OFIN in the main memory 21 as the offset draw commands Ooi, Ooj, and Ook, and transferred from the main memory 21 to the drawing device portion 62 by the DMA controller 41. The draw command string Aoj for the object OJ is constituted by draw commands IPa, IPb, and IPc for the divided polygons Pa, Pb, and Pc. The draw commands IPa, IPb, and IPc include data AD indicating the addresses in the main memory 21 of the next draw commands to be executed in header portions thereof. The header portions are followed by indication codes INCO indicating that the subsequent data is polygon draw commands which are in turn followed by coordinate strings for the vertices of the respective polygons Pa, Pb, and Pc. The draw command strings Aoi and Aok for the objects OI and OK have the same configuration except that, when the object OK is the last object drawn in a frame, the last draw command to be executed in the draw command string Aok for the object OK includes an indication code indicating that it is the last draw command in the frame instead of the address data AD, although not shown. When address data AD is inserted in the header portions of offset draw commands and polygon draw commands as described above, it is not necessary that such offset draw commands and polygon draw commands are placed in consecutive memory areas in the main memory 21 in the order in which they are to be executed. In the example shown in Fig. 2, certain consecutive memory areas in the main memory 21 are represented by addresses A0, A1, A2. A3. and A4. In the main memory 21, the offset draw command Ooj, polygon draw command IPa, polygon draw command IPc, polygon draw command IPb, and offset draw command Ook are stored in the addresses A0, A1, A2, A3, and A4, respectively. The address data AD of the offset draw command Ooj, polygon draw command IPa, polygon draw command IPb, and polygon draw command IPc indicate addresses A1, A3, A2. and A4, respectively. The DMA controller 41 transfers the offset draw commands and polygon draw commands from the main memory 21 to the drawing device portion 62 in an order which is in accordance with the addresses of those commands in the main memory 21 indicated by the respective address data AD. Specifically, in the example shown in Fig. 2, they are transferred as a list of draw command strings in an order such that the offset draw command Ooj is transferred first and is followed by the polygon draw command IPa, polygon draw command IPb, polygon draw command IPc, then offset draw command Ook. In the drawing device portion 62, the offset values dx and dy for the coordinates of vertices in the offset draw command Ooj are written in the offset register 63, and the adder 64 sequentially adds the offset values dx and dy to the coordinates of the respective vertices of the polygons Pa, Pb, and Pc in the polygon draw commands IPa, IPb, and IPc to sequentially obtain the coordinates of respective vertices for translated versions of the polygons Pa, Pb, and Pc based on which the polygons Pa, Pb, and Pc are sequentially drawn on the frame buffer 66 so that the object OJ is translated on the display in the X and Y directions by the offset values dx and dy, respectively. In the case that the object OJ is to be further translated in the next frame in the same directions and by the same amount, the offset values dx and dy for the coordinates of vertices in the offset draw command Ooj are doubled, with the coordinates of the vertices of the polygons Pa, Pb, and Pc in the polygon draw commands IPa, IPb, and IPc kept unchanged. As described above, when an object is translated on the display screen, it is necessary only to rewrite the offset values dx and dy for the coordinates of vertices in the relevant offset draw command. As a result, access to the memory 21 is minimized and the translation process can be performed at high speed. By inserting the data AD indicating the address in the main memory 21 of the next draw command to be executed in the header portion of each of the offset draw commands and polygon draw commands as in the above-described example, the main memory 21 can be sequentially accessed according to the address data AD to obtain the offset draw commands and polygon draw commands in a linked form in the order of execution. Accordingly, it is not necessary that the offset draw commands and polygon draw commands are placed in consecutive memory areas on the main memory in the order of execution. Therefore, even when a need for a translation arises on the way of the execution, it is not required to change the positions of the subsequent draw commands in the main memory 21, and the order of the execution of the draw commands can be easily changed by rewriting the address data AD in the header portions of the draw commands without changing their positions in the main memory 21. Illustratively, in the example in Fig. 2, the polygons Pa, Pb, and Pc are sequentially drawn in the order listed to draw the object OJ. If these polygons are to be sequentially drawn in an order such that the polygon Pa is drawn first and is followed by the polygon Pc and then the polygon Pb, the address data AD in the polygon draw commands IPa, IPc, and IPb are rewritten to respectively indicate the addresses A2, A3, and A4 in the main memory 21. The above-described address data AD may be omitted as shown in Fig. 3. In this case, however, the DMA controller 41 transfers the offset draw commands and polygon draw commands from the main memory 21 to the drawing device portion 62 in accordance with the order of the addresses of those commands in the main memory 21. Therefore, to change the order of the execution of the draw commands, the positions of the draw commands in the main memory 21 must be changed. Although the above-described embodiment has addressed a translation of a so-called 3D object, the present invention is not limited to 3D objects. The present invention may be applied to a translation of a simple polygon and a translation of an image such as a background image. An example of such a translation of a background image is as follows. For example, assume that one frame of a background image is constituted by 320 (rows) X 240 (columns) pixels; such a frame of image is divided into 300 macro-blocks MB as shown in Fig. 4 each constituted by 16 (rows) X 16 (columns) pixels; and the background image is drawn on a macro-block basis. As shown in Fig. 5, a draw command for this background image includes a header portion containing data AD indicating the address in the main memory 21 of the next draw command to be executed, an indication code INCO indicating that the subsequent data is draw commands for the background image, data H and W indicating the height and width of a macro-block area MA in which the background image is to be drawn, data X and Y indicating the coordinates of the upper left vertex of the macro-block area MA, and image data IP which follows the header portion. While the width of the macro-block area MA corresponds to the width of one macro-block MB, the height of the macro-block area MA corresponds to the height of one macro-block or a plurality of macro-blocks which are consecutive in the vertical direction. The image data IP has been decompressed by the image decompression portion 53. Such a background image may be treated similarly to a polygon, so it can be translated on the display screen using the above-described method. The coordinate conversion portion 13 may be connected to the system bus 1 instead of being pipeline-connected to the CPU as in the illustrated embodiment. Application programs and data may be recorded using in semiconductor memories such as magnetic discs and memory cards instead of CD-ROMs. Various modifications to the present invention will become apparent to those skilled in the art from the foregoing description and accompanying drawings. Accordingly, the present invention is to be limited solely by the scope of the following claims.

Claims: An image generation apparatus comprising: a frame buffer (66) in which an image is drawn; a CPU (11) for generating an offset draw command indicating offset values for the coordinates of the vertices of an image and a string of draw commands to draw said image; a main memory (21) in which said offset draw command and said string of draw commands generated by said CPU (11) are stored; and a drawing device portion (62) for executing said offset draw command before said string of commands supplied from said main memory (21) to draw a translated image on said frame buffer (66); characterized in that said drawing device portion (62) includes an offset register means (63) for storing offset values and adder means (64) for adding the offset values to the coordinates of the respective vertices included in each draw command. The apparatus according to Claim 1, wherein said draw commands include polygons and draw commands as the smallest units for drawing a figure and wherein said adder (64) is adapted for adding said offset command to the draw command for each of said polygons. The apparatus according to Claim 2, further comprising means for including in each draw command an indication code indicating that the data is a polygon draw command. The apparatus according to Claim 3, further comprising means for including in each offset command an indication code indicating that the data is offset data and data indicating the amount of the offset. The apparatus according to Claim 4, further comprising means for translating said polygon according to first and second data representing said offset. The apparatus according to Claim 5, further comprising a control input means (72), said offset draw command being generated according to input operations using said control input means.

Inventors: FURUHASHI MAKOTO, SUZUOKI MASAKAZU, TANAKA MASAYOSHI, YUTAKA TEIJI, FURUHASHI, MAKOTO, SUZUOKI, MASAKAZU, TANAKA, MASAYOSHI, YUTAKA, TEIJI
Applicants: SONY CORP, SONY CORPORATION
Application year: 1995
Main classification: G06T3
IPC codes: G06T3, G06T11