Creating VRML Pages

What is VRML?

VRML stands for Virtual Reality Modelling Language. It is a standardized format for describing three-dimensional objects as composed from 3-D primitives, such as spheres, cylinders, cubes, and pyramids. This standard provides a cross-platform and software-independent procedure for defining 3-D environments.

In addition, VRML incorporates one of the most powerful attributes of HTML, and that is the linking component. VRML allows for an object to acts as a link (or connection) to other internet documents, including other VRML scenes, hypertext documents, or even access to databases.

VRML documents are typically viewed using a VRML web browser, or through a VRML helper application, or more prevelantly now, using a VRML plugin. A VRML viewer renders the 3-dimensional environment specified in the VRML document and provides a number of function to the user. The user can view the scene from an infinite number of directions, by walking or flying about and through a scene. Many VRML viewers provide joystick-like controls that simulate the operation of an airplane. Hyperlinks are accessed through the familar point-and-click operation, except that instead of text one points to a particular 3-D object, such as a sphere or a face of a cube.

VRML Viewers

A number of different VRML viewers are available. Perhaps the most powerful and fully featured is Cosmo Player from SGI. Below is a list of some of the options available to you.
Name Platform URL Mode of Operation
Cosmo Player SGI SGI
Windows 95 and NT Plugin
Live3D Netscape PowerMac
Windows 3.2, 95, and NT
VRweb IICM, Graz SGI, Sun,
Dec, HP,
IBM, Linux,
BSD, Windows (NT, 95, 3.x) Browser
WorldView Intervista Windows 95 Plugin
Community Place Sony Windows 95 and NT Browser Plugin

The VRML Scene

An in-depth explanation of VRML is well beyond the scope of this brief set of instructions on using VRML for enhancing web pages. But as a short explanation of the concepts behind VRML, we present an examples below.

In the example, we have created a VRML scene of the molecule diadamantanedione.

The screenshot below shows how this molecule appears within a VRML viewer (Cosmo Player). The viewer renders a three-dimensional representation of the molecule (as defined within the VRML file) and provides tools at the bottom for moving about this scene. One can move in or out and around and through the molecule.

If you have a VRML plugin available, you will see below the active VRML scene. Assuming that you are using the Cosmo Player plugin, dragging the mouse across the globe will make the molecule rotate. The thumbwheel moves the molecule closer or farther away. The diamond box to the right allows for translation in the horizontal and vertical directions. Selecting the bombsite and then some part of the molecule moves this selected region to the center of the view screen. Other VRML viewers may have different ways of manipulating the VRML scene.

How to create Web Pages with VRML Scenes?

Again, a full tutorial on VRML is well beyond the scope of this introductory material. What we will concentrate on here is how to create a VRML file of a 3-D representation of a molecule. We will assume that you have the coordinates of the molecule in some standard file format. The key step is the conversion of this standard molecular file format to VRML. A number of options for doing this are available.
Option 1 - Conversion from pdb to VRML using pdb2vrml
The program pdb2vrml will convert pdb files to VRML directly. This program was developed by H. Vollhardt and J. Brickmann and is available for the SGI, Solaris, AIX, Linux, HP, and OS/2 platforms. This page gives instructions on how to run this conversion process. You must have the molecular coordinates stored within a pdb file format.
Option 2 - Conversion from multiple formats to VRML using WebLab Viewer
MSI's WebLab Viewer will create a VRML file using the Save command. WebLab Viewer accepts a wide variety of file formats as input, as detailed above.
What to do if you do not have the appropriate file format:
Unfortunately the number of molecular description file formats is large and growing. Your favorite software program may use its own proprietary format for saving molecular descriptions. What is needed is a universal translator which will interconvert a large number of formats. Fortunately, there is such a program.
Babel will interchange about 40 different file formats. It operates on a variety of platforms, including UNIX, Mac, and MS-DOS.

In addition, many of the visualization tools described in this set of pages and elsewhere will do a limited subset of file interconversions.

Next, rename the file to have the .wrl extension. This extension has become the preferred suffix to indicate VRML files, though some users have employed the .vrml extension. Make sure that your server will attach the MIME type x-world/x-vrml to the file. (Another possible MIME type has been proposed for VRML files, model/vrml, but this has not yet gained widespread use.)

Once you have converted your molecular file into a VRML file, all that is left is to place the file into your web page. This can be done in one of two ways. The first option is to create a link to the VRML file, such as:

<a href="yourVRMLfile.wrl">Click here to obtain the VRML view of the molecule.</a>

The advantage of this route is that is the most flexible procedure for the user, by allowing the user complete control over what tool he/she will use to visualize the VRML scene. The disadvantage is that the VRML scene will appear in either an external helper window or in a separate web page from the rest of the document.

The alternative is to assume that the user will have a VRML plugin available. The advantage here is that the VRML scene will appear within the main document. Since many plugins are available, and major software developers have committed to developing VRML plugins, this method is likely to be the favored one. To place a VRML scene within a page using a plugin, use the standard embed tag, such as:

<embed src="yourVRMLfile.wrl" height=100 width=100>

As with all uses of embed, the author must include the source file name, and the size of the scene, in pixels, using the height and width parameters. Note that you can use a size different than the 100x100 object specified in this example.

More Advanced VRML displays

This brief introduction will allow you to create a web document with a VRML scene. However, it is dependent on using external tools for generating the VRML file, and this leaves the author few options for customizing or adding features to the VRML scene. VRML is an extremely powerful language - it allows for complex texture mapping upon surfaces, animation of the 3-D scenes, and hyperlinks - none of which have been described here. To take advantage of these features requires some programming and the interested reader is encouraged to look at some of the sites below to learn more on developing with VRML:
© Steven M. Bachrach and Internet Journal of Chemistry