The Glint chip brings inexpensive 3-D graphics processing to PCs
Peter Wayner
The arrival of low-cost, high-power video chips capable of rendering complex 3-D scenes will, in the next three years, transform the average desktop PC into a sophisticated graphics workstation. The flat, 2-D components of today's user interfaces and applications will be replaced by fully functional 3-D objects that can move and rotate in any direction. Games, slide presentations, virtual reality--even spreadsheets--will never be the same.
One of the first inexpensive 3-D chips available to video board manufacturers is the Glint 300SX from 3Dlabs (San Jose, CA). The chip performs all the standard operations of the current GUI accelerator video boards and renders up to 300,000 Gourau
d-shaded polygons per second. Such a level of performance isn't possible from today's CPUs alone. You can thus think of the 300SX as a specialized extension of your CPU dedicated to 3-D tasks.
3Dlabs estimates it will sell its chip at $150 apiece in suitable quantities. When the 300SX is bundled with relatively more expensive memory, you'll be able to add sophisticated 3-D graphics capabilities to a PC for well under $1000.
Inside Glint
At the highest level, the architecture of the 300SX is not much different from that of today's GUI accelerators. When the main processor needs to draw a triangle, for instance, it sends a list with the color and the three vertices of the triangle across the PCI (Peripheral Component Interconnect) bus to the 300SX. The compactness of this simple message allows the main processor to go on to other work while the 300SX interprets the message and changes the correct pixels on the screen.
The 300SX, like GUI accelerators, relies on an efficient memory int
erface to a frame buffer that contains the values of each pixel on the screen. The chip uses the interface to stream large sections of the screen image through its pipeline. The faster this is done, the more responsive a screen is.
But the similarities stop at this level. Most GUI accelerators can draw only lines and rectangles as well as copy parts of a screen from one section of the memory to another. This is good enough for 2-D work, but not for 3-D applications. The 300SX, however, can do more. In addition to 2-D manipulations, it can draw properly shaded polygons in a 3-D environment. It achieves 3-D realism by making sure that only the closest polygon to the screen remains visible to the user. The rest disappear. The chip can also add special effects, such as fog.
The Local Buffer
The 300SX has access to two different buffers for constructing an image. The main buffer holds a description of the color of each pixel on the screen. It can contain up to 32 bits per pixel: 8 bits each for
red, green, and blue, and 8 bits for an alpha-blending constant used for transparency. This buffer is usually stored in fast VRAM, which contains two ports so that the image can be sent to the monitor at the same time the 300SX is changing it.
The other buffer, called the local buffer, contains up to 48 bits of additional information for each pixel. Up to 32 bits of this buffer is used as a z-buffer, which contains the depth of the last pixel drawn at a particular location. When each primitive is drawn by breaking it into pixels, the depth (or z-coordinate) is compared with the depth of the pixel that is already drawn in the frame buffer. If this new pixel is closer to the viewer, then it is drawn into the frame buffer. If it is farther away and effectively eclipsed by the previously drawn object primitive, then the new pixel is ignored.
The rest of the bits of the local buffer can be used to block out parts of a screen through stenciling masks. A common use of this technique is to draw cutout
letters and render a scene that is visible only through these cutouts. In this case, the description of the letters is placed in the local buffer, and this controls the appearance of the scene. When the 300SX attempts to render a pixel, it checks with these bits to see if the pixel will be visible.
The Graphics Pipeline
The features of the 300SX are implemented by functional units arranged in a long pipeline through the chip. These units operate relatively asynchronously and are linked by buffered channels that route the information from one unit to another. The various steps in the pipeline are shown in the figure ``The 300SX Pipeline.''
At the beginning of the pipeline is a rasterizer, which takes the description of the graphics primitive (e.g., the three corners of a triangle) and converts it into a list of pixels. The 300SX will also antialias a primitive by computing the partial area covering a pixel, breaking the pixel up into either a 4- by 4- or an 8- by 8- subpixel grid. The chip
uses this fractional information to better determine how much color to apply at the boundaries of the primitives. In effect, it blurs the edges slightly to reduce their jaggedness and to smooth animation.
Each pixel then travels to each functional unit along the pipeline. The first unit performs two functions: the scissors test, which checks to see if the pixel fits within the absolute boundaries of the frame buffer, and the stipple test, which checks to see if the pixel lies on predefined dashed lines or meshes. Next in line, the Color DDA unit computes the correct color of the pixel based on the colors at the corners of the polygon. The 300SX uses the Gouraud-shading model to average the color based on the position of the pixel in the polygon. This ensures that two adjacent polygons meet smoothly.
After color shading comes texture mapping. The hardware in this unit draws a texture onto the polygon by determining which spot in the texture pattern is to be drawn at each particular pixel. Texture
maps are often digitized photographs that, when mapped onto a 3-D surface, lend a great deal of realism to rendered scenes. A complete 3-D model of every pebble, bump, and rough spot in a tree, for example, is just too complicated to be rendered by today's technology. Instead, a rough polygonal approximation is used, and the texture is projected onto it. The 300SX computes the correct texture color by interpolating among eight different versions. A later version of the chip, the 300TX, should provide true perspective correction for tilted planes.
At this point in the pipeline, the 300SX uses the information from the local buffer to remove hidden pixels. If the z-buffer shows that a pixel would be covered by a previously drawn pixel, then the covered pixel disappears from the pipeline. Similarly, pixels that may be blocked by a stencil or a window mask are also removed.
After the local buffer is accessed, the pixels are ready to be drawn into the frame buffer. There are three steps that control
how a pixel is added to the frame buffer. The alpha value (i.e., the last 8 bits of the 32 bits assigned to each pixel) determines the transparency of the pixel and is used to blend the new pixel into the previously existing pixel in the frame buffer. The 300SX can also dither the pixel by finding two or more colors that approximate the desired color if it is not available in the current palette. Finally, the basic logical operations of OR, AND, and XOR are used to control the drawing of new pixels into the frame buffer.
Division of Labor
The 300SX does many things for the rendering of polygons, but it is important to recognize what it does not do. Although it draws shaded polygons and uses a z-buffer to determine which parts of the polygons are visible, this is only half of a 3-D graphics system. The chip does not actually compute the locations of a polygon's corners or do any of the lighting model calculations necessary to convert an image into the list of shaded polygons.
In graphics pa
rlance, the 300SX provides the back end--the rendering half--of a 3-D graphics pipeline, leaving the host CPU to perform geometry calculations. This is the same tack taken by Hewlett-Packard in its 3-D graphics systems.
The 300SX does not perform geometry calculations for a number of reasons. First are the practical ones. Although a graphics pipeline that does both geometry calculations and rendering is usually faster than one that performs only rendering, it is also much more expensive to implement. Besides, most of the computations necessary to rotate, scale, and project objects are easily accomplished by standard CPUs. The calculations normally involve heavy floating-point arithmetic, which is best provided by a general-purpose CPU. The high-speed frame-buffer juggling that the 300SX performs is not necessary at this level. A final practical advantage of letting the host CPU perform geometry calculations is that it allows 3-D performance to scale along with the performance of the CPU.
The 300
SX also leaves geometry to software to avoid political problems. While most 3-D companies agree on the basic steps needed to draw 3-D objects on a screen, they do not agree on the format or on many of the geometric models used to represent 3-D objects. OpenGL is a popular standard developed by Silicon Graphics and adopted by companies including IBM, DEC, Intergraph, and Novell. Microsoft, in fact, has made OpenGL the standard 3-D graphics API for Windows NT and other versions of Windows. Sun Microsystems and others, however, have other ideas about graphics APIs.
By leaving the geometry calculations to software, the 300SX avoids all API wars. Any graphics API can use the rendering capabilities of a 300SX on the back end by first using its own software-based geometric engine to convert the scene into a list of shaded polygons and lines and then passing this list to the 300SX. Such a system also lets the geometry engine evolve in the event that more complicated lighting models or other improvements are de
veloped.
By providing both 2-D and 3-D acceleration, the 300SX is positioned to work with today's GUIs as well as tomorrow's virtual reality-based interfaces. As chips like the 300SX become more common in video display adapters, software vendors will become bolder in incorporating 3-D capability into their products. The time is not too distant when 3-D graphics will be as common as GUI accelerators.
Figure: The 300SX Pipeline
At the front of the pipeline, the rasterizer creates a list of pixels for each primitive received from the host system. Each pixel thus generated visits the various stages, where it is shaded, given texture, checked for visibility, and written to the frame buffer. Using the information in the frame buffer, the display system outputs the rendered scene to the screen.
Peter Wayner is a BYTE consulting editor based in Baltimore, Maryland. He can be contacted on the Internet at
pcw@access.digex.com
or on BIX
as ``pwayner.''