Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesCrave the RAVE


June 1996 / Core Technologies / Crave the RAVE

Apple hopes a primitive 3-D interface will lead to sophisticated 3-D games.

By Peter Wayner

Now that hardware acceleration for 3-D computing is about to enter the mass market for home PCs, software developers are scrambling to come up with a standard language that will make it possible for their applications to run on as many machines as possible. Apple Computer (Cupertino, CA) is trying to establish one such standard with 3D RAVE (Rendering Acceleration Virtual Engine), which is a low-level 3-D rendering system that should smooth differences between all machines, be they Wintel or Mac.

The goal is simple: If a developer wants to draw a triangle on-screen, he or she makes one call to the 3D RAVE API. It's then up to RAVE to do the right thing dep ending on the end user's hardware. If the software is running on a computer equipped with a hardware accelerator for 3-D graphics, the RAVE layer should use this fast hardware to render the triangle as fast as possibl e. If the software is running on a plain machine with no special equipment or video hardware, a software rendering engine should step onto the stage and do the job correctly, if more slowly.

A smart API like this is a big time-saver for developers and accelerator manufacturers. Thousands of games and dozens of video accelerator cards are on the market. The RAVE structure lets each accelerator card manufacturer write a single engine that will be accessible to each game designer through the RAVE interface. All engines will accept the same basic calls for rendering points, lines, and triangles, so all software will work with each board.

Actually, 3D RAVE is one of two Apple API sets for rendering 3-D objects. The other one, which is called QuickDraw 3D , is a much-higher-level API that offers developers the ability to simply open up a window and hand QuickDraw 3D a file that describes a complex item. QuickDraw 3D will interpret the complex data structures and break them into such low-level items as triangles, lines, and points before handing them to 3D RAVE to do the right thing with the local hardware configuration.

Two Halves Are Better Than One

Apple split the APIs into two sets because its engineers realized that not all software developers are alike. Some developers wanted a powerful tool that would do all the rendering work for them. Those developers would use the full version of QuickDraw 3D.

However, others had invested a great deal of time and effort in their own rendering engines that provided a distinctive "look" for their games. Game designers may concentrate on different effects. One developer might include a complex rendering engine for dealing with effects such as smoke and fog; another developer might choose f or the action to occur in clear light. Visual styles such as this are important.

Software companies with their own rendering engines still need an API such as RAVE. This allows them access to multiple machines with different accelerator cards. Their rendering engines break up the complex models into triangles and then RAVE handles the local details.

Although the RAVE API layer is meant to be a low-level API , it still offers a strong collection of the most important features. You can texture-map triangles with textures that are as detailed as 4000 by 4000 pixels. Z-buffering is available, but you can turn it off to save memory and add speed. Some game programmers have already calculated distance information in their code, and they're able to draw programs from back to front and present the correct information without help from a z-buffer. You can clip these operations to fit into windows and other shapes.

The API does not offer access to any higher-level features that might be found in the full QuickDraw 3D API. That API offers commands that will open standard 3-D files and import them. Game developers must do this for themselves if they want to deal only with RAVE. Also, such higher-level constructs as smooth polygonal object models are missing. These constructs are a large part of the heavy overhead that graphics languages such as GL impose on the systems that run them. With RAVE, game developers don't have to worry about losing memory to these functions.

The Difference Engines

A general API (like RAVE) should offer the same effect on different platforms in a manner that is completely transparent to the software. For instance, the standard window accelerator will move rectangles around in the same way. A 3-D API must also offer consistency across platforms, but it would actually be better if it weren't perfect. This is because software developers don't want exactly the same thing to happen on each machine. They want the best possible image to eme rge on each machine.

This flexibility is offered by RAVE's Gestalt interface and the different rastering engines. A game program might poll RAVE to find out which of the engines are available and also determine their performance.

If you install a high-speed hardware-accelerated engine, the game could load the most realistic, complex models and use them in the game play, knowing that the engine could deliver. If you have a low-speed software-only engine, the game would use lower-grade models to maintain performance.

The Gestalt interface also describes the different features available on the different accelerators. Some might offer texture-mapping, while others might offer higher-grade mapping with interpolation. Some might offer transparency blending, while others might use an alpha channel.

Some might handle depth through simple z-buffering, while others might add deep z-buffering or perspective correction. Through the Gestalt interface, the game can poll the local hardware and choose the appropriate object models to fit the performance characteristics of the board.

When the software begins executing, it can flip through a list of the available low-level RAVE engines and choose the best one for the job. It is quite possible that a package might forgo a zippy hardware accelerator engine for a slower software-only engine because the software-only engine offers features that are not available on the accelerator engine. If the software-only engine still renders the image fast enough, it would be the right choice for that situation.

This information is available through the Gestalt interface. Giving the software developer access to these choices is an important item if they're going to be able to tailor the drawing to present the best possible image on each machine.

This Gestalt interface also offers a surprising amount of forward-looking cross-platform flexibility. It is entirely possible that software written to the RAVE standard will run in seve ral years on hardware accelerators that weren't even designed when the software was written. The software will access the Gestalt interface and choose the best-performing engine that's available.

Cross-Platform Wintel and Mac

The original core of RAVE was designed as a hardware abstraction layer (HAL) that would hide the details of each accelerator card from the Mac programmer. Once the abstraction is set up, it is not much trouble to extend this to work well on Windows machines as well.

As of this writing, Apple has said it will ship a version of RAVE for Windows programmers. This will let game programmers write to a single low-level standard and have their software run on either machine. In essence, the game programmer makes the same call to draw a texture-mapped triangle on either a Mac with a Matrox card or a PC with an ATI Technologies accelerator card.

The Windows development kit contains a Software Development Kit (SDK) with DLLs for the game programmer and a devi ce-driver kit (DDK) for the board manufacturer. Both kits contain the definitions for the data structures that work consistently across both platforms--they are just recompiled for use on the PC. The Mac kit's SDK for the game programmers includes the headers for the system calls that are part of the QuickDraw 3D system extension. The board manufacturers can develop their own system extensions.

Apple has been the source of a wide variety of cross-platform standards, but its most successful ones have come in the graphics arts world. QuickTime and its virtual-reality cousin QuickTime VR are used on a number of CD-ROM games and graphics additions. The domination of the Mac platform in the graphics arts world helps this process.

If RAVE succeeds in helping 3-D game developers market their products, Mac users will benefit. Porting PC games to the Mac will be a relatively simple process, and there will be more games. The work may also flow in the other direction. Porting games from the Mac to the PC w ill be an easier process. That will allow graphic designers who cling to the Mac to stick with it into the future.


Info On the World Wide Web

http://www.info.apple.com/qd3d/qd3d.html (Netscape frames)

http://www.info.apple.com/qd3d/main.html (same as above, without frames)

http://www.info.ap ple.com/qd3d/rave/rave.html


Using the RAVE API

illustration_link (6 Kbytes)

Applications write to the RAVE interface, which deals with the hardware accelerators and software libraries on that machine.


Using the Gestalt Manager

illustration_link (6 Kbytes)

The Gestalt interface lets applications que ry the RAVE subsystem to see what hardware and software are on that machine.


Peter Wayner is a regular BYTE contributor in Baltimore, Maryland. His latest book is Disappearing Cryptography: Being and Nothingness on the Net. His home page is at http://access.digex.net/~pcw/pcpage.html .

Up to the Core Technologies section contentsGo to next article: How to Put Mainframes on the WebSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network