As you know, the game of "Memory" consists of placing a certain number of shuffled cards face down and then turning them over two at a time, trying to match the pair. If the pair doesn't match, you flip the cards back over and try again. You keep trying until you've matched all the pairsor until you've learned you no longer have any short-term memory due to the effects of, er, your college days.
For our game we will use a 4 x 4 board, totaling 16 cards (8 different pairs). The board will be laid out like so:
To create the actual 3D models for the board, you could use primitive cubes. But an easier way is to use one of the many 3D programs that will export to Director's W3D file format.
The W3D format is like many other 3D file formats in that it contains the models, textures, animations, etc. in a single file. Many manufacturers have used Macromedia's W3D SDK (Software Development Kit) to enable their software to create files in this format.
Using a Dedicated 3D Modeler
Using a stand-alone, dedicated 3D program is an easy way to create models and scenes for use in your Director work. Not only can you see your models as you build them, you can experiment with various materials and adjust your lights and cameras to get the scene just the way you want it. When you're ready you can export the scene to the W3D format, ready for import into Director.
Today, most of the major 3D applications on the market will export to Director's W3D format, although they don't all provide the same level of export quality. When considering purchasing a 3D application, you will want to research the level of support it provides for W3D. All of the major playersDiscreet's 3ds max, Alias' Maya, Newtek's LightWave, and Maxon's Cinema 4Dprovide very good support.
Other packages that provide W3D support include Caligari's TrueSpace, and the ever-popular ShapeShifter3D by Tabuleiro, which is an Xtra that runs right inside Director.
Shown here is the finished game board inside 3ds max, which is what I used to create it:
One of the most compelling reasons for using a dedicated 3D package is ease of use, especially in applying your materials. Take one of the playing cards for the game, for instance. Each card has a similar top image, and it also has a unique bottom image. This means that each card will need to have two separate texture maps applied, and this is where using a dedicated 3D application really makes life easier.
You know that a model's shader contains the texture applied to the model. But a shader actually allows you to place up to eight textures on a model. Using a program such as 3ds max makes this simple.
In 3ds max I created what is known as a multi-sub object material. The material was told to have three sub-materials: one material on the top, one on the bottom, and one for the sides. This material was then duplicated 15 times, resulting in a separate material for each of the 16 cards:
However, the real trick is that the sub-materials have unique names. Note the second sub-material is named "b1". This is the material applied to the bottom of the card, while the first sub-material is applied to the top of the card. When exported to the W3D, format each sub-material with a unique name will create a unique shader within the 3D world. Because the first sub-material used on each card doesn't have a unique name, only one shader will be created and shared among the card tops. Because all of the second sub-materials used on the bottom of the cards are uniquely named, 16 separate shaders will be created. This is what will allow you to individually change the images displayed on the bottom of each card.
If this isn't completely clear, it will be when you create the Lingo to change the images.
A consideration when using W3D files exported from 3ds max is that the coordinate system doesn't match Director's default. Instead of Y going up and down, max-created files have Z going up and down and Y going in and out. This is a trivial consideration once you are aware of it, however.
Importing the Game Board
Once the W3D file has been exported from your modeling software, it's ready to be imported into Director. In this section you'll import the finished game board into Director and begin working with it.