Get the Flash Player to see this player.
Flash Image Rotator Module by Joomlashack.
Fractal
Fractal
Fractal
Fractal
Fractal

Home Tutorials Adobe Director eBook
Lesson 17: 3-D Basics E-mail

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 hardware acceleration. Director has numerous Lingo keywords and functions exclusively for 3-D cast members. Though the Lingo for 3-D is easy to use it requires a solid understanding of how 3-D scenes are structured and created. The native 3-D file format for Director is a .w3d proprietary file type, but file exporters are available for programs such as Autodesk Maya and 3D Studio Max to allow the creation of complex scenes and animation that can be imported into Director for real-time playback. Fortunately, it is relatively easy to create simple 3-D scenes using only Lingo.

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

The above example just barely scratches the surface of what is possible with Shockwave 3D. 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

Trackback(0)
Comments (0)Add Comment

Write comment

busy