Notice: This material is excerpted from Special Edition Using HTML, 2nd Edition, ISBN: 0-7897-0758-6. This material has not yet been through the final proof reading stage that it will pass through before being published in printed form. Some errors may exist here that will be corrected before the book is published. This material is provided "as is" without any warranty of any kind.
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.
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.
Like HTML, VRML is a fast-evolving standard for conveying information over the World Wide Web. If you are going to be working with VRML a lot, you would do well to frequently consult newsgroups and other Internet and WWW resources (such as those mentioned in the "VRML Resources on the Internet" section at the end of this chapter) that deal with VRML, its tools, and its standards.
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.
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.
If you turn on the Heads up display, WebFX gives you hints about how to navigate the VRML world.
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.
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).
By pressing A to thrust forward, you can move right up to the Netscape "N." You can even move through and beyond it!
You can even move past the object and turn around to see it from behind.
It's easy to get lost in a VRML world sometimes. If that happens in WebFX, right-click the screen and choose Viewpoints, Entry View to return to your starting point.
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.
Just as when using new HTML enhancements, if you would like to add VRML content to your Web pages, you should keep in mind that not everyone has the necessary software to view it. Therefore, you should also convey the information included in your VRML using conventional means.
When you move the pointer over an object that is a hypertext link, such as an HTML anchor, it turns into the hand pointer, and a URL label for the link appears in the upper-left corner of the window.
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.
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.
VRML 3-D objects, such as the Netscape "N," are defined by the coordinates of the lines that make up the object.
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:
The VRML Repository, whose URL is shown at the end of this chapter, is an excellent resource for finding the latest VRML tools and examples available.
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.
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:
The 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.
When WebFX has successfully installed, you get a dialog box similar to this one. WebFX now automatically runs when a VRM source file is encountered when using the Netscape Navigator.
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:
When you place WebFX in fly mode, the mouse and keyboard actions change to the following:
The last navigation mode of WebFX, point mode, allows you to navigate the VRML worlds as follows:
Troubleshooting
I've loaded a VRML world, and I can't see anything! What should I do?
Sometimes the initial viewpoint for a VRML world is poorly chosen, or you may have navigated yourself around until you are lost. In this case, the best way to try to find your way, in any navigation mode, is to do a right-drag, holding down the right mouse button and moving the pointer around to rotate the entire VRML world. Usually, you will be able to get the actual objects into view this way, and you can then use the navigation means discussed above to move in closer.
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.
Right-clicking in the VRML screen opens a pop-up menu that you can use to configure WebFX. The Entry View selection under the ViewPoints submenu returns you to where you entered the VRML world.
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.
WebFX allows you to control how much detail is shown in the three-dimensional image.
If you are using a slower computer, you can improve the performance of WebFX by changing the amount of detail that is shown.
The Heads up Display submenu allows you to control what information is shown in the WebFX Heads up display.
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:
http://esewww.essex.ac.uk/campus-model.wrl
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.
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.
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 their 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.
By placing the pointer over a given building and clicking...
Fig. 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.
You can even fly up high 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.
Unless you do three-dimensional modeling for a living, you may find that creating VRML worlds is not the easiest thing in the world. To improve your productivity and the ease with which you arrive at your final product, it's probably a good idea to sketch out what you want your world to look like on paper before diving into Fountain or another VRML authoring program.
See Special Edition Using VRML
To install Fountain, follow these steps:
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:
After selecting the Text Primitive button, you can type the desired text.
With the text object selected, by selecting the Sweep button, you can make the text three-dimensional.
You can attach a URL link to any VRML object. This link can point to an HTML document.
At this point, 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).
You can load my simple VRML world using Netscape Navigator and view it using the WebFX plug-in.
Because this world is three-dimensional, you can move in and around the world's objects. If you click the JOD text object, the hypertext link takes you to my HTML home page.
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.
First, you create a sphere to be your "world." The 3-D arrow points to the current object.
Right-clicking on the Text Primitives button allows you to pick your font and font size.
After typing in the letters JOD, you can hit the Sweep button to create the 3-D look.
You can move the JOD on top of your "world," even embedding it in the top.
The Paint Faces button brings up these panels, giving you options for what color and style to use to paint an object.
After painting your world, you can adjust where and what color the light sources are.
Moving the light source in front of your "world" brightens its appearance.
You can save this world as a WRL file.
You can view this sample world using the WebFX plug-in for Netscape Navigator.
By navigating around this sample world, 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!
You can see one of the effects of working in three dimensions-I didn't paint the back of my world!
After you have your system set up to view VRML documents, you'll want to start cruising the Internet and the World 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:
|