[ Go to February 1997 Table of Contents ]|
Three-dimensional graphics chips and graphics libraries have set the stage for spectacular modeling programs.
To see the future of computers, take a look at Super Mario's latest adventures on the Nintendo 64 video game system. In case you haven't seen this technical marvel, the Nintendo 64 uses a MIPS R4300i processor and a Reality Co-Processor to offer stunning 3-D game graphics. That horsepower allows Mario, everyone's favorite digital plumber, to navigate his virtual world with stunning realism. Similar multimedia features are just now arriving for PCs, paving the way for you to write flashy new applications.
First I'll provide some background on chips and video boards. Naturally, several chip and PC board vendors are hot on Nintendo's heels. On the system side, Intel is addressing multimedia by upgrading its Pentium and Pentium Pro processors to include some SIMD (single instruction multiple data) parallel processing under the MMX rubric (see the cover story in this issue). Intel is also upgrading the bus for the video card to a 66MHz clock rate as an Accelerated Graphics Port (AGP). Don't you just love TLAs (three-letter acronyms)?
The action is just as hot in the video board industry. Last year's revolution in 3-D video was fueled by the Glint chip from 3Dlabs. Glint-based boards reduced the cost of workstation-class 3-D cards to about $2,500. Prices for such cards had ranged from an incredible $15,000 to a whopping $25,000. This year's revolution will reduce the cost of accelerated 3-D video boards another order of magnitude to about the cost of a Nintendo 64. Boards based on 3Dlabs' Permedia chip will be shipping from Acer, Creative Labs, ELSA and Symmetric. Orchid will ship a 3DFX-based board; ATI, the 3D RAGE II; and Matrox, the Mystique. Creative Labs is hedging its bets by shipping boards based on Cirrus Logic and Rendition chips.
The software factor
How can you write software to take advantage of these hot new multimedia technologies? Until recently, my answer would have been to use the OpenGL libraries, included in the Win32 SDK and supported on Windows 95, NT and most UNIX systems. OpenGL may still be a good recourse for some people, but it's not the only answer. The trouble is that OpenGL was originally designed for Silicon Graphics workstations. Consequently, it's great for high-quality modeling and rendering, but it isn't the fastest engine in the world. If you're writing a solid modeling program, OpenGL might well be your first choice-especially if you also support UNIX workstations. But if you're writing a 3-D game, OpenGL's performance might not be acceptable.
Two major alternatives to writing OpenGL code are available: Microsoft's Direct3D and Apple's QuickDraw 3D. Apple? Yes, Apple. The underdogs in Cupertino, at least the ones who do multimedia system software, have taken a new tack and now support Windows platforms on an equal basis with Mac platforms. But let me start with Microsoft's offering, lest you accuse me of losing all contact with reality.
Microsoft's "X" initiative prior to ActiveX was DirectX. The basic graphics component of DirectX is DirectDraw, which gives you access to a drawing surface that's very close to the video hardware, without making you worry about the actual details of the hardware. (For an introduction to DirectDraw, see my December 1995 column.) DirectDraw basically gives you access to video memory and support for blitting (block transfers) and page flipping.
Since then Microsoft and its acquired subsidiary, RenderMorphics, have added two layers to DirectX graphics: Direct3D Immediate Mode and Direct3D Retained Mode. In general, immediate mode means that a graphics system right away draws what an application gives it and then forgets about it; retained mode means that a graphics system holds onto the model the application passes. OpenGL, for instance, is an immediate mode 3-D modeling and rendering system.
Direct3D Immediate Mode sits on top of DirectDraw and gives you a rendering pipeline for points, lines and triangles, exposed through COM interfaces. The rendering pipeline takes your geometric data, applies the current viewing and projection transformations, applies the current lighting to your model's material properties, applies textures and transparency properties, and rasterizes or reduces an image to a bitmap on a DirectDraw surface. If you already have a 3-D geometry engine that can reduce its models to points, lines and triangles, then it's quite reasonable to hook up your engine to the Direct3D Immediate Mode pipeline and otherwise continue doing what you're doing.
If, on the other hand, you're starting from scratch, you can use Direct3D Retained Mode as your modeling engine. Retained mode exposes Microsoft COM interfaces for 3-D objects, devices, viewports, faces, lights, wraps, materials, frames, meshes and textures. I say can use, not should: Quite frankly, programming Direct3D Retained Mode directly through its COM interfaces is too much work and too hard to learn for mere mortals.
There is hope. Nigel Thompson has published a fine book on using retained mode, 3D Graphics Programming for Windows 95 (Microsoft Press, 1996). In addition to teaching you a little about Direct3D and providing hours of endless amusement, Nigel supplies his 3dPlus library, a set of C++ classes that make using retained mode almost pleasant.
The Apple alternative
To give you the true flavor of the change at Apple, I'll tell you about my visit to the company campus in Cupertino, Calif. First I received my visitors badge, which read "Martin Heller, WINDOWS Magazine." Next, I attended meetings with Apple executives whose charter is to market Apple multimedia system technologies on every platform excluding Apple's own. I heard assurances that new versions of QuickDraw 3D and QuickTime will have absolute parity across platforms. They even demonstrated some of these cross-platform capabilities. This is new and different. Apple's software architects essentially conceded that they would no longer limit their best software to the Mac.
Superior by design
All of this would have been mere rhetoric if Apple didn't have superior technology to show me-but it did, in QuickDraw and QuickTime. You can probably understand it best by comparison with Direct3D.
The lowest level in the QuickDraw 3D architecture is RAVE, which is basically a software rasterizer. On Windows platforms RAVE can talk to 3-D graphics hardware directly through third-party engines. It can also talk to DirectDraw and GDI device contexts. Games and rendering engines can talk to RAVE directly; plug-in rendering engines for QuickDraw 3D can use RAVE or bypass it.
The standard QuickDraw 3D renderers display shaded or wireframe images and let RAVE do their rasterizing. Plug-in renderers for high-quality ray-traced images and high-speed cartoon images should be available by the time you read this. Unlike Direct3D Immediate Mode, QuickDraw 3D's rendering pipeline is completely open and replaceable.
The rendering layer sits below QuickDraw 3D proper. QuickDraw 3D has both immediate and retained modes, but unlike Direct3D, the two modes have parity in modeling features. You can choose your mode on the basis of what works best for your application, which is a distinct advantage. QuickDraw 3D uses a C-language API, not COM interfaces: You may or may not think that's an advantage.
QuickDraw 3D comes with a viewer, which can be used as an OLE server. Direct3D has no such facility yet. QuickDraw 3D also has its own open file format, the 3-D metafile (3DMF); again, Direct3D falls short.
Apple claims that QuickDraw 3D will perform better than Direct3D because its rendering pipeline has less overhead. I can't verify that yet, since I'm working with an alpha version of the software that hasn't been tuned for performance. But I'm willing to believe that it'll be true: QuickDraw 3D has all the earmarks of a mature graphics system, even though it has been largely unknown to Windows developers until now.
Super Mario meets his match
If Apple, Microsoft, 3Dlabs and others have their way, your $2,500 PC may someday soon don the 3-D multimedia power of those hot-selling Nintendo 64 systems, which cost a mere $200. Only then will my craving for 3-D graphics be fulfilled
When he's not glued to his multimedia PC, Senior Contributing Editor Martin Heller consults for companies from his base in Andover, Mass. Contact Martin at his Web page at http://www.winmag.com/people/mheller, or at the e-mail addresses here.