Exercise 11 — View a 3D World
Applet |
---|
The airplane model is of an A-10 Warthog jet. It was created by Viewpoint Data Labs, and is used by Kinetix with permission.
To see a camera view: | Click Camera1 or Camera2. |
---|---|
To play the animation: | Click the airplane. |
To move around the 3D world: | Drag in the 3D window.
The default navigation mode is Dolly & Pan mode. Hold down CTRL to move along the plane of the screen in Truck & Pedestal mode. Hold down SHIFT to circle the viewpoint in Pitch & Roll mode. Hold down ALT to circle the viewpoint in Orbit mode. (You can also right-click the 3D world to display a pop-up menu that lets you choose the navigation mode.) |
Note: The Hyperwire 3D package is still in the beta stage, and does not work correctly in all browsers. If the applet shown on this page runs correctly, then probably you will be able to do this 3D exercises. If this applet does not run, you can try using a different browser, or you can skip this exercise for the time being.
See 3D Worlds and Hyperwire for more information about 3D navigation modes.
Hyperwire treats a 3D world much like an external media file. In this exercise, the 3D world is saved in a .wrl file, which is encoded in VRML or VRML+3DS. VRML is the current standard Web format for encoding 3D worlds. VRML+3DS, created at Autodesk and Kinetix, is a set of extensions to VRML that add behavior and animation to the 3D world. Both formats use the .wrl extension. If a player that reads standard VRML encounters VRML+3DS code in the file, it simply ignores it.
The 3D world is inhabited by 3D mesh objects, lights, and cameras. You don't create the 3D world in Hyperwire. You can create it by using 3D Studio MAX, AutoCAD, or a VRML editor.
If 3D Studio MAX is installed on your system, also see Exercise 19, Creating a 3D world. Exercise 19 is for 3D Studio MAX users. It shows how to create and animate the 3D world you view in this exercise.
To view a 3D world in a Hyperwire title, you add a 3D World module to the title, and then associate it with the .wrl file.
This file has been prepared to save you the trouble of setting up the background and buttons.
The 3D World module's Properties dialog appears.
A list of objects in the 3D world appears in the Properties dialog beneath the label, Create 3D Modules. A preview window also appears, showing a view of the 3D world.
In this case, the 3D world contains some walls and a model of a jet airplane.
Don't close the Properties dialog yet.
When you first add a VRML world to a Hyperwire title, its ambient light defaults to black. This can make the scene too dark unless you adjust ambient lighting, as in the following steps.
Other colors of ambient light tint the scene.
The best Intensity value varies from scene to scene.
Adding a 3D World module without selecting individual objects within it, still lets your title display the mesh objects within the 3D world. As you can see from the Create 3D Modules list, you can also choose to add individual objects within the 3D world as Hyperwire modules. In general, adding all 3D objects individually would make your title extremely crowded and complicated, and you don't want to add individual objects as modules unless you have a special use for them above and beyond viewing the 3D world. The following steps show how to use two Camera modules in this way.
This exercise uses the views defined by the two cameras within the A-10 world. You add these cameras as Hyperwire modules, but leave the rest of the world's contents alone.
The Create 3D Modules list changes to show the names of the cameras in the 3D world.
The two camera names should be highlighted.
This adds the two cameras to the list of objects that will be added as Hyperwire modules. A check mark should appear next to the name of each camera.
Hyperwire displays a further dialog, described in the following steps.
When you click OK to close the 3D world's Properties dialog, a dialog labeled 3D World, and captioned, Create a view of the 3D world? appears.
A 3D World module must be associated with a 3D window or a 3D view for its contents to be visible in the Hyperwire title. Hyperwire prompts you to create the window or view whenever you add a 3D world to your title.
As the dialog explains, a 3D Window and a 3D View module are almost alike. Both provide a view onto a 3D world. The 3D window is slightly more limited in capability and more efficient in performance. In this exercise, you don't need the additional capabilities of a 3D View module.
If you choose not to create the view or window at 3D world creation time, you can later add a view or window module to your title, but then you must explicitly associate the view or window with the 3D world, using the view or window's Properties dialog. The view or window that you create by using the Create a view ...? dialog is automatically associated with the 3D world you just added.
The arrow keys can be useful when you position the window.
The A-10.wrl file you just added is a VRML+3DS file. It contains an animation created using 3D Studio MAX. 3D World modules have an input port that tells them to play their animation, provided this VRML+3DS information is present in the .wrl file.
You will wire the title so that clicking the 3D window causes the animation to begin playing.
The wire requires one parameter, a frame number.
Frame 0 is the default beginning frame for 3D Studio MAX animations.
Now, wire the two buttons so each displays its corresponding camera view.
As you can see from the "not" symbols, this wire has two undefined parameters. One is the frame number, as for the wire that starts the animation. The other is for the name of the camera to use.
The camera name parameter is the reason you needed to load the cameras as Hyperwire modules of their own.
A wire appears. Drag this wire to connect it to the Get Camera Name input port of the Camera01 module.
Notice that you don't need to specify or even know what the camera name is. (In fact, it's Camera01.) This wire obtains the name from the camera module, making it available to the 3D Window module.
If you previously closed the Wire editor, double-click the wire, but not its "not" parameter symbol, to display the Wire editor again.
Caution: If you click Constant in the Wire editor while the camera name parameter is highlighted, the Wire editor changes its type to 'a string', which is the only way to specify a constant name. To fix this immediately, choose Edit/Undo. To fix it at a later point, you can delete the wire and start over, or you can use the Wire editor to correct the problem by following these steps:
You have to click these two buttons in this order, because Hyperwire can't know what the input port options are before it knows which module they belong to.
Run the title to test it.
In the example at the start of this exercise, the animation plays only when you click the airplane itself. To add this capability, you treat the airplane as a Hyperwire module, as you already do the two cameras.
The 3D Mesh module's Properties dialog associates the mesh with the A-10 world by default, because it is the only 3D World in your title.
Now to run the animation, you must click the airplane. Clicking other parts of the 3D Window has no effect.
Run the title to test it, and then save your work.
This is the end of exercise 11. Exercise 12 shows how to use hotspots on a map of a 3D world to assist the user in navigating it.