1. Field of Invention
The present invention relates to real time computer graphics, and more particularly to a rasterizer design in 3D graphics hardware architecture.
2. Description of Related Arts
In computer graphics, the algorithms of primitive rasterizer can be broadly divided into two categories: namely immediate mode rendering algorithms and tile based rendering algorithms.
For the immediate mode rendering algorithm, as shown in
On the other hand, for the tile based rendering algorithm, as shown in
It is suggested that because the size of this tile is much smaller than the whole screen, the memory bandwidth that stores color buffer and Z buffer can be integrated into graphics chip. After all of the primitives of a particular tile are rendered, the color buffer and the Z buffer are subsequently written into local frame buffer. This saves memory access bandwidth for the color and Z.
After all tiles of a particular frame (the whole screen) have completed the pixel rendering process, the final image is sent to display unit which then displays the image in question to a user. It is suggested, this method is adapted for rapid hidden pixel removal and therefore saves processing time and memory resources.
Though these advantages, tile based rendering algorithm also has disadvantages. First, the primitives of the whole frame (screen) have to be stored into many tile buffers and are read many times since they are shared by multiple tiles. The duplicative primitives need a relatively big buffer to store and consumes considerable amount of memory bandwidths. Second, the use of tile based rendering algorithms involves repeated setup computations for each primitive when the primitive covers multiple tiles. Last, the primitive size of a frame is limited by the architecture of the tile based rendering algorithms.
A main object of the present invention is to provide a method of rendering a 3D graphic image using page based rendering technique, wherein each of the primitives is first divided into a plurality of segments which are binned in the same way as that of the tile based rendering technique, while the primitives of the whole frame are rendered in the same way as the immediate mode rendering technique, such that the page based rendering technique substantially integrates the advantages of both the immediate mode rendering technique and the tile based rendering technique, while resolving the respective disadvantages in associated with the these graphics rendering techniques.
Another object of the present invention is to provide a method of rendering a 3D graphics image using page based rendering technique, wherein the primitives are divided into pages and pre-sorted before they are converted into pixels, so as to avoid occlusion of pixels as a result of overlapping of primitives, such that the memory resources for implementing the method can be minimized.
Another object of the present invention is to provide a method of rendering a 3D graphics image using page based rendering technique, wherein the primitives are sorted and compared in a page-by-page basis, so that there is no need to repeatedly sort and store the primitives for the whole frame. In other words, the present invention provides an efficient and effective method for rendering a 3D graphics image.
Another object of the present invention is to provide a page based image rendering system which is capable of generating 3D graphics image by page based rendering technique
In order to accomplish the above objects, the present invention provides a method of rendering a 3D graphics image, comprising the steps of:
(a) dividing a plurality of primitives having respective primitive identifications (primitive IDs) into a plurality of pages having respective page identifications (page IDs), wherein each of the pages contains an uneven number of the primitives;
(b) sorting the primitives for each of the pages, and storing the sorted primitives into a page RAM under a plurality of page nodes which correspond with the sorted page IDs, wherein each of the sorted primitives is stored under one of the page nodes according with the respective page ID of the sorted primitives;
(c) matching incoming page IDs of the incoming primitive IDs with the page IDs stored in the page RAM, in such a manner that when the incoming page ID of the incoming primitive matches with the sorted page ID stored in the page RAM, the incoming primitive is stored at the corresponding page node under in the page RAM the corresponding page ID, wherein when the incoming page ID of the incoming primitive does not match with the sorted page ID, a new page node is created under the corresponding incoming page ID of the incoming primitive which is stored at the new page node; and
(d) rendering the primitives stored in the page memory into pixels which are displayed to form a 3D graphic image when the page RAM is less than a predetermined amount of capacity.
These and other objectives, features, and advantages of the present invention will become apparent from the following detailed description, the accompanying drawings, and the appended claims.
Referring to
Referring to
(a) dividing a plurality of primitives having respective primitive identifications (primitive IDs) into a plurality of pages having respective page identifications (page IDs), wherein each of the pages contains an uneven number of the primitives;
(b) sorting the primitives for each of the pages, and storing the sorted primitives into a page RAM under a plurality of page nodes corresponding with the sorted page IDs, wherein each of the sorted primitives is stored under one of the page nodes according with the respective page ID of the sorted primitives;
(c) matching incoming page IDs of the incoming primitive IDs with the page IDs stored in the page RAM in such a manner that, when the incoming page ID of the incoming primitive matches with the sorted page ID stored in the page RAM, the incoming primitive is stored at the corresponding page node in the page RAM under the corresponding page ID, wherein when the incoming page ID of the incoming primitive does not match with the sorted page ID, a new page node is created under the corresponding incoming page ID of the incoming primitive which is stored at the new page node; and
(d) rendering the primitives stored in the page memory into pixels which are displayed to form a 3D graphic image when the page RAM is less than a predetermined amount of capacity.
Prior to the step (a), the primitives are pre-created and stored in a primitive bank which is to be retrieved for rendering the 3D graphics image. The primitives are divided into a numbers of segments represented by pages which are the basic building blocks for further processing. At the meanwhile, each of the primitives is designated by a primitive identification (ID) while each of the pages is designated by a page identification (ID).
In the step (b), the sorting the primitives for each of the pages is performed by a sorting device comprising a page sorting engine and a page RAM. The sorting of the primitives ID and the pages ID are transferred to the page RAM which is a one-chip memory, and stored as a predetermined page node. Page sorting engine checks incoming primitives' ID with the ones stored in the page RAM. Where the incoming primitive's page ID matches with the relevant stored page IDs, the incoming primitive would be stored to an existing node of the page RAM under the same ID. Where the incoming primitive's page ID does not match with any page ID stored in the page RAM, a new page node would be created for storing that new primitive's page ID under the corresponding primitive ID.
When the memory resources of the page RAM less than a predetermined amount, the page nodes, having the corresponding page IDs and the primitives stored under those page IDs, are sent to a tile raster. The tile raster receives page IDs and the primitive list from the page nodes and renders all the primitives of the page nodes.
Specifically, the tile raster is adapted to convert the primitives into many tiles which cover the whole display screen. According to the preferred embodiment of the present invention, a total of sixteen (16) tiles are utilized for the purpose of primitives storage and division.
Referring to
(d.1) creating a plurality of tiles for the display screen;
(d.2) interpolating depths, colors, and texture coordinates for each pixel within each of the tiles;
(d.3) calculating pixel colors, pixel depths and pixel texture for each of the primitives stored in the page RAM, and loading the pixel colors and the pixel depths into a color cache and a depth cache respectively; and
(d.4) generating corresponding pixels with respect to the pixel colors and the pixels depths for each of the tiles to produce a 3D graphics image.
According to the preferred embodiment, the data of tiles to be created are sent to the tiling engine directly. Tiling Engine interpolates depths, colors, and texture coordinates for each of the pixels of each of the tiles. These data then go through texture engine and pixel shader to calculate the pixel color and the pixel depth. The pixel color and the pixel depth are written into color cache and depth cache and finally written into a frame buffer.
Referring to
(c.1′) converting the primitives in the page RAM into a plurality of tiles, wherein each of the tiles has a predetermined number of coverage masks determined by a Tile Raster;
(c.2′) sorting the tiles and storing the sorted tiles in a tile RAM;
(c.3′) verifying the number of primitives for each of the tiles, in such a manner that when the number of primitives exceeds a predetermined number, the corresponding tile is flushed into another tile.
Note that the number of primitives for each of the tiles should be a matter of customarily discretion, yet according to the preferred embodiment of the present invention, a tile of 4×4 is utilized.
Moreover, the tile RAM has nodes for all tiles on a page, each slot store up to 4 pairs of the coverage masks containing the respective primitive IDs. Tile Sorting updates the number of the primitives to take into account the incoming data. If the maximum primitive's count of the tile reaches 4, this single tile is flushed in to next engines. And when all primitives raster are done, the tiles of whole page are sent into Tiling Engine in the spatial order.
From the forgoing descriptions, it can be shown that the present invention also provides a page based 3D graphics rendering system for a displaying screen which is divided into a plurality of tiles, comprising a primitive bank 10, a page sorting device 20, and an interpolator engine 30.
The primitive bank 10 stores a plurality of primitives having respective primitive IDs, wherein the primitives are divided into a plurality of pages having respective page IDs.
The page sorting device 20 is electrically connected with the primitive bank 10 and adapted to sort the pages of the primitives with respective to the pages IDs.
The interpolator engine 30 electrically communicated with the page sorting device 20 for rendering the primitives sorted in the page sorting device into pixels which are displayed on the display screen in the tiles to form a 3D graphic image.
According to the preferred embodiment, referring to
The interpolator engine 30 comprises a tile raster 31 adapted to render all primitives of the page nodes. Specifically, when the memory resources of the page RAM 22 less than a predetermined amount, the page nodes, having the corresponding page IDs and the primitives stored under those page IDs, are sent to a tile raster 31. The tile raster 31 receives page IDs and the primitive list from the page nodes, and renders all primitives of the page nodes.
The tile raster 31 is adapted to convert the primitives into many tiles which cover the whole display screen. According to the preferred embodiment of the present invention, a total 16 tiles are utilized for the purpose of primitives storage and division.
As shown in
One skilled in the art will understand that the embodiment of the present invention as shown in the drawings and described above is exemplary only and not intended to be limiting.
It will thus be seen that the objects of the present invention have been fully and effectively accomplished. It embodiments have been shown and described for the purposes of illustrating the functional and structural principles of the present invention and is subject to change without departure from such principles. Therefore, this invention includes all modifications encompassed within the spirit and scope of the following claims.
This is a regular application of a provisional application, application number 60/634,681, filed Dec. 08, 2004.
Number | Date | Country | |
---|---|---|---|
60634681 | Dec 2004 | US |