by Jim O'Donnell
The advent of the World Wide Web (WWW), the HyperText Markup Language (HTML), and Web browsers capable of viewing HTML documents including text, graphics, and sound revolutionized the Internet. Previously, the most common way of exchanging information was through e-mail and Usenet discussion groups. Because these methods could handle text only, the only way to exchange graphics, sound, or other binary information was for the sender to encode it and the receiver to decode it. HTML and the WWW changed this process by enabling you to create true multimedia information sites on the Internet, offering real-time display and exchange of text, graphics, sound, and other information.
The next big step beyond HTML for information distribution on the Internet may be the Virtual Reality Modeling Language (VRML). HTML's hypertext links and the Web browsers that make use of them create an essentially two-dimensional interface to Internet information. VRML expands this interface by allowing the creation of three-dimensional worlds on the WWW, offering a much more natural way of presenting information.
In this chapter, you learn about the following:
The Virtual Reality Modeling Language and what it is good for
Some basic notions of VRML programming, and how it relates to HTML
Tools available for creating, viewing, and browsing through VRML documents and sites
How to install and use WebFX, a Netscape plug-in module that adds VRML browsing capability
VRML, the Virtual Reality Modeling Language, is an authoring standard, currently defined at version 1.0, for creating three-dimensional documents on the World Wide Web. These documents create VRML worlds that a user can navigate in and around using the capabilities of a VRML-compatible browser. The current standard is file-based, involving the transfer of 3-D scenes to the local computer-VRML source files usually have a .wrl extension-after which all navigating through the scene is done there. And, like HTML documents, VRML worlds can contain links to other documents, graphics, text, HTML documents, or other VRML worlds.
Freeware, shareware, and commercial VRML tools are becoming
widely available.
|
Note |
|
Included with the Windows WebFX VRML browser, a plug-in module for Netscape Navigator 2.0 that is discussed later in this chapter, is a series of sample VRML worlds. To get a feel for what navigating around a VRML world is like and how it is different from regular HTML, you look at a simple VRML world in this chapter.
Figure 17.1 shows a sample VRML world called Netscape.wrl, which, when loaded, shows an up-close view of the familiar Netscape "N." After you install the WebFX plug-in, Netscape automatically calls WebFX when a VRML world is loaded. (You know it has been called successfully if you see the WebFX Navigation Bar at the bottom of the browser window.) At this point, this world looks like an HTML imagemap. The pointer even turns into a hand pointer when you move it over the "N," indicating the presence of a hypertext link. However, you can navigate around this three-dimensional world.
Figure 17.1 : When you enter this sample VRML world, you see the familiar Netscape "N".
WebFX beginners can click the ? (question mark) WebFX button to turn on the Heads up display. Then, when you click the fly button, the display shown in figure 17.2 appears, indicating how to navigate around while you're in WebFX fly mode.
The quickest way to show the three-dimensional nature of the VRML world at this point is to press and hold down the Z key, which is used in fly mode to thrust backward. You quickly see the Netscape "N" world recede into the distance, as shown in figure 17.3. The star field in this figure is a background image allowed by VRML.
Figure 17.3 : By pressing Z to thrust backward, you can move away from "Netscape World".
After you move some distance from the Netscape world, you can reverse course and approach it again by pressing the A key to thrust forward. Using this key, you can retrace the steps from where you began to thrust backward-you can also keep going to get a much closer view of the Netscape "N" (see fig. 17.4). You can even continue to thrust forward until you are past the "N," in which case you see only the star field background. At this point, you can turn around by pressing the right- or left-arrow key, and you actually move behind the "N" world (see fig. 17.5).
Figure 17.5 : You
can even move past the object and turn around to see it from behind.
|
Tip |
|
Because the WebFX VRML browser is a Netscape plug-in, you might suspect that, just as with an HTML document, you can link together VRML worlds using hypertext links. You can even interchangeably link VRML worlds and HTML documents! Other VRML browsers offer similar capability, whether they are Web browser plug-ins, helper applications, or stand-alone applications.
In this chapter's sample Netscape world, for instance, when you place the pointer on the "N," the pointer turns into the hand pointer, indicating the presence of a hypertext link. As shown in figure 17.6, the hand pointer and a label for the hypertext link, which appears in the upper left, indicate where the link will take you. In the case of this Netscape world, as you might expect, clicking on the link takes you to the familiar Netscape HTML home page.
|
Caution |
|
In many ways, VRML is an extension of HTML; the source code for HTML documents and code for VRML worlds are very different, but the concepts are similar. The differences between the two lie in the fact that HTML documents are two-dimensional, whereas VRML worlds are three-dimensional. An HTML document is like a bulletin board, where text and graphics can be displayed, and each can also represent a hypertext link to another place in the document, or another document entirely. On the other hand, a VRML world is more like a room (or world, I suppose, if it's big enough) filled with three-dimensional objects. Because of the three-dimensional nature of the VRML world, you can navigate around and see objects from all sides. In VRML, like HTML, each of these objects can also be a hypertext link.
With a VRML-compatible Web browser, users can navigate back and forth between HTML documents and VRML worlds with no additional steps. This compatibility is achieved either by means of a plug-in module such as with WebFX and Netscape Navigator, by setting up a VRML browser as a helper app for a Web browser, or by using a stand-alone VRML browser that also supports HTML. Inside an HTML document, if there is a hypertext link to a VRML world, it will be loaded and the Web browser placed into a VRML browsing mode. Conversely, HTML links from a VRML world will lead back to conventional web page viewing.
Just as with HTML documents, VRML worlds are defined by VRML source code. However, as you might imagine from the fact that VRML worlds are three-dimensional, the source code is likely to be much more complex. Figure 17.7 shows the top of the VRML source file for the Netscape world. The VRML language is much more like C/C++ than it is like HTML.
Figure 17.7 : VRML "worlds" are defined by VRML source code as shown here.
Many tools are currently being written to allow HTML authors to create Web pages and documents more easily. You can, however, create fairly sophisticated Web pages programming directly in HTML. Because of the complexity of VRML, however, it would be very difficult to do the same-to create a VRML world by directly writing VRML code. Consider the Netscape world, which consists of only a few objects-the Netscape "N," the sphere upon which it rests, and the "glow" around them. The source code to describe the Netscape "N" is partially shown in figure 17.8. Even a relatively simple object like the "N" is described by a long series of coordinates. Programming this object directly would be very difficult.
To be able to create VRML worlds, you need to use a VRML authoring tool for creating VRML 3-D objects and building them into a world. Libraries of VRML objects are also available on the Internet.
A variety of tools for viewing and creating VRML worlds-freeware, shareware, and commercial-has begun to appear. Because of the relative infancy of the VRML version 1.0 standard, most of these products are still in the beta test stage and are available for at least trial use through the Internet. VRML tools are primarily being developed for two platforms: Windows (3.1, Windows for Workgroups, 95, and NT) and UNIX (primarily SGI and Sun) machines.
The following are some of the VRML browsers currently available, along with the platform for which they are made, and where on the WWW to look for more information:
WebFX: This VRML browser is a plug-in module for
Netscape Navigator that allows it to act as an integrated part of Netscape.
Paper Software, the maker of WebFX, is also planning to release a product
called WebFX Explorer, which will be a stand-alone VRML browser. WebFX runs
under any flavor of Windows.
http://www.paperinc.com/webfx.html
Microsoft VRML Plug-In for Microsoft Internet Explorer:
This is Microsoft's VRML browser, meant to act as a plug-in specifically for
its own Internet Explorer.
http://www.microsoft.com/windows/ie/vrml.htm
SDSC Web View: This VRML browser is available for the
SGI and Sun UNIX platforms.
http://www.sdsc.edu/EnablingTech/Visualization/vrml/webview.html
VR Scout: This stand-alone VRML browser runs under
Windows 3.1 and Windows 95.
http://www.chaco.com/vrscout/
WebSpace Navigator: This commercial product (available free for beta
testing) is part of SGI's VRML WebSpace suite of programs.
http://www.chaco.com/vrscout/
WorldView: This product was the first Windows VRML
browser. It can act as a stand-alone program or as a helper application.
http://www.webmaster.com/vrml
|
Tip |
|
VRML worlds can be considerably more complex than HTML documents, which makes sense considering that they are three-dimensional models. A full discussion of creating VRML worlds would require a book in itself, but in this chapter you go over the types of tools that you are liable to require. Later in the chapter, you find a simple example of creating a VRML world using Fountain, by Caligari Software.
Object Editors: To create a three-dimensional world, you need 3-D objects naturally. You can do this in several ways. The first is to create your own using a VRML object editor, which allows you to create a 3-D VRML object to be used in one or more VRML worlds.
Object Libraries: Many of the 3-D objects you are likely to need-cubes, spheres, trees, and so on-have probably already been created by someone else. Libraries of VRML objects from which you can get these objects are available on the Internet.
Conversion Utilities: A third way to produce 3-D VRML objects is to convert them from other programs and other formats. You can find utilities that will convert for several different kinds of 3-D objects.
VRML World Building Programs: After you have assembled the objects you need, the final step-the real act of creating a VRML world-is to assemble them to make the world you envision. To create your world, you need a program that allows you to build a VRML world from component 3-D objects, embed the hypertext links and other information that you want to include, and write out the VRML source code.
To get a better feel for what using a VRML browser is like, you install and try out one of them, WebFX by Paper Software, in the following sections.
The version of WebFX used herein is the WebFX plug-in for Netscape Navigator 2. To install this plug-in, follow these steps:
Copy the file npwfx32e.exe from the CD into a temporary directory on your hard drive.
Run npwfx32e.exe. Running this executable gives the following files (if you have to hide MS-DOS file extensions for registered file types, this list might look a little different, but the files will still be there):_setup.dll.z
Run Setup.exe. If you installed Netscape Navigator 2 in the default location and want to do the same for WebFX, you can select the defaults for each entry in the
You should get a message similar to the one shown in figure 17.9, indicating a successful installation. WebFX is now installed as a Netscape Navigator plug-in module, and automatically runs when you encounter a VRML source file when using Netscape.WebFX plug-in is usually meant for a specific version of Netscape Navigator. Make sure you have compatible versions before installing or you may have unpredictable results.
WebFX offers three different modes for navigating around and through a three-dimensional VRML world: walk, fly, and point. Other VRML browsers may have different means of navigation-the VRML source file defines the layout of the world, but the browser dictates how you travel through it.
To get some help in remembering what actions work in each mode, click the ? (question mark) WebFX Navigation Bar button, which enables the Heads up display. If you then click the walk button, you have the following navigation options:
Left-drag (clicking and holding the left mouse button while moving the cursor): Allows you to "walk," or move slowly, through the VRML world. The direction and speed of movement is dictated by the position of the cursor with respect to the destination point, which is set by using a double-click. When the cursor is to the left or right of the destination point, you move in that direction. When it is above or below the destination point, you move forward or backward, respectively.
Double-click (rapidly clicking the left mouse button twice): Sets a destination point to go to. If the crosshairs are enabled in the Heads up display, they appear at the destination point.
Right-drag: Causes the entire VRML world to "orbit" about your current position.
Alt: Holding down the Alt key while using a left-drag allows you to "slide" up or down when you move the cursor above or below the destination point instead of moving forward or backward.
Arrows: The keyboard arrow keys act just as a left-drag of the mouse cursor does in the appropriate direction.
When you place WebFX in fly mode, the mouse and keyboard actions change to the following:
Left-drag: Allows you to fly through the VRML world, traveling in all three dimensions, unlike walking, which is normally restricted to two. The placement of the cursor with respect to the destination point causes your viewpoint to pitch, roll, and yaw, and change your direction of travel.
Right-drag: Causes the entire VRML world to "orbit" about your current position, just as in walk mode.
Arrows: The keyboard arrow keys act just as a left-drag of the mouse cursor does in the appropriate direction.
A/Z: Pressing and holding down the A or Z key allows you to thrust forward or backward, respectively, through the VRML world.
The last navigation mode of WebFX, point mode, allows you to navigate the VRML worlds as follows:
Left-click: Moves you toward the VRML object upon which the cursor is positioned.
Left-drag: Although this action is not defined in the Heads up display, you can use it in this mode; it performs the same function as in walk mode. The only difference is that your destination point is defined by wherever you first click the cursor, as opposed to the double-click method used in walk mode.
Double-click: Moves you toward the VRML object upon which the cursor is positioned, and if that point is also a hypertext link, it causes Netscape Navigator and/or WebFX to jump to it.
Right-drag: Causes the entire VRML world to "orbit" about your current position, just as in walk and fly modes.
Alt: Holding down the Alt key while using a left-drag allows you to "slide" up or down when you move the cursor above or below the destination point instead of moving forward or backward, just as in walk mode.
Arrows: The keyboard arrow keys act just as a left-drag of the mouse cursor does in the appropriate direction.
|
Troubleshooting |
|
I've loaded a VRML world, and I can't see anything! What should I do?
|
WebFX allows you to customize its behavior in several different ways. This customization is achieved using a pop-up menu and submenus that first appear when you right-click. The main pop-up window shown in figure 17.10 then appears.
Each of the six entries shown in the main pop-up window gives you different options for customizing WebFX. The following describes the most important submenus, but you should feel free to experiment with these and the other options to get a feeling for what you can do with WebFX.
ViewPoints: In a VRML world, you can easily get lost, especially when you're just learning your way around. The Entry View selection in this submenu allows you to move quickly back to the point at which you entered the VRML world (see fig. 17.10).
Detail: Once a VRML world has been downloaded to your computer, the navigation through that world is handled locally. Because VRML worlds can be quite complex, this process is sometimes kind of slow, particularly on older computers. If you find this to be the case on your computer, you can adjust the level of detail by using this submenu. By switching from Solid to Wireframe or Point Cloud, you decrease the complexity of the image and may improve the response time (see fig. 17.11).
Figure 17.11:
WebFX allows you to control how much detail is shown in the three-dimensional
image.
|
Tip |
|
Heads up Display: The entries in this submenu dictate what information is shown on the WebFX Heads up display when it is enabled (see fig. 17.12).
In this section, you examine an example VRML world I found while surfing the Internet. It is a good example of an achievement with VRML worlds that might not be as effective with a standard HTML Web page. It also demonstrates how these two types of documents-representing two ways of presenting information-can be effectively used in tandem.
Using Netscape Navigator 2 with the WebFX plug-in installed, I connected to the following URL:
Note the .wrl extension, denoting a VRML world source document. After the connection was made by Netscape, the WebFX plug-in was called, the VRML world source was downloaded, and the image shown in figure 17.13 appeared. Although it isn't obvious, this figure shows the University of Essex campus, as seen from a long way off.
Figure 17.13: The entry point to the University of Essex VRML world.
To get a closer look, put your WebFX in fly mode and fly in toward the VRML world. Give yourself a little bit of altitude to be able to see more of the campus buildings. As you get closer, you'll see the campus layout shown in figure 17.14.
Figure 17.14: You can fly in closer to the University and see a view of the campus.
As you learned earlier, VRML worlds and HTML documents can call one another interchangeably. The University of Essex site uses this capability to not only convey the three-dimensional layout of its campus, but also to allow visitors to learn more about the different campus facilities. Consider figure 17.15; I placed the cursor over a building that has a hypertext link, indicated by the presence of the hand pointer and the URL label in the upper-left corner of the screen. Apparently, this building is the University Library. When I double-clicked, an HTML web page was called (see fig. 17.16), giving information about the library.
Figure 17.15: By placing the pointer over a given building and clicking...
Figur 17.16: ...you can jump to an HTML document with information about it.
Because the VRML world is a three-dimensional model, you can look at it from any angle, including from below (which isn't very helpful) and from above, as shown in figure 17.17, giving you a useful map of the University of Essex campus.
Figure 17.17: You can even fly up highly enough and look down to get an aerial map of the campus.
Discussing VRML authoring would take a whole book, but we'll
take a quick look at what it would entail here. To do so, use Caligari
Software's Fountain.
|
Note |
|
To install Fountain, follow these steps:
Copy the file Fountain.exe from the CD into a temporary directory on your hard drive.
Run Fountain.exe. Running this executable gives you the
following files (if you up to hide MS-DOS file extensions for registered file
types, this list might look a little different, but the files will still be
there):
exe
Setup.exe
ins
txt
txt Fountain.z
Run Setup.exe. The installation process is fairly straightforward, and only requires you to decide where to install the Fountain software.
You should get a message similar to the one shown in figure 17.18, indicating a successful installation. Fountain is now installed on your computer. To use it, you should create a desktop shortcut icon for it, install it in the Start menu, or run it using the Run option of the Start menu.
Figure 17.18: When Fountain has successfully installed, you get a dialog box similar to this one.
Now you're ready to create a simple VRML world using Fountain.
To create a simple world with one object and a hypertext link, follow these directions:
Start Fountain, and select File, Scene, New to create a new VRML world.
Select the Text Primitive button, and type some text. In figure 17.19, , JOD.
Select the Sweep button, which makes the selected object three-dimensional. By grabbing an edge of the text and dragging the cursor, you can , as shown in figure 17.20.
Select the Attach URL Link button so that you can add a hypertext link to the selected object (see fig. 17.21).
Figure 17.19: After selecting the Text Primitive button, you can type the desired text.
save the document by choosing File, Scene, Save. Use the file name jod.wrl. To see if you were successful, try to load this file using Netscape Navigator with the WebFX plug-in module installed. You then see the screen shown in figure 17.22. You can see that the hypertext link is there-when you move the cursor over the text object, it turns into a hand pointer and the URL label appears in the upper-left corner. Because this model is three-dimensional, you can navigate around, getting closer or farther away from the objects there, changing the viewpoint (see fig. 17.23).
This example creates multiple objects and gives an idea of how to manipulate light sources and change the color of objects. In this one, we attempt to achieve a similar effect to the Netscape "N" world shown at the beginning of the chapter.
Start Fountain, and select File, Scene, New to create a new
VRML world. Start off by creating a sphere using the Sphere button in the
Primitives panel (see fig. 17.24).
Figure 17.24: First you create a
sphere to be your "world." The 3-D arrow points to the current objects.
To create the "JOD" letters (instead of the Netscape "N"),
first select the font by Text Primitives button, which will give you the font
selection dialog box shown in figure 17.25.
Figure 17.25: Right-clicking on
the Text Primitives button allows you to pick your font and font size.
After selecting the font, left-click the Text Primitives
button, left-click somewhere on the screen, and type the letters JOD.
Then select the Sweep button to get three-fig. 17.26).
Figure 17.26: After typing in
the letters JOD, you can hit the Sweep button to create the 3-D look.
Now move the "JOD" on top of the sphere. To do this, select
the Object Move button. Left-dragging moves objects right and left, or back
and forth. Right-dragging moves them up and down. Figure 17.27 shows what it
looks like after the "JOD" has been embedded in the top of the sphere.
Figure 17.27: You can move the
JOD on top of your "world," even embedding it in the top.
To change the color of an object, in this case the sphere,
select the Paint Facesbutton, which gives the panels shown in figure 17.28.
These panels give you the option of what color and shading to use when
coloring an object.
Figure 17.28: The Paint Faces
button brings up these panels, giving you options for what color and style to
use to paint an object.
Figure 17.29 shows the sphere after being colored blue. Now,
to further manipulate the appearance of the world by creating and configuring
a local light source, select the Local Light Source button from the Primitives
panel. This gives the Lights panel shown in figure 17.29. The light source can
be moved around just as any other object.
Figure 17.29: After painting
your world, you can adjust where and what color the light sources are.
By moving the local light source above and in front of the
letters and sphere, you can brighten its appearance (see fig. 17.30).
Figure 17.30: Moving the light
sources in front of your "world" brightens its appearance.
By selecting File, Scene, Save As, the VRML world can be
saved, as shown in figure 17.31.
Figure 17.31: You can save this
world as a WRL file.
Your results can be viewed with any VRML-compatible browser.
WebFX displays it as shown in figure 17.32.
Figure 17.32: You can view this
sample world using the WebFX plug-in for Netscape Navigator.
By naviworld, one of the hazards of working in three dimensions becomes apparent. As shown in figure 17.33, you have to remember to work with all sides of an object-when you are coloring objects, for instance, be sure to get all sides!
system set up to view VRML documents, you'll want to start cruising the Internet and theWorld Wide Web to see what VRML resources and worlds are available. The list is growing every day. Following are a few of the bigger sites that will direct you to many other VRML resources-browsers, authoring tools, worlds, and object libraries:
The makers of WebFX maintain a directory of many VRML worlds
located at
http://home.netscape.com/comprod/products/
navigator/version_2.0/plugins/vrml_sites.html
A group called Mesh Mart also maintains a Web site of many
VRML resources, including browsing and authoring tools and VRML worlds at
http://cedar.cic.net/~rtilmann/mm/vrml.htm
NCSA, the author of NCSA Mosaic, has a VRML Web page at
http://www.ncsa.uiuc.edu/General/VRML/VRMLHome.html
A repository of VRML information is maintained at
http://rosebud.sdsc.edu/vrml/
Wired has a VRML Forum at
http://vrml.wired.com/
Silicon Graphics is very active in VRML development. A site
with information about its WebSpace products is located at
http://webspace.sgi.com/