Icon

Getting Your 3D Stuff into Director 8.5

A Primer for Starting Out With Shockwave 3D

So you've rushed out and upgraded to Director 8.5. Well, maybe it no longer qualifies as a "rush," per se, since it's been out for several months now, but you get the idea. Sure, the Flash 5 and RealMedia support is great, along with a few decent interface enhancements, but hardly enough to justify this being a .5 upgrade. That is, until you add in the new 3D features. Macromedia (along with help from Intel) has finally stepped up to the 3D plate and seems poised to deliver, at long last, a cross-platform, scaleable, and bandwidth-friendly interactive 3D standard, one which actually stands a decent chance of eventually gaining broad market acceptance. While all of that is great news for developers, there remains one nagging question:

Now what?

In order to produce the next (or, as some may argue, the first) great interactive 3D experience, you actually have to get 3D content into Director somehow. For what is essentially a version 1.0 feature, Director's 3D capabilities are amazingly sophisticated, incorporating modeling, surfacing, keyframe animation, bones, particle generation, physics, and more. But with sophistication comes complexity, as Director's implementation of 3D functionality may be a bit convoluted to both 3D artists and long-time Director users. So to help you get started, we're going to scratch the proverbial surface of 3D in Director by explaining the various methods of getting 3D content into the program.

Built-In Options

Text
Even if you haven't really done much in terms of playing around with Director 8.5's 3D features, chances are that you've at least come across 3D text, which is the simplest method of generating 3D content. Any text object in Director can now be made three-dimensional. Here's how:

  • Select a text object in the cast or on the stage.
  • Click the Text tab in the Property Inspector.
  • Change the Display pull-down menu from the default Normal to 3D Mode.

Viola! Extruded 3D text (fig. 1).


Figure 1: Wow! 3D text! The text on the top is a regular text sprite (in my very own chickenscratch font), while the text on the bottom has been converted to 3D text and rotated.

Now that you've changed the normal text to 3D text, you'll probably notice that you now have an entirely new tab in the Property Inspector to play with: the 3D Extruder (fig. 2). This panel contains many options familiar to 3D artists, including the ability to move and rotate the text in 3D space and adjustment settings for the text bevel, visible faces, smoothness, shading, specularity, and light. While the options for 3D text aren't incredibly advanced, it is possible to achieve some nice visuals with this feature if you take the time to play around with it.


Figure 2: The 3D Extruder Panel.

Primitives
In addition to 3D text, Director 8.5 has another built-in way to produce 3D objects from scratch: primitives. Director's list of primitives includes spheres, boxes, cylinders, planes and particles, which by themselves can be used to create relatively simple scenes or augment other existing 3D scenes. Unlike 3D text, however, building a scene based entirely on primitives requires a fair knowledge of Lingo, as it's impossible to generate objects without the use of Lingo. But if you're not afraid to dirty your hands with a bit of coding, then you'll probably find primitives pretty useful, especially if you're just learning how Director handles 3D resources. So, as a real simple exercise in generating primitives, we're going to make a cone. But before we start with that, it may be useful to mention that the modeling Lingo we're about to write is one of the reasons why I said that 3D in Director can be a bit convoluted. However, if you think about it in terms of the metaphors that Director has had since the very beginning, it begins to make a little more sense.

Here's what I mean. In order to make a visible model, you first have to make a model resource, and then use the model resource to make a model. For those familiar with 3D programs, this may elicit a resounding, "huh?" A model is a model, right? That's true in the world of 3D programs, but Macromedia has added a twist to that. In the Director 3D realm, think of the 3D elements as their own self-contained versions of Director itself. The 3D castmember is the stage, the model resources are the castmembers, and the models are the sprites. In the normal course of working in Director, a castmember isn't visible on the stage until you place it there, where it becomes a sprite. You can then use that castmember in as many sprites as you want, and even transform the sprites to some degree without altering the underlying castmember. In Director's 3D world, model resources and models work the same way. If you create a model resource of a sphere, you could use that resource in over and over again to make hundreds of sphere models inside the 3D castmember, perhaps adding some variations to each, but at the same time keeping the number of total polygons low in order to improve real-time rendering on the client side. Make sense? Good. Now, on creating our cone.

  • The first step is to create an empty 3D castmember to use as our world in which the cone will live and thrive. Do this by clicking on the Insert menu, then choosing Media Element and then selecting Shockwave 3D.
  • A blank 3D castmember will pop up. Make sure to give the castmember a name in the naming field before you close it, otherwise it will disappear! I gave mine the very creative and original name of 3d_scene.
  • Close the 3D castmember and then drag it from the Cast into channel 1, frame 1 on the Stage.
  • Here's where we get to the Lingo. Double-click on the Script channel of frame 1 to open a new script window.
  • You're going to place all your 3D Lingo in the beginSprite handler, which doesn't exist in the timeline between enterFrame and exitFrame, and therefore will only be executed once.

Here's the script, step by step, with my babble commented out so you can just cut and paste it into Director if you want:

on beginSprite

-- First, you want to reset the 3D castmember back to a blank world. If you don't, you'll get an error the second time you try to run it, since there will be conflicting names.

member("3d_scene").resetWorld()

-- Then, create the model resource (remember - equivalent to a castmember). I assigned it a local variable name, "myModelResource," so I can quickly refer to it later when I need to. What's going on in this script is that I am referring to my 3D castmember, "3d_scene," and telling it to create a new cylinder model resource named "myCylinder."

myModelResource = member("3d_scene").newModelResource("myCylinder", #cylinder)

-- Next, we're going to transform our basic cylinder model resource into a cone with the following three lines. I'm telling the model resource "myCylinder" in member "3d_scene" to have a height of 75 units, a top radius of 0 (making the top a point, hence a cone), and a bottom radius of 75, which should create a short, fat cone.

member("3d_scene").modelResource("myCylinder").height = 75
member("3d_scene").modelResource("myCylinder").topRadius = 0
member("3d_scene").modelResource("myCylinder").bottomRadius = 75

-- All that coding and we actually haven't made anything visible yet. The next line places the model resource (think castmember) as a model in the scene (think a sprite on the stage). I'm telling my 3D castmember to create a new model named "cone" based on the variable "myModelResource," in which I defined the parameters of the cone.

member("3d_scene").newModel("cone", myModelResource)

end

on exitFrame
go the frame
end

Rewind the movie and then press play, and you should see something like what's in figure 3. Of course, you can go to town on the script to add multiple instances of the cone, change the position, rotation, shader, height, angle, number of segments, add a top or bottom cap, animate it, add lights and cameras, etc.


Figure 3: Our completed short, fat cone. The red and white checkerboard shader is Director's default shader when generating primitives, and can be changed through shader and texture Lingo.

Outside Options

Shockwave 3D Exporters
If you already have a 3D modeling/animation program, you're probably in luck. Most of the major 3D software vendors have jumped fully on board with the Shockwave 3D initiative by either adding or announcing plans to add Shockwave 3D exporters to their various programs, so chances are pretty good that the package you have either already supports the W3D format or soon will. There are numerous advantages to using a 3D package that you may already own or have access to. For starters, you can use whatever program you're already comfortable with to create your 3D scenes. Another plus is that if you're a Lingophobe, using a Shockwave 3D exporter is pretty much the only way to add complex shaders and animation into your Shockwave 3D content. The last bonus I'll mention is that if you already have a library of scenes or models you've created in your 3D package in the past, you can now take advantage of Shockwave 3D's bandwidth-friendly features and various renderers to easily re-purpose your content for online delivery.

One caution I would issue is that the Shockwave 3D format doesn't support every feature your 3D program may offer, so your scenes may (and probably will) require some tweaking before they're ready for export. Consult your program's documentation for how to best prepare content for Shockwave 3D export.

OBJ Conversion
Despite the fact that so many 3D software vendors have jumped on board with Shockwave 3D, there are still some users that may be saddled with an unsupported package. You're not completely left out in the cold, unless your program doesn't happen to offer OBJ export (the Wavefront OBJ file format is the only one that Director 8.5 can convert to its native W3D format). If you can get your data to export to OBJ, then you can still get your data into Director 8.5. BUT...(capitalized because these are big buts):

  • OBJ conversion in Director 8.5 is spotty at best, unusable at worst.
  • OBJ files exported out of another 3D program often do not have material settings attached to it, meaning that you will probably lose your model's shading and textures.
  • You will have to know good amount of 3D Lingo to apply shaders and add animation.

First, you're going to need to download and install Macromedia's OBJ converter Xtra, available at http://www.macromedia.com/support/director/downloads.html. Once installed in your Xtras folder, launch Director and do the following to convert OBJ files to W3D:

  • From the Xtras menu, select Convert 3D Files. The Xtra should present a dialog box.
  • Click the Add Files button to browse for the OBJ files on your system that you want to convert. Once you do this, you should see the filenames and their associated paths in the Files To Convert box.
  • Click the Browse button to select a directory that the converted W3D files will be written to.

At this point, you can simply press the Convert button and hope for the best. However, the best likely isn't what you're going to get, so it's probably a good idea to visit the Options panel before converting. Click the Options button for the following, well, options (fig. 4):


Figure 4: The OBJ Converter Xtra Options Panel.

Units. Use this option to set the scale of your converted model to what it was originally in your 3D program.

Mesh Smoothing Angle. This number is the angle at which adjacent polygon faces get smoothed. The higher the number, the smoother the surface.

Treat polygons as double-sided. This checkbox essentially doubles the number of polygons in a model by adding a new polygon on the opposite side of each existing polygon. This is useful if you have something like a half-sphere and you want to see the back of it, but like the name implies, it doubles the number of polygons in the imported model.

Flip polygon orientation. Some 3D programs write OBJ models with polygons that are facing opposite of the way the converter expects, so use this checkbox to set things right.

Y-Axis up. Use this checkbox if your 3D program and Director's 3D space z and y axes are different, so your model will be converted facing the right direction.

If you tried any OBJ files you might have had lying around, you may have noticed that the biggest problem is actually getting somewhat reliable conversion to W3D. Stray polygons, way too much smoothing, and erratic shading may be plaguing your models. Since OBJ export out of various 3D programs usually differs widely in terms of how the file is actually written, I don't have the magic solution to getting every OBJ file you may have to convert perfectly. However, I do have a couple of tips to minimize the pain of this procedure:

— It is extremely important to make sure that your model contains only three-sided polygons before you export out of your 3D program to OBJ. Multi-sided polygons are probably the reason why your model isn't looking like it should (fig. 5). Refer to your program's documentation for specific information on how to triple polygons.


Figure 5: This image is brought to you by the number 8. The model on the left was exported to OBJ format with multi-sided polygons, while the model on the right had all its polygons reduced to three sides before exporting.

— Once you figure out if your models need to be converted with the Treat polygons as double-sided, Flip polygon orientation, and Y-Axis up boxes checked or not, chances are that those settings will be used on every model you convert from the same 3D program. However, you'll probably have to fiddle with the Mesh Smoothing Angle number from model to model to achieve the best results. Many times it's a matter of trial and error to get the model looking close to what it was in your 3D program.

— Keep polygon counts as low as you can. Director may sometimes freeze up if you try to convert a model with an inordinately large polyon count, and at best you'll end up waiting quite a while for the converter to do its job. If it's taking a long time to convert on your end, imagine how long the wait will be for your user's machine to render the model. Actually, keeping tabs on the polygon count is a good rule of thumb in general, regardless of how you generate 3D content for Director.

Hopefully, these tips will yield you good results for your OBJ models. Once you get them into Director, you can use shading and texturing Lingo to reintroduce shaders and textures to your model.

Conclusion

As I mentioned before, getting 3D into Director 8.5 is only the tip of the iceberg, but you have to start there in order to move foward with the incredible list of 3D features that Shockwave 3D offers. We didn't even touch shaders, bones, particles, and keyframe animation in this primer, but if you're willing to pick up the enormous amount of 3D Lingo packed into this version of Director, the possibilities are virtually limitless. So what are you waiting for? Get going on making some cool 3D worlds!

^ Top of Page

Got Feedback? to send an email. I'll do my best to answer. Really.