FIELD OF THE INVENTIONThe present invention relates generally to the field of computer generated graphics. More particularly, the present invention relates to a method and apparatus for efficiently rendering transparent objects in a complex transparent scene.[0001]
BACKGROUND OF THE INVENTIONComputer graphics is used in a wide variety of applications, such as in business, science, animation, simulation, computer-aided design, process control, electronic publishing, gaming, medical diagnosis, etc. In an effort to portray a more realistic real-world representation, three dimensional objects are transformed into models having the illusion of depth for display onto a two-dimensional computer screen. This is accomplished by using a number of polygons to represent a three-dimensional object. Next, a scan conversion process is used to determine which pixels of a computer display fall within each of the specified polygons. Thereupon, texture is selectively applied to those pixels residing within specified polygons. Finally, lighting, shading, shadowing, translucency, and blending effects are applied.[0002]
For a high resolution display (1280=1024) having over a million pixels, for which values must be generated for each and every pixel, displaying a three-dimensional scene on a computer system is a rather complicated task. Processes like lighting, shading, shadowing, texture mapping, blending, etc., are particularly computation intensive, requiring a tremendous amount of processing power. Indeed, even more processing power is necessary for displaying interactive computer graphics, where 3-D images change in response to a user input (e.g. flight simulation). Naturally, the more complex the scene, the more processing power will be required to render that scene.[0003]
Although throughput of computer graphics systems has increased considerably in recent years, the size and complexity of three-dimension scenes have been growing even faster. Scenes composed of millions of polygons are no longer uncommon. In light of the enormous processing power necessary to generate highly-complex scenes and the limitations in the speed of currently available hardware, there have been efforts to develop more efficient methods to simplify the task of rendering three-dimensional images. One such method is known as visibility culling or occlusion culling. Simply put, visibility culling limits the number of polygons rendered in each frame by removing hidden or obscured surfaces from the graphics pipeline. When these hidden surfaces are culled away, highly complex scenes can be rendered at a very high rate.[0004]
Visibility culling for opaque surfaces is typically performed with a method known as Z-buffer visibility culling. Essentially, Z-buffer visibility culling involves utilizing a Z-buffer for storing the Z-values for a small number of potentially occluding polygons of a scene, and comparing Z-values of a potentially occluded polygon of the scene with the Z-values stored in the Z-buffer before the potentially occluded polygon is drawn. If it is determined that the Z-values of the potentially occluded polygon represents a closer distance to the view point than that represented by the Z-values in the Z-buffer, then the potentially occluded polygon is drawn. Otherwise, the potentially occluded polygon is rejected from the graphics pipeline. In this way, processing bandwidth is not wasted on occluded objects, effectively increasing rendering efficiency.[0005]
Z-buffers, however, do not handle transparent or partially transparent polygons well. For instance, imagine a scene having a partially transparent polygon and an opaque one. If the Z-buffer stores the Z-values of the partially transparent polygon, then the opaque polygon may not be drawn if it is positioned behind the partially transparent polygon. On the other hand, if the Z-buffer does not store the Z-values of the partially transparent polygon, there will not be sufficient information to determine the polygons' relative order. Then, the partially transparent polygon will not be culled away even if it is positioned behind the opaque polygon. Hence, partially transparent or translucent polygons cannot contribute to an accurate, conventional Z-buffer or occlusion test. This yields inefficiencies in scenes containing such polygons and surfaces.[0006]
Thus, what is needed is a method and apparatus for accelerating the rendering of complex transparent scenes. What is further needed is a method and apparatus for performing visibility culling that is capable of handling transparent and partially transparent polygons.[0007]
SUMMARY OF THE PRESENT DISCLOSUREThe present invention is a method of and apparatus for efficiently rendering a complex transparent scene. In furtherance of one embodiment of the present invention, the method comprises steps of determining Z-values for a pre-determined number of potential occluders selected from the transparent scene, storing the Z-values in a Z-stack, comparing Z-values of a potential occludee with the Z-values in the Z-stack, and removing the potential occludee from further processing provided that the Z-values of the potential occludee do not represent a closer distance from a view point than that represented by the Z-values in the Z-stack. Objectives of the present invention are achieved as processing efficiency is increased when substantially occluded objects are not further processed. Such an approach is validated by the observation that although a single partially transparent polygon is not an occluder, it is an attenuator of light. Hence, a plurality of such polygons positioned in succession along a viewing direction may be considered as occluders.[0008]
In accordance with one embodiment of the present invention, a Z-stack comprises a three-dimensional array for storing Z-values of the potential occluders. Particularly, each Z-stack includes a plurality of Z-maps corresponding to different depth levels of the transparent scene. Each pixel is associated with an entry in each of the Z-maps, and each entry include a Z-value corresponding to a distance from the view point to the point on one of the overlapping objects. In one embodiment, the Z-maps are ranked in a descending order with the highest ranked Z-map associating with the frontmost surface of the frontmost objects in the scene, and the lowest ranked Z-map associating with the backmost surface of the backmost objects visible in the scene. In another embodiment, a plurality of pixels are mapped to each entry of the Z-maps for increased processing efficiency.[0009]
In one embodiment of the present invention, the Z-values of the potential occluders are computed by the CPU(s) of a computer system. In that embodiment, a bounded volume comprising simple geometrical primitives is first determined for each of the potential occluders. Because Z-values for simple geometrical primitives can be quickly calculated by the CPU, the Z-values for the potential occluders can be easily calculated. The computed Z-values are then stored in the Z-stack according to their respective depth levels in the scene. In one embodiment of the present invention, Z-values that represent a closer distance from the view point are stored in a higher-ranked Z-map, and Z-values that represent a farther distance from the view point are stored in a lower-ranked Z-map. In one embodiment, new Z-value replaces the Z-value stored in one of the Z-maps if the new Z-value represents a closer distance to the view point than that of the stored Z-value. The replaced Z-value is then stored in a lower-ranked Z-map. The use of a bounded volume generates a conservative but efficient representation of the occluder's extent. In another embodiment, the exact occluder's extent may be generated by direct calculation.[0010]
In yet another embodiment of the present invention, the Z-values of the potential occluders may be determined by graphics hardware. In that embodiment, potential occluders are sent to the graphics hardware to be drawn, and the Z-values associated with the potential occluders are returned from the graphics hardware (e.g. by reading the hardware Z-buffer). The Z-values are then stored in a software Z-stack within the memory of the computer system. In yet another embodiment of the present invention, the Z-stack may be implemented in hardware and may be further implemented in the graphics hardware of the computer system, or in a specialized computational unit.[0011]
According to one embodiment of the present invention, after the Z-values of the potential occluders are stored in the Z-stack, objects or surfaces not designated as potential occluders (also known as potential occludees) are tested against the Z-stacks. In one embodiment of the present invention, Z-values of a potential occludee are compared against the Z-values of the potential occluders in the Z-stack. If the Z-values of the potential occludee do not represent a closer distance from a view point than that of the Z-values in the Z-stack, the potential occludee is considered occluded, and it is removed from further processing. Otherwise, the potential occludee is further processed. Alternatively, Z-values of the potential occludees may be calculated by CPU using a bounding volume approximation method as described above, or may be determined by graphics hardware.[0012]
In furtherance of one embodiment of the present invention, the Z-maps of the Z-stack may have a lower resolution than that of the frame buffer. In one embodiment, a coarser resolution is achieved by representing the Z-values of a group of pixels by a highest Z-value associated with the group. Alternatively, an average Z-value associated with a group of pixels may be used.[0013]
BRIEF DESCRIPTION OF THE DRAWINGSThe accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments of the present invention and, together with the description, serve to explain the principles of the invention.[0014]
FIG. 1 illustrates an exemplary computer system used as part of a computer graphics system in accordance with one embodiment of the present invention.[0015]
FIG. 2A illustrates an exemplary transparent scene that may be rendered according to one embodiment of the present invention.[0016]
FIG. 2B illustrates a Z-map corresponding to a higher depth level of a Z-stack according to one embodiment of the present invention.[0017]
FIG. 2C illustrates a Z-map corresponding to a lower depth level of a Z-stack according to one embodiment of the present invention.[0018]
FIG. 3 is a flow diagram illustrating the process of setting up a Z-stack according to one embodiment of the present invention.[0019]
FIG. 4A is a flow diagram illustrating the process of determining the Z-values of potential occluders according to one embodiment of the present invention.[0020]
FIG. 4B is a flow diagram illustrating the process of determining Z-values for potential occluders according to another embodiment of the present invention.[0021]
FIG. 5 is a flow diagram illustrating the process of culling potential occludees according to the present embodiment.[0022]
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTSReference will now be made in detail to the present embodiments of the invention, examples of which are illustrated in the accompanying drawings. While the invention will be described in conjunction with the present embodiments, it will be understood that they are not intended to limit the invention to these embodiments. On the contrary, the invention is intended to cover alternatives, modifications and equivalents, which may be included within the spirit and scope of the invention as defined by the appended claims. Furthermore, in the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be obvious, however, to one skilled in the art, upon reading this disclosure, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are not described in detail in order to avoid obscuring aspects of the present invention.[0023]
Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “receiving”, “determining”, “transmitting”, “inserting”, “sorting” or the like, refer to the actions and processes of a computer system, or similar electronic computing device. The computer system or similar electronic device manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission, or display devices.[0024]
I. COMPUTER SYSTEM ENVIRONMENT OF THE PRESENT INVENTIONWith reference to FIG. 1, portions of the present invention are comprised of computer-readable and computer executable instructions which reside, for example, in computer-usable media of a computer system. FIG. 1 illustrates an[0025]exemplary computer system110 used as a part of a computer graphics system in accordance with one embodiment of the present invention. It is appreciated thatsystem110 of FIG. 1 is exemplary only and that the present invention can operate within a number of different computer systems including general purpose computer systems, embedded computer systems, and stand alone computer systems specially adapted for generating 3-D graphics.
[0026]System110 of FIG. 1 includes an address/data bus100 for communicating information, and acentral processor unit101 coupled tobus100 for processing information and instructions.System110 also includes data storage features such as computer usablevolatile memory102, e.g. random access memory (RAM), coupled tobus100 for storing information and instructions forcentral processor unit101, computer usablenon-volatile memory103, e.g. read only memory (ROM), coupled tobus100 for storing static information and instructions for thecentral processor unit101, and a data storage device104 (e.g., a magnetic or optical disk and disk drive) coupled tobus100 for storing information and instructions. A graphics subsystem108 (e.g. a network card) coupled tobus100 is also included insystem110 of FIG. 1.System110 of the present high-speed transparent scene rendering system also includes an optionalalphanumeric input device106 including alphanumeric and function keys is coupled tobus100 for communicating information and command selections tocentral processor unit101.System110 also optionally includes acursor control device107 coupled tobus100 for communicating user input information and command selections tocentral processor unit101.System110 of the present embodiment also includes anoptional display device105 coupled tobus100 for displaying information.
[0027]Display device105 of FIG. 1, utilized with the present invention, may be a liquid crystal device, cathode ray tube, or other display device suitable for displaying 3-D graphic images and alphanumeric characters recognizable to a user. Optionalcursor control device107 allows the computer user to dynamically signal the two dimensional movement of a visible symbol (cursor) on a display screen ofdisplay device105. Many implementations ofcursor control device105 are known in the art including a trackball, mouse, touch pad, joystick or special keys onalphanumeric input device106 capable of signaling movement of a given direction or manner of displacement. Alternatively, it will be appreciated that a cursor can be directed and/or activated via input fromalphanumeric input device107 using special keys and key sequence commands. The present invention is also well suited to directing a cursor by other means such as, for example, voice commands. A more detailed discussion of the present complex transparent scene rendering system is found below.
II. DETERMINING A NUMBER OF POLYGON LAYERS REQUIRED TO ACHIEVE OCCLUSION EFFECTIn the following discussion, unless otherwise noted, it is assumed that each pixel is associated with a transmission coefficient k which ranges from 0 to 1. When k is 0, the polygon is opaque and transmits no light; when k is 1, the polygon is perfectly transparent. Further, it is assumed that light attenuation is cumulative. That is, for two overlapping polygons each having a uniform transparency of 0.5, a cumulative transparency of the overlapping polygons would be 0.5*0.5 or 0.25. Likewise, for three overlapping polygons each having a uniform transparency of 0.1, 0.2 and 0.3, respectively, the cumulative transparency would be 0.1*0.2*0.3 or 0.006.[0028]
One of the key factors influencing how fast a transparent scenes can be rendered relates to the fact that low cumulative transparency is approximately opaque. For instance, for a scene having an average transparency of 0.1, three overlapping polygons will probably have a cumulative transparency of 0.001. In that scene, it would be safe to assume that objects located behind four to five layers of polygons are substantially occluded. Therefore, in the following discussion, unless noted otherwise, objects that are substantially occluded by layers of translucent polygons are considered invisible.[0029]
According to one embodiment of the present invention, a minimum number of layers of translucent polygons necessary for substantially occluding other objects is determined by a user. In alternative embodiments, the minimum number may be determined by calculating an average transparency of polygons in the scene, and by calculating the number of layers of polygon having the average transparency value required to achieve a predetermined visibility threshold. For example, if it is determined that the average transparency is 0.2 and that the user selected a visibility threshold of 0.01, then it can be easily calculated that a minimum number of layers of overlapping polygons for producing an occlusion effect is 3. Generally, the larger the visibility threshold, more objects will be occluded and rendering efficiency is increased. However, a large visibility threshold may also cause a decrease in rendering accuracy. It should be apparent to a person of ordinary skill in the art, upon reading the present disclosure, that other methods may be used to determine the minimum number of layers of translucent polygons necessary for producing an occlusion effect.[0030]
III. USING Z-STACK TO STORE DEPTH INFORMATION OF POTENTIAL OCCLUDERSFIG. 2A is an exemplary[0031]transparent scene200 that is used herein to illustrate principles of the present invention. For simplicity,transparent scene200 comprises three translucent objects—twotriangles210 and230, and arectangle220. As shown in FIG. 2,triangle210 is closest to the viewpoint, followed byrectangle220 andtriangle230. Particularly,triangle210 has a depth value, or Z-value, of 3,rectangle220 has a Z-value of 5, andtriangle210 has a Z-value of 10.Rectangle220 comprises twosections221, and222.Section221 is overlapped bytriangle210, andsection222 overlaps part oftriangle230. Lastly,triangle230 comprises threesections231,232, and233.Section231 is not overlapped by other objects, whilesection232 is overlapped byrectangle220, andsection233 is overlapped by bothrectangle220 andtriangle210.
For simplicity,[0032]triangles210 and230, andrectangle220 have a transmission coefficient of 0.2. Further, as an example, a visibility threshold is set to be 0.05. That is, objects hidden behind polygons with a cumulative transmission coefficient of 0.05 will be considered invisible. The average transmission coefficient is 0.2. Therefore, occlusion effect would be achieved by superimposing two layers of translucent polygons to cumulatively produce a combined transmission coefficient of 0.04.
In the exemplary[0033]transparent scene200,triangle210 andrectangle220 has a cumulative transparency of 0.04. Since an visibility threshold is set to be 0.05, objects overlapped by bothtriangle210 andrectangle220 will be considered invisible. Thus,section233 oftriangle230, which hidden behind two layers of translucent objects (triangle210 and rectangle220) is not visible. Likewise, other objects or polygons, if hidden behind two layers of translucent objects, will also be selected for culling. In this way, processing power of a computer system will not be wasted on essentially invisible polygons, and processing efficiently of a computer system implemented with the present invention would be significantly increased.
According to one embodiment of the present invention, occlusion culling of transparent polygons is attained by the use of a Z-stack, or a stack of Z-maps to store depth information of the transparent objects. A Z-stack may be implemented in software and may reside within[0034]RAM102 ofcomputer system110. An exemplary Z-stack, which contains depth information ofexemplary scene200 of FIG. 2A, is illustrated in FIGS.2B-2C. In the specific embodiment as illustrated, the Z-stack comprises two Z-maps250a-250bcorresponding to a minimum number of polygon layers required for achieving an occlusion effect. First Z-map250acontains Z-values corresponding to a frontmost surface of the objects in the scene. As shown in FIG. 2A, thefirst triangle210 inscene200 has a Z-value of 3. Accordingly, portions of Z-map250acorresponding to thefirst triangle210 contain the Z-value 3. Further, portions of Z-map250acorresponding tosection222 ofrectangle220 contain the Z-value 5. Z-values ofsection221 of therectangle220, however, are not stored in the first Z-map250a. Rather, Z-values ofsection221 are stored in second Z-map250b. Further, portions of Z-map250acorresponding tosection231 ofsecond triangle230 contain Z-value of 10. Z-values corresponding tosections232 and233 oftriangle230, however, are not stored in Z-map250a. Objects that are far away have a larger Z-value than objects that are close. Further, when the Z-maps250a-250bare first initialized, all the entries contain a depth value of ∞, or a large arbitrary number.
In the specific embodiment as illustrated, Z-values corresponding to deeper levels of the transparent objects are stored in a lower-ranked Z-map[0035]250b. Particularly, Z-values corresponding tosection221 ofrectangle220 are stored in Z-map250b. Portions of Z-map250bcorresponding tosection221 ofrectangle220 contain the Z-value of 5. Further, portions of Z-map250bcorresponding tosection232 oftriangle230 contain the Z-value of 2. Z-values corresponding tosection233 oftriangle230 may be stored in additional Z-maps (not shown) of the Z-stack. Alternatively, Z-values ofsection233 are simply not stored because it is pre-defined that objects hidden behind two layers of polygons are occluded.
It should be noted that, in one embodiment of the present invention, the Z-maps may have a lower resolution than that of the frame buffer. A lower resolution would allow the Z-value computations to be performed quickly. In one embodiment, a coarser resolution is achieved by representing the Z-values of a group of pixels by a highest Z-value associated with the group, representing a more conservative culling approach. Alternatively, in a more aggressive culling approach, an average Z-value associated with a group of pixels may be used. It should also be noted that, as illustrated in FIGS. 2B and 2C, Z-maps[0036]250aand250bof the Z-stack have the same resolution and include a same number of entries for storing Z-values.
FIG. 3 is a flow diagram illustrating the process of setting up a Z-stack according to one embodiment of the present invention. In[0037]step310, a number of potential occluders are selected from all the polygons in the scene. According to the present embodiment, the potential occluders are selected based on historical information. For instance, a polygon which was visible in the previous frame is selected as a potential occluder in the present frame because there is a high probability that the polygon will be visible and occluding others in the present frame. It should be apparent to those ordinarily skilled in the art, upon reading the present disclosure, that a list of potential occluders may also be selected from a previous frame under various different criteria.
In one embodiment of the present invention, the number of polygons or objects chosen as potential occluders is user-selectable. Generally, an optimal number of potential occluders is dependent on the hardware used, and the nature of the graphics data that are being presented. For instance, a large number of potential occluders may be selected if the graphics hardware has a large processing bandwidth, or if a scene being rendered includes a large number of fine objects or polygons. In the present embodiment, the number of polygons or objects chosen as potential occluders is 10% to 15% of the total number of polygons in the scene. For very large scenes, the number of polygons or objects chosen as potential occluders may fall to under 1% of the total number of polygons in the scene.[0038]
In[0039]step315, Z-values, or depth values, for the selected potential occluders are determined. According to the present embodiment, Z-values for the potential occluders may be determined by graphics hardware or by CPU computation. The method of determining the Z-values by CPU computation in detail in Section IV below, and the method of determining Z-values by graphics hardware is discussed is discussed in Section V below.
In[0040]step320, a highest-ranked Z-map of the Z-stack is selected. In one embodiment, the highest-ranked Z-map is for storing Z-values representing frontmost surfaces of frontmost objects visible in the scene. With respect to the Z-stack as illustrated in FIGS.2B-2C, the highest-ranked Z-map corresponds to the first Z-map250a.
In step[0041]325, newly determined Z-values for the selected potential occluder are compared against the Z-values contained in the selected Z-map. In the present embodiment, the Z-values are compared pixel-by-pixel. For example, new Z-value associated with a pixel is compared with the stored Z-value associated with the same pixel.
In[0042]step330, it is determined whether the newly determined Z-values for the selected potential occluder represent a closer distance than that represented by the Z-values in the selected Z-map. Further, in the specific embodiment as illustrated in FIGS.2B-2C, a closer distance is represented by a lower Z-value. A Z-value of 3 is closer than a Z-value of 5. However, it should be understood that, in other embodiments of the present invention, closer distances may also be represented by a higher Z-value.
In[0043]step335, if the newly determined Z-values for the selected potential occluder represent a closer distance, then the new Z-values are written in the selected Z-map.
In[0044]step340, the old Z-values of the selected Z-map are recursively pushed down the Z-stack to replace Z-values in lower-ranked Z-maps. For example, in the specific embodiments as illustrated in FIGS.2B-2C, if Z-values are written in first Z-map250a, the replaced Z-values originally stored in first Z-map250awill be pushed down and stored in second Z-map250b. The process is repeated until Z-values stored in the lowest-ranked Z-map are pushed out of the Z-stack and discarded.
In[0045]step355, after the new Z-values are stored in the Z-stack, it is determined whether all the potential occluders have been processed. If all potential occluders have been processed, the process returns. Otherwise, steps310 through355 are repeated for another potential occluder.
If it is determined that, in[0046]step340, the newly determined Z-values do not represent a closer distance than the Z-values stored in the selected Z-map, then, in step350, it is determined whether the end of the Z-stack has been reached. If the end of the Z-stack has not been reached yet, instep360, a next lower-ranked Z-map in the Z-stack is selected, and steps325 through360 are then repeated.
If it is determined that the end of the Z-stack has already been reached, then the object associated with the new Z-values are considered to be irrelevant. Thus, in step[0047]350, the new Z-values are discarded, and instep355, it is determined whether all the potential occluders have been processed. If so, the process returns. Otherwise, steps310 through355 are repeated for another potential occluder.
IV. Z-VALUE COMPUTATION USING BOUNDED-VOLUME APPROXIMATIONAccording to one embodiment of the present invention, potential occluders may have a variety of sizes and shapes. For some objects having a complex geometrical shape, it may be too CPU-intensive to calculate their precise Z-values in real time for interactive applications. Moreover, architecture of currently available CPUs are typically not adapted for high-speed graphics processing. Thus, it is advantageous to use a bounded-volume approximation method to determine the Z-values of the potential occludees. FIG. 4A is a flow diagram illustrating the process of determining the Z-values of potential occluders according to the present embodiment.[0048]
In the present embodiment, a hierarchical graphics model is adopted. Essentially, in a hierarchical graphics model, relationships of objects in a model are represented with a tree structure. Usually, a tree structure is made up of a root node, and a number of other nodes which are children or grand-children of the root node. Each node may have one or more dependent or “child” node. Significantly, each node has a bounded volume (or bounded box) which is a largest simple 3-D primitive (e.g. a cube) that can be fitted within the geometric extent of that node. It is important to note the distinction between a bounded volume and a bounding volume. A bounding volume, in contrast to a bounded volume, is the smallest simple 3-D primitive which encompasses the entire geometric extent of that node. For example, a model of a hand may be represented by a root node (hand), and five nodes, each representing a finger, which are children of the root node. Each finger node may in turn beget children nodes such as nails, finger print, etc. In addition, the root node will have a bounded volume which can be fitted within the geometric extent of the entire hand. The root node will also have a bounding volume which encompasses the entire geometric extent of the hand. For increased flexibility, the bounded volume may be a collection of boxes or other low polygon-count geometries.[0049]
Referring to FIG. 4A, in[0050]step410, a bounded volume of a potential occluder is determined. As discussed above, a bounded volume is the largest 3-D primitive that can be fitted within the extent of the potential occluder. In one embodiment of the present invention, for ease of computation, the geometrical shape may be a cube or a rectangular box. Methods for determining a bounded volume for 3-D objects are well known in the art. Therefore, such methods are not discussed here in detail so as to avoid obscuring aspects of the present invention.
In[0051]step420, Z-values of the surfaces of the bounded volume are calculated. The methods of calculating Z-values of a surface of 3-D objects are well known in the art. Therefore, details of such implementations are also not discussed here so as to avoid obscuring aspects of the present invention. After the Z-values are calculated, the Z-values will then be used in other steps of the occlusion culling process.
V. Z-VALUE COMPUTATION USING DEDICATED GRAPHICS HARDWAREAccording to another embodiment of the present invention, Z-values of potential occluders may be calculated by dedicated graphics hardware. In one embodiment of the present invention, dedicated graphics hardware includes a hardware Z-buffer for storing Z-values of polygons that are drawn. FIG. 4B illustrates the process of determining Z-values for potential occluders according to the present embodiment. As illustrated in FIG. 4B, in[0052]step430, a potential occluder is sent down the graphics pipeline to be rendered. The potential occluder is treated as an opaque object when drawn such that Z-values of the potential occluder is stored in the hardware Z-buffer.
In[0053]step440, the Z-values of the potential occluder is read back from the dedicated graphics hardware to be stored in a Z-stack according to the process described above in Section11. After a potential occluder is drawn, the hardware Z-buffer is flushed.
In another embodiment of the present invention, the Z-stack may be implemented in hardware. Unlike conventional graphics hardware which includes a single Z-buffer for storing depth information of a scene, special graphics hardware according to the present invention includes a stack of Z-buffers for storing Z-values representing different depth levels of the transparent objects. In this embodiment, each of the Z-buffers of the Z-buffer stack is configured for storing Z-values at a particular depth level. For instance, Z-values representing distances of the frontmost surfaces of the frontmost objects are stored in a first one of the Z-buffers. Similarly, Z-values of polygons in the second layer are stored in a second one of the Z-buffers. In this embodiment, potential occluders may be drawn before Z-values are read back from the graphics hardware. Further, according to the present embodiment, the Z-values stored in the Z-buffers may be read back into system memory to be stored in a Z-stack after all the potential occluders have been drawn.[0054]
It is important to note that ordered rendering is required for good transparent rendering. This could be achieved by a corresponding frame buffer stack with a final compositing stage after all polygons have been received.[0055]
VI. TESTING OBJECTS AND POLYGONS AGAINST Z-STACKIn one embodiment of the present invention, each object or polygon in the scene is tested against the Z-stack to determine whether the object or the polygon is occluded by the potential occluders. Objects that are not selected as potential occluders are referred to as potential occludees. FIG. 5 is a flow diagram illustrating the process of culling potential occludees according to the present embodiment. As illustrated in FIG. 5, in[0056]step510, a bounding volume of the potential occludee is determined. In accordance with one embodiment of the present invention, a bounding volume may be the smallest rectangular box that may be fitted around the potential occludee. As discussed above in Section IV, methods of determining the bounding volume for a 3-D object is well known in the art, and are therefore not discussed here in order to avoid obscuring aspects of the present invention.
In[0057]step520, Z-values for the corners of the bounding volume are determined. The Z-values for the corners of the bounding volume may be determined by conventional methods.
In[0058]step530, Z-values for the corners of the bounding volume are compared against the Z-values stored in the Z-stack. If the Z-values for the corners of the bounding volume represent a closer distance than those represented by the Z-values stored in the Z-stack, then the potential occludee is likely to be visible. Thus, instep560, further rendering processes are performed for the potential occludee, and the potential occludee is drawn.
However, if the Z-values for the corners of the bounding volume represent a farther distance than those represented by the Z-values stored in the Z-stack, then the potential occludee is more likely to be substantially occluded. Hence, in[0059]step550, a more detailed visibility test (e.g. a 3-face visibility test) is performed to determine the visibility of the polygons. More detailed visibility tests, such as the 3-face visibility test, are well known in the art. Therefore, it should be apparent to those ordinarily skilled in the art, upon reading the present disclosure, that other well known visibility tests may also be applied.
In[0060]step555, if it is determined that the potential occludee is occluded, the potential occludee is culled away or removed from the graphics pipeline. In this way processing power is not wasted on objects that are substantially occluded.
In furtherance of one embodiment of the present invention, each polygon or object within the scene is associated with a “tag” for identifying the polygon or object. Further, in this embodiment, a list containing tags associated with potential occluders represented in the Z-stack is maintained. When it is determined that a new polygon or object is visible, the list is updated to include the tag associated with the new polygon or object. In this way, after a frame is completely rendered, a list containing tags associated with all the visible polygons is resulted. The list may then be consulted when a next frame is rendered. In applications where polygons and object do not change randomly from one frame to another, this approach will significantly increase rendering efficiency as visible polygons or objects in one frame are likely to be potential occluders in the next frame.[0061]
The method of and apparatus for efficiently rendering a complex transparent scene has thus been described. By using the method of the present invention, objects hidden underneath layers of semi-transparent polygons may be culled, thus effectively minimizing the processing power wasted on the hidden polygons. Thus, complex transparent scenes may be rendered on machines with limited processing power. Another significant benefit of the present invention is that the Z-stack stores depth information of the most visible polygons in the scene, allowing optimal back-to-front rendering. Yet another benefit of the present invention is that the Z-stack allows culling to be performed on multiple processors simultaneously and followed by optimal fast rendering.[0062]