3D Lingo

The mathematics required to orient and manipulate objects in 3D space can be quite complicated. Some concepts and mathematical functions are unique to 3D. For example, there are several ways to specify an object's orientation in 3D space, as well as functions that describe the relative angle of rotation between objects.

With Director 8.5, you also get a number of high-level functions that shield you from some of the hairier 3D math. For example, orienting an object so that it faces another object usually requires complex 3D manipulations. With Director's high-level API, however, it's easy to write Lingo code to perform this task (see "Multimedia Methods" for more information about Lingo).


Simulating real-world physics is one of the great challenges of digital 3D animation. Fortunately, Director is extensible through plug-ins called Xtras, and Director 8.5 now includes the Havok physics Xtra at no additional cost. This add-on simplifies everyday physics enough to convincingly simulate motion in real time.

The physical behaviors available with Havok are the kind that you'd expect to see in a cutting-edge CD-ROM game. Havok provides complete rigid-body physics, rigid-body collision detection and resolution, stackable objects, and both sliding and rolling friction (as shown in Figure 1). And again, Lingo's simple syntax makes it easy to describe whatever properties you desire. Here's how you might program the virtual gravity for your simulation:

havok = member("physics.hke")
havok.gravity = vector( 0, 0, -9.81 )

Here's an example of setting physical properties for a specific model, including mass and relative friction:

model = havok.rigidBody("bowling_ball")
model.mass = 10
model.friction = .1

Of course, this is another area that has its own learning curve for those not experienced with 3D. There's a whole new set of terminology associated with a physics simulation. Fortunately, Havok supplies a solid collection of tutorials and examples for the plug-in, and its developer support is excellent.

Further, Shockwave 3D offers several visual effects that you can apply to your models. In 3D parlance, these effects are known as shaders, and all of them render in real time. Some examples include a cartoon shader that lends the look of traditional animation to your project, as well as pen-and-ink and newsprint shaders.

For example, Lingo rendering a model in cartoon style looks like this:

model = member("scene").model("funny_car")

All of these steps can tax your CPU, so it's fortunate that the Shockwave plug-in supports hardware acceleration on some of the more popular video cards. Without acceleration, the quality of rendered textures suffers dramatically, as do the frame rates of the resulting animation. (On my own projects, I've seen frame rates triple when running on a machine with an accelerated card.)

A rendering effect that's unfortunately absent even on some accelerated cards is anti-aliasing. Anti-aliasing gives objects smooth-looking edges, and an almost photo-realistic visual effect (see Figure 2). This is especially critical for e-commerce applications where clients want their products to look as good as possible. Most likely this wasn't included for performance reasons. Hopefully, Macromedia will adopt the compromise strategy of some competing tools (such as the Web 3D plug-in by Viewpoint), and add an option that lets you activate software anti-aliasing when an object isn't in motion.

Delivery Bottlenecks

The total file size of your compiled project obviously correlates directly with download time for users. You may be prepared to pay a bit more in file size for the opportunity to deliver a fully interactive 3D experience, but remarkably, you don't have to. Because 2D images (textures) are loaded once for each object, and then rendered on the fly for different angles, even complex 3D scenes can actually be quite small. If your project is still too large, you can also reduce the quality of your models or textures as you export them from your 3D modeling package.

While you can make a nice interactive experience for less than 500KB, the wide range of functionality that Shockwave supports brings the plug-in size to over a megabyte. Time-consuming downloads have historically discouraged end users from installing browser plug-ins, so this is where broadband comes into play. With a high-speed connection, users can download and install Shockwave in just a few seconds, compared to the minutes it would take over a modem line. Upgrading the plug-in is easy, as the latest version includes an auto-update feature that significantly shortens future downloads.

Even so, the Shockwave for Director plug-in isn't a transparent download like its cousin Flash. It presents the user with a dialog box to install and register the plug-in, as opposed to just quietly auto-installing, then playing the content. This, in my opinion, is the single largest barrier to the widespread adoption of Shockwave. On a broadband connection, the time it takes the user to decide whether to install the plug-in and then fill out a brief registration form will likely be greater than the time it takes to download the plug-in itself.

Fortunately, thanks to Macromedia's marketing efforts, both the Flash and Shockwave plug-ins now come pre-installed on new Windows and Mac OS machines. In the past, this was only true of Flash. Still, Flash remains the more popular choice, and is virtually ubiquitous; its plug-in comes bundled with Real, Prodigy, AOL, Excite@Home, and other services. By comparison, many users will still need to download the Shockwave for Director plug-in themselves.

A New Dimension

Macromedia, Intel, and Havok have come together to bring an enormously powerful 3D development tool within reach of the average developer. Sophisticated 3D models can be imported into Director and then scripted with complex interactivity and realistic physical behaviors. The combination of mature, high-level tools, fast CPUs, and broadband Internet connections has made rapid development and deployment of interactive 3D possible. And best of all, there's no licensing fee for developing Shockwave applications.

Even with all of the groundwork that's laid for you, however, creating complex interactive 3D experiences isn't for the faint of heart. While you can get up and running quite quickly, refining your first attempts into polished products will take some time. For example, you can quickly create a spherical object that can be manipulated with the mouse, but creating a volleyball game is a much more daunting task.

Luckily, you're not on your own. As a mature product, Director has a large and thriving development community. This includes active newsgroups and mailing lists, many of which are frequented by Shockwave 3D's creators.

Convincing your clients that interactive 3D is valuable may be an even bigger challenge than mastering the software. The technology is still fairly unfamiliar, and many companies have adopted a back-to-basics Web strategy while the tech economy recovers.

Don't get me wrong. This is an incredible package and I highly recommend it. Don't let the pitfalls of Shockwave 3D development discourage you. Knowing potential drawbacks should make you more confident and prevent you from encountering any surprises, ensuring that your development experience is as smooth as possible. Once you start developing 3D content with Director 8.5, you'll be hooked. Send some flowers to your significant other and hire someone to walk your dog!

Greg lives in San Francisco where he heads up ForgeFX, a leader in Shockwave 3D content development. Current rojects include a Shockwave 3D mountain biking game. You can email him at gmeyers@forgefx.com.