Background of the Invention
The present invention generally relates to color graphics computers and displays. More particularly, the invention is directed to methods, systems and programs for logically partitioning an RGB graphics system of gamma ramp architecture to provide independent storage of multiple shaded color images. The methods, systems and programs are particularly valuable in animation applications, where the use of hardware defined overlays is limited by count or diversity of color.
Personal computers and workstations have evolved from those which generated simple monochrome alphanumeric images on a video display, to those capable of two-dimensional color graphics, and most recently into systems capable of generating three-dimensional color graphics with limited animation. The computational and time burden associated with rendering a complex (non-wire frame) object in fully shaded color is a challenge for all but supercomputers, if animation is desired. The difficulty is attributable to the fact that animation, and in particularly multiple object animation, requires not only that the animated object be regenerated, but also that the background be recreated upon a translation of the animated object or objects. Consequently, the animation of a complex shaped object in the context of a complex background is a significant challenge.
Available technological approaches to providing real-time animation all have drawbacks. The creation and movement of images in wireframe representation lacks the realism of a shaded image. Flipbook animation techniques, whereby a series of images are created and stored in incremental motion states for subsequent playback at real-time rates, do not permit the user to interact with the moving image and affect it in a contemporaneous fashion.
Even in the absence of full, photorealistic color animation, it is particularly desirable to have a personal computer or workstation with resources which allow a user to interact with three-dimensional color images at rates approaching real time. This situation exists independent of classical animation, such as when a graphics workstation user repositions a complex color image in the context of a complex color background.
The conventional solution to creating and moving complex images situated over a complex background in real time and without regeneration involves the use of overlays. A classical overlay is a single color grid pattern, which if superimposed on a complex video screen image is removable without requiring that the complex image be regenerated. A discussion of overlays, and in particular overlays which relate to specific windows on a video display, appears in U.S. Pat. No. 5,469,541. A common deficiency of overlays, which makes them undesirable for animation, is the low number of bits per pixel. A representative premium quality workstation will have four overlays of single bit information per overlay. Consequently, such design provides one overlay image of 15 colors, while fully consuming all overlay resources, if the animation is accomplished through the overlays.
High resolution color graphics workstations tend to follow one of two design approaches in the storage of color data within the frame buffer. The first class is generally known as "color index frame buffer storage". The second is generally referred to as "gamma ramp frame buffer storage". The former, color index frame buffer storage, typically uses up to 12 bits per pixel to provide a maximum range of approximately four thousand different colors per pixel position. The other, gamma ramp frame buffer storage, has each pixel position represented by 24 bits, composed of 8 bit red, 8 bit green and 8 bit blue segments. The gamma ramp implementation provides in excess of 16 million different colors, and as such is believed to approach the limits of human visual color differentiation.
The problem of providing animation for complex shaped and colored images and backgrounds in real-time and in the context of a gamma ramp configured workstation has proven to be elusive. Neither the architectures of conventional overlays nor the look-up table implemented digital to analog converters (commonly identified as RAMDACs) have the overlay bit content or pin count resources to avail a conventional workstation user of meaningful animation capability.
Summary of the Invention
The present invention defines methods, systems, and programs for using a gamma ramp frame buffer architecture workstation to render and manipulate at or near real time images composed of high resolution shaded color graphics in both foreground and background positions. The features are attained by selectively partitioning or subdividing the frame buffer so that each of the RGB color segments RGB are sub-divided into two or more parts, hereafter referred to as "partitions". During the writing of the frame buffer, the partitions not subject to writing are masked in conventional manner. The bit content written into each partition is scaled to match the allowable bit content and adjusted in offset depending on significance of the frame buffer address.
A preferable implementation utilizes dithering in the manner described in U.S. Pat. No. 4,956,638 to improve the color blend prior to rendering into those partitions which have a relatively low bit count. For instance, if an 8 bit emulation mode is utilized to generate the data for a 3-red, 3-green, and 3-blue partition of the frame buffer, dithering is a useful tool to eliminate color band distinctions in any shaded image. On the other hand, the remaining image, composed of 5-red, 5-green and 5-blue color segments, provides adequate color for rendering all but exceptionally unique and precise color images given that over 29 thousand colors are selectable from the 15 bits per pixel.
The partition of the frame buffer by color component, through the use of selective masking during the writing operation, is complemented during the conversion from binary digital frame buffer data to analog RBG signals by a selective programming of the color palette random access memory in the digital to analog converter (RAMDAC). This implementation provides two features. First, the physical connections between the gamma ramp configured frame buffer and each respective RAMDAC remain intact, in contrast to an arrangement in which additional overlays are created outside the context of the frame buffer. Secondly, an appropriate arrangement of the data in the color palette RAM ensures that the frame buffer defined color, whether it be in one or the other of the partitioned sections, is translated into the proper analog color signal. Foremost, all these are accomplished in such a way that both the foreground image, and the background image exist concurrently and completely in the frame buffer until specifically modified. Thus, the background image does not have to be regenerated upon the translation or other change of the foreground image and vice versa.
More generally, an image in one partition can be cleared, redrawn and manipulated without affecting the images in any of the other partitions. This is true without regard to the number of frame buffer partitions.
Furthermore, the "stacking order" of the partitions can be changed dynamically (i.e. very rapidly, without the need of regenerating any image) simply by loading a different color palette. By "stacking order" it is meant the order in which the images in the partitions appear visually. For example, in a two partition system, the foreground and the background can be interchanged, so that the previous background appears as the foreground, and vice versa, simply by computing and loading a different color palette. Similar remarks apply for systems divided into 3, 4, or more partitions.
The only limit on the number of partitions in a system is the total number of bit planes available. The sum total of the number of bit planes used in each partition must equal the number of hardware bit planes provided by the system.
Partitions can be any number of bits deep. The number of available colors in a partition is equal to
num colors=(2.sup.d -1).sup.3
where d=depth of partition, in bits.
Thus, a 1 bit partition provides 1 color, a 2 bit partition provides 27 colors, a 3 bit partion provides 343 colors, and so on.
These and other features of the invention will be more clearly understood and fully appreciated upon considering the detailed embodiments set forth here inafter.
Brief Description of the Drawings
FIG. 1 is a schematic block diagram of the functional elements in a workstation.
FIG. 2 is a schematic block diagram depicting the operation of a color index frame buffer.
FIG. 3 is a schematic block diagram depicting the conventional operation of a gamma ramp frame buffer.
FIG. 4 compares the structure and effects for one pixel in a partitioned color index arrangement of the frame buffer.
FIG. 5 schematic illustrates a partitioned gamma ramp frame buffer.
FIG. 6 schematically illustrates by block diagram the arrangement of a gamma ramp frame buffer in relation to video RAMDACs with overlay controls.
FIG. 7 schematically depicts a multiple image partitioning of the bits in a gamma ramp frame buffer.
FIG. 8-13 schematically depict by flow diagram program operations suitable to practice the invention.
FIG. 14 defines the nomenclature used in FIGS. 8-13.
FIG. 15 illustrates animation involving complex three-dimensional images.
Description of the Preferred Embodiment
FIG. 1 depicts by block diagram the basic functional elements in a personal computer or workstation to which the present invention relates. A representative product is the RISC System/6000 workstation with AIX operating systems software, both of which elements are commercially available products sold or licensed by International Business Machines Corporation. Such representative workstation includes various forms of memory 1, a general processor 2, a user interactive input/output 3, a graphics processor 4 and a video display 6. The present invention focuses on the graphic processor section, though data input from the general processor is needed as described hereinafter.
A representative prior art graphic processor apparatus and method to convert binary digital data stored in the frame buffer into analog signals suitable to drive a video display is schematically depicted in FIG. 2. As shown there, a 12 bit deep frame buffer 7 stores a 12 bit word for each pixel position, the 12 bit word representing a single color of 2.sup.12 =4096 available colors. The translation from the binary bits stored in the frame buffer to the individual red, green and blue color components of the video display is accomplished through color look-up table RAM 8. The resulting red, green and blue digital values for each 12 bit pixel are converted by digital to analog converters 9 and conveyed to drive video tube 11.
More recently workstations have begun to utilize gamma ramp frame buffer configurations, such as depicted in FIG. 3. With this architecture, the frame buffer 12 is physically divided into three regions which individually store the values of each color component as an 8 bit word. Thus, each pixel position is represented by a 24 bit combination of 8-red, 8-green and 8-blue components. According to this convention, each 8-bit color component is related to a distinct color look-up table, commonly known as a color palette RAM, as identified by reference numerals of 13, 14 and 16 in FIG. 3. Digital to analog conversion is accomplished in the three converters 17 before conveyance to video display 18.
Additional discussion about frame buffers, color look-up tables and digital to analog conversion for graphics workstations maybe found in U.S. Pat. No. 4,965,751. The use of shift registers to trade resolution for pixel bit depth is described in U.S. Pat. No. 4,783,652. The selective blanking of bit plane groups to accomplish priority and transparency is described in the IBM Technical Disclosure Bulletin, Vol. 32, No. 4A, September 1989, Pages 211-213.
Color index type frame buffers have been operated in a partitioned format, such as schematically depicted in FIG. 4, where each 12 bit string by pixel is sub-divided into separate groupings of bits. The color look-up table, as depicted in FIG. 2, is then loaded with a specific color for each possible combination of bits.
Although a color index type partition can be implemented on gamma ramp type frame buffer, it does not represent an optimal use of the available hardware. In particular, the number of color choices are more limited given that the number of available colors in a given color index style partition is far fewer than the number available through a gamma ramp frame buffer. In particular, a color index style partition on a representative contemporary 8-8-8 (8 bits red, 8 bits green, 8 bits blue) gamma ramp type frame buffer could not appropriately support shading, which typically requires that a large number of different but closely related colors be available, without a severe degradation of visual quality.
One implementation according to the practice of the present invention is schematically depicted in FIG. 5. Frame buffer 12 is partitioned so that each color component, red, green and blue, is divided to have a first grouping of 3 bit planes and a second grouping of 5 bit planes. Thus, the partitioned gamma ramp frame buffer depicted in FIG. 5 illustrates a configuration and use in which frame buffer 12 and RGB RAMDACs 13 do not require mechanical reconfiguration. The grouping of the planes in frame buffer 12 into matching sets provides a potential of 343 individual color shades for the 3-3-3 (RGB) grouping of 9 bit planes and up to 29,791 individual color shades for the 5-5-5 (RGB) grouping of 15 bit planes.
Though quality shaded color rendering is feasible using the 5 bit partitions, it remains somewhat marginal for the 3 bit partitions. To improve the quality of the shading in the 3 bit groupings of the partitions, the invention contemplates the practice of dithering as described in the U.S. Pat. No. 4,956,638. The dithering is accomplished before writing the image date into the frame buffer.
The methods, systems and programs relating to the architecture in FIG. 5 provide adequate color range and granularity to ensure a realistic rendering of 3-dimensional shaded images. This is accomplished by judiciously partitioning the frame buffer and, where necessary, applying dithered smoothing effects.
The invention is particularly useful and valuable because it provides such features within the framework of a relatively conventional workstation architecture, namely one utilizing a 24 bit gamma ramp style frame buffer and RAMDACs having conventional color palette, window, overlay, mask and cursor control. An example of such suitable architecture is depicted by block diagram in FIG. 6.
A partitioning of frame buffer 12 into groups of bit planes, as schematically depicted in FIG. 5, requires that the associated RAMDAC color palettes have appropriately matching data sets. The data for the color palette RAMs in the video RAMDACs is loaded directly from processor 21 during configuration. Example data will be sent forth by table hereinafter. The fundamental concept for defining the content of the color palette is to ensure for every possible color address contained in the frame buffer representing an underlying image there exists an address corresponding to every possible color in the buffer for the overlying image.
Note that the palette can be arranged such that either the one, or the other partition can be made to be the overlying image. The question of which image appears to be the visually overlying image is determined solely by the format of the data stored in the color palette. This property is not changed if the number of partitions is increased. If, for instance, the frame buffer is partioned into three groups, any one of the groups can be made the foreground, any one of the remaning the middleground, and the last the background. In all cases, the order is determined solely by the format of the data contained in the color palette.
The general architecture of the graphics processor system as depicted in FIG. 6 is relatively representative of contemporary gamma ramp frame buffer workstation designs. A video RAMDAC which can provide the color palette RAM resources suitable to load the appropriate color look-up table is manufactured by Brooktree, and is commercially available under the part number Bt462. Though the generic representation of the frame buffer in FIG. 6 shows only one bank of memory, a preferred and commonly practiced implementation utilizes double buffering. Double buffering is a technique by which a stable image is depicted on the video display using the contents of one frame buffer while the second frame buffer is revised. At appropriate time intervals the functions of the two frame buffers are reversed.
With reference to FIG. 6, a general practice of the invention involves the execution of an application program in processors 21 and 23 to control the graphics system. During configuration, processor 21 loads the color palette RAMs 13/14/16 of the RAMDACs 17 consistent with the anticipated partitioning of gamma ramp configured frame buffer 18. Control of the windows, overlays, masks and cursor proceeds in normal manner using the related bit planes and control signals from control 22 to manipulate the action of the corresponding functions in RAMDACs 17. Processor 23, in response to general processor 21 commands, selectively invokes various operating modes to selectively generate images with appropriate partitions of the planes in frame buffer 12. Representative modes of operation include 8 bit emulation and masked writing of selective bit planes. Another function performed by processor 23, in response to enabling control signals from processor 21 is scaling and offset calculation. The offsets relate data and bit significance within the frame buffering memory address space, and avoid inappropriate color blending during dithered operation. Each of these will be considered in turnout hereinafter.
Consider an operating example as follows. The objective is to partition a gamma ramp frame buffer so that a 3-dimensional fully shaded foreground image is capable of being rendered for real-time animation in the context of a complex color background image. The complexity of the background image is presumed to be great enough to prevent real-time animation if reconstruction of the background is ever mandated as a consequence of the movement of the foreground image. As a first step, processor 21 and 23 are placed in a 24 bit color mode of operation, as is typical with gamma ramp frame buffers. Next, the upper 3 bit planes of each 8 bit plane color component set within the frame buffer are masked off while the background (inanimate) image is rendered. Scaling of the values to be entered into the 5-5-5 RGB bit planes is accomplished by first normalizing each color component value, that is establishing a range for each RGB component between the value 0.0 and 1.0, and then multiplying each color component by 31. The integer value for each color component is then written into the 5 bit planes associated with the color component. The decimal value 31 is derived from the number of potential values that can be represented with a 5 place binary number, less one for transparency. Each color component is treated identically.
Once the background image is fully rendered into the 5-5-5 partitions of the frame buffer, the remaining 3-3-3 bit planes of the frame buffer are subject to being rendered with the data representing the foreground or animate image. This is accomplished by masking the lower 5 bit planes for each color component and then proceeding in a manner analogous to that previously undertaken for the 5-5-5 partition.
Because of the limited color diversity available from a 3-3-3 RGB arrangement, a preferred practiced involves the use of dithering as described in U.S. Pat. No. 4,956,638. The dithering improves the shading by providing a visually perceived blend of the color boundaries when viewed at a normal distance from the video display screen. A particularly effective implementation of dithering involves the use of the POWER Gt4 or Gt4x graphics adapters in the aforemention IBM brand RISC System/6000 workstation. When dithering is enabled, input 8-8-8 RGB values are passed through the dithering mechanism and written as 3-3-2 RGB values into the frame buffer. The system is arranged such that the dithered pixel values are written into the 3-3-3 most significant bit-planes of the frame buffer. The lower 5 bit planes of each 8 bit color component of the frame buffer are masked during the writing of the dithered emulation results.
Before incoming RGB data destined for the 3-3-3 patition is written in to the frame buffer, it is manipulated in a number of ways. First, the data is normalized by color component to values between 0.0 and 1.0. Then it's multiplied by 7 or 3, respectively for the color components having the 3 and the 2 bit planes. The value 7 is derived from (2.times.2.times.2)-1, the loss being for transparency. Only integer results of the multiplication are used. Since the integer values are destined to be written into the three most significant bit planes of in each color component, the values are then offset by a factor of 32. A final adjustment to establish the actual value entered into the frame buffer occurs as a consequence of the dithering. An adjustment in the number of shades per color component for the 3-3-3 distribution reduces the maximum of 8 red, 8 green, and 4 blue to 7 red, 7 green, 3 blue. The discarded shades are set to a value of zero to avoid addressing of incorrect locations in the color palette.
Table A sets forth the preferred contents of the color palette for the 5-5-5 and 3-3-2 embodiment of a partitioned frame buffer. The data is set forth in hexadecimal with the RGB input addresses at the left and the associated index colors at the right. As noted earlier, the palette data is suited for the earlier identified Brooktree devices.
FIG. 7 illustrates that the partitioning of a gamma ramp frame buffer is not restricted to a 5-5-5 and 3-3-5 arrangement, but can follow a variety of subdivisions dictated to a substantial extent by the number of the colors needed by each object. The frame buffer in FIG. 7 is divided into four partitions, A, B, C and D, respectively having 27 colors, 1 color, 343 colors and 27 colors.
Table B sets forth the color palette RAM data for another representative partition, in which the gamma ramp frame buffer is three independent images, a 2-2-2 color background, a 3-3-2 color dithered middle image and a 3-3-2 dithered top or foreground image. Animation using the three partition frame buffer has proven to have acceptable color quality while providing real-time motion and user responsiveness.
FIGS. 8-13 schematically illustrate by flow diagram the operations performed by code in a program suitable to implement the invention on the aforemention RISC System/6000 workstation. FIG. 14 defines the nomenclature used in FIGS. 8-13. In particular, FIG. 8 depicts the operations involved in defining a partition; FIG. 9 depicts the operations involved in binding an offset; FIGS. 10 and 11 depict the operations involved in computing a color palette; FIG. 12 depicts the operations involved in masking and indicating partitions; and FIG. 13 depicts the operations involved in color setting.
FIG. 15 graphically illustrates some of the implications of the present invention. Namely, if the images in FIG. 15 are generated and stored in the composite using conventional graphics practices and a contemporary gamma ramp frame buffer type workstation, the 30 to 40 thousand triangles needed to render the shape of the 3-D aircraft image would require between a minimum of 0.1 seconds (for a very high speed workstation) to 2 seconds (for a moderate speed workstation) to regenerate with each movement of each overlapping other image. Since the tea pot is also a relatively complex image, involving approximately 5 thousand triangles to render in shaded color, the time expended merely to render it would normally eliminate real-time, user interactive capability. Therefore, relative and real-time movement of the combination of the color shaded tea pot, wine glass and torroid in the context of the aircraft would be substantially impossible were it not for the partitioning of the frame buffer bit planes as defined by the present invention. It is in the context of such simulations involving complex three dimensional color shaded objects that the invention finds particular value. The alternatives are expensive and functionally specialized.
Although the invention has been described and illustrated by way of specific embodiments the underlying methods, systems and programs should be understood to extend to all variants defined by the claims set forth hereinafter.