Chemical & Engineering News

December 9, 1996


Copyright © 1996 by the American Chemical Society

Encoding in VRML

Virtual reality modeling language (VRML) is the three-dimensional equivalent of two-dimensional hypertext markup language (HTML). It is designed to be a univers al description language that can be read by browser software on any platform - PC, Macintosh, or UNIX.

In the 2-D world, the browser enables a user to jump from one document to another by clicking a mouse on hyperlinks. The document may be a text, graphic, video, or audio file, and files may be displayed or downloaded.

Documents intended for display are encoded in HTML. HTML makes use of tags enclosed in angle brackets to let the browser know how to display the document. It also makes use of anchors - lengthier than but similar to tags - for linking text to image, audio, or video files.

Hence, a document set up for display on the web might have, for example, a heading that would look like this:

<H1>This is a Level 1 Heading</H1>.

A title might appear like this:

<TITLE>This is the Title of the Document</TITLE>.

A hyperlink from the word chemistry to the American Chemical Society home page would take the form:

<A HREF = "http://www.acs.org"> chemistry</A>

and there are many other tags for other elements.

Since VRML must give instructions to a VRML viewer for operating with a 3-D screen image, it takes a quite different form. The language is still in plain text, however.

The idea behind the VRML format is that it supports complete descriptions of 3-D scenes with polygonally rendered objects, lighting, materials, ambient prope rties, and realism effects. The objects can contain most anything - 3-D geometry, sound data, or JPEG (joint photographic experts group) images, for example.

The objects are called nodes, and nodes are arranged in a hierarchical structure. A node might be a cube, a sphere, a texture map, a translation, and so forth. A node can have any number of fields - parameters that distinguish the node - or not have any fields at all; it can have a name to identify the node; and some types of nodes can contain other nodes, called child nodes. Altogether they form what is called a scene graph.

For example, a paper by chemistry professors Horst Vollhardt and Jürgen Brickmann at the Physical Chemistry Institute at Darmstadt Technical University in Germany (available at http://www.pc.chemie. th-darmstadt.de/psb95/) depicts a scene graph for carbon dioxide in a CPK space-filling representation.

Each time a VRML-encoded scene is rendered on the computer screen - many times per second - the computer works through the scene graph from top to bottom.

The actual VRML document specifies the hierarchical information in standardized format. For instance, colors are defined in the material node by red-green-blue values. In a simple example of a VRML 1.0 document to draw a green sphere, the document would look like:

#VRML V1.0 ascii

Separator {
Material ( diffuseColor 0 1 0 )
Sphere ( radius 2.19)

)

The final result is a screen image with which a user can interact to a greater or lesser extent. For example, the scene graph for carbon dioxide leads to a molecule that can be rotated with a click and movement of the cursor (left).

A new version of VRML, version 2.0, is enough of a change from the previous version to require a viewer designed to handle it. The new standard incorporates such changes as deleting some node types and adding others, adding new field types, and making various other modifications. For example, various ransformation nodes, like translation, rotation, and scale, are incorporated into a node called transform, which replaces "Separator" of version 1.0.

A new sensors node incorporates a variety of sensors. A touch sensor, for example, generates an event when the pointing device moves across an associated piece of geometry and the user clicks. Among other sensors are those for proximity; time; and cylinder, plane, and sphere.



Return to article