Goal

In this exercise you will learn how to create simple 3-D scenes and primitives in Director.

Background:

Director supports a powerful 3-D engine that is suitable for games, simulations, and walkthrough architectural spaces. Since Director uses the same drivers that other 3-D applications use it is able to render polygons very quickly with 3-D hardware acceleration. Director has numerous Lingo keywords and functions exclusively for 3-D cast members. Though the Lingo for 3-D is relatively easy to use it requires a solid understanding of how 3-D scenes and related assets are structured and created. That, of itself, can be a challenge, but Director is a great environment to realize 3-D and explore integrated multimedia in 3-D.

The traditional native 3-D file format for Director is .w3d, a proprietary file format originall developed by Macromedia and Intel. Free exporters for the .w3d format are available for Autodesk Maya, 3D Studio Max, and Newtek Lightwave, among others, but the latest version of Director can also import a Google SketchUp .skp file. A free version of SketchUp is available that can export .skp format files, so it is the preferred way to create 3D content for Director if you or your company are on a tight budget. SketchUp is also extremely easy to learn, and provides many of the key 3D modeling features needed for real-time 3-D applications.

 

Terms:

Below are the fundamental geometric structures, and their corresponding names, that 3-D scenes in Director make use of.

3D Structures



Director 3-D Coordinate System:

Director uses the following XYZ orientation for 3-D scenes. Note that unlike the 2-D coordinate system, the Y-axis increases from center to top, and decreases from center to bottom.

3D Coordinates



A Basic 3-D Scene:

To create an empty 3-D cast member that can be populated with 3-D data, do the following:

1) In Director, go to the Window menu and choose the Shockwave 3D menu item.

2) When the Shockwave 3D editor window opens, give it a name in the name box at the top of the window. For this example we'll name it "3D Viewport".

3) Close the Shockwave 3D window. You will see the newly created cast member in the Cast window. Drag it to the Score and size it as big or small as you like. The 3-D content will scale to whatever size the 3-D cast member is assigned on the stage.

4) Make sure you put a "Hold Frame" frame script somewhere above a frame where the 3D cast member is situated. The "Hold Frame" frame script should look like this:

on exitFrame me
spacer_movie.go(_movie.frame)
end

You're now ready to fill the 3D cast member with some 3D data. We can use Lingo to do this. We will define a simple 3D scene containing a cube with no shader, that continuously rotates about its Y-axis. Copy the script below to a new behavior, then attach the behavior to the 3D cast member you created previously. If you would rather download a complete movie that contains the code below, click here.

property pScene
property pCubeResource
property pCubeModel

on beginSprite me
spacer-- Initialize the scene
spacerpScene = sprite(me.spritenum).member
spacerpScene.resetWorld()

spacer-- Create the box model resource
spacerpCubeResource = pScene.newModelResource("Cube Resource", #box)
spacerd = 20
spacerpCubeResource.height = d
spacerpCubeResource.width = d
spacerpCubeResource.length = d
spacerpCubeModel = pScene.newModel("My Cube", pCubeResource)
end

on enterFrame me
spacerpScene.model("My Cube").rotate(0,5,0)
end

There are innumerable possibilities for Shockwave 3D content. The above example creates a model from Lingo code from within Director, no modeling required. If you create content with SketchUp, for example, you might want to see a model rotate (turntable style). The code below is the simplest way to do this, though it assumes the center of the imported model is centered within the model. Otherwise, you may change the rotate(x,y,z) part of the script to rotate around the axis or axes of choice. The script below assumes it is attached to the 3-D asset itself.

on beginSprite me
spacerspacer-- initialize the scene
spacerspacersprite(me.spritenum).member.resetWorld()
end

on enterFrame me
spacerspacer-- rotate the camera
spacerspacersprite(me.spriteNum).camera.rotate(0,1,0)
end

There is really no way to do more than provide a taste of the snow on top of the iceberg of potential for 3-D content within Adobe Director. It is a very deep subject that requires a lot of knowledge from a variety of areas. For example, you should ideally be comfortable modeling, lighting, and surfacing models in one or more 3-D creation packages. Blender is the best free way to get into creating 3-D, and there are dozens of commercial options that allow virtually anything you can imagine to be realized in a real-time 3-D Shockwave runtime environment.

 

Below are more complex examples that build on the simple concepts shown above. Download each of the movies below and look them over. Try changing some of the numbers that define the 3-D geometry in each example, until you feel comfortable with some of the Lingo properties that control 3-D content in director.

 

Resources:

Sw3dC - Shockwave 3D Converter - This handy utility converts major 3D formats to Shockwave 3D. Sw3dC supports: Autodesk FBX, Wavefront OBJ, 3D Studio 3DS, Autodesk DXF, Collada DAE, Google Earth 4 KMX, and Google Earth 4 KML file types.

 

Example Movies:

3D Primitives Example (8 KB) - Examples of how to create other primitive shapes purely with Lingo.

3-D Text Example (8 KB) - 3-D Text movement and change using a Text Cast Member.

Simple 3D Scene Examples (36 KB) - A variety of simple scenes that alter different properties of objecs within 3D cast members.

Picture Cube (1 MB) - A spinning cube with a different bitmap image on each face of the cube.

<     Table of Contents     >