AGOCG logo
Graphics Multimedia VR Visualisation Contents
Training Reports Workshops Briefings Index
This report is also available as an Acrobat file.
Back Next Contents

2 About VRML

2.1 History

The need for a three-dimensional equivalent of the HTML standard was first recognized at the first International Conference on the World Wide Web in Geneva, held in the spring of 1994. At this conference, Tim Berners-Lee and Dave Raggett (two of the original developers of the WWW), organized an informal 'Birds-of-a-Feather' session to discuss the creation of 3D virtual reality interfaces to the WWW. Following some presentations of current work in this field, the attendees agreed that any future progress would require a new common language for describing the 3D scenes with WWW hyperlinking features. Thus VRML (originally Virtual Reality Markup Language) was conceived.

Such was the interest expressed at the meeting that an internet mailing list (www-vrml), hosted by Wired Magazine, was set up to discuss the requirements for such a language (see section 7.2 for more details). Within a week over 2000 people had subscribed to the list.

The participants soon reached the consensus that the first version of VRML should be based on one of the 3D modelling languages already in existence. This would avoid 're-inventing the wheel' and so speed up development. A number of different candidates were put forward, including AutoDesk's Cyberspace Development Format (CDF), The Object Orientated Geometry Language (OOGL) from the University of Minnesota and the Manchester Scene Description Language (MSDL) from the University of Manchester. However, after some debate the members of the mailing list decided that VRML should be based upon Silicon Graphics' Open Inventor ASCII file format. The main reasons for this choice were:

It was also decided that the more difficult problem of implementing multi-participant interactions and behaviours should be left to later versions of VRML, VRML 1.0 would only describe static worlds. Discussion continued on the mailing list on how to extend the Open Inventor language to allow platform independence and hyperlinking to the World-Wide Web.

The first draft of the VRML 1.0 specification was presented to the second WWW Conference at Chicago in October 1994. The authors of the specification are Gavin Bell (Silicon Graphics, Anthony Parisi (Intervista Software and Mark Pesce (VRML List Moderator

In April 1995, Silicon Graphics and Template Graphics launched WebSpace, the first VRML compatible Web browser. Seventeen other companies and organisations also announced their support for VRML. Since then many more VRML browsers have become available, together with other software tools for creating VRML worlds. There is also an ever-increasing number of Web sites containing VRML models.

VRML 1.0 Specification Document

The VRML 1.0 specification document is available in the HTML format at:

The latest version with clarifications can be found at:

2.2 Language Details

This subsection will use an example to explain some of the powerful and interesting features of the Virtual Reality Modelling Language. The VRML file which created the scene shown in Figure 2-1 is listed below.

Figure 2-1 Planet AGOCG and the Starship Enterprise (49K)

Description of VRML Example Scene

Our example scene contains a light source and just two objects: a sphere texture mapped with the AGOCG logo ('Planet AGOCG') and the Starship Enterprise. Figure 2-1 shows how this VRML file appears when loaded by the WebSpace VRML browser (more about VRML browsers in the section 3). As well as describing the geometry and appearance of the 3D scene, VRML can also integrate it into the World-Wide Web. In our example, this is demonstrated in two ways. First, the sphere is hyperlinked to the AGOCG WWW home page. A user can usually follow a hyperlink by placing the mouse pointer over the appropriate object and clicking, though the exact action is dependent on the VRML browser. When a hyperlink is selected, this will tell the VRML browser to go and fetch the appropriate information from the Web. In this case it is an HTML document, if the VRML browsers cannot display HTML, the document will be displayed in the window of an HTML browser, such as Netscape or Mosaic.

The second WWW linking feature demonstrated in the example, is the use of inline objects. The geometry of the Starship Enterprise is not contained in the VRML file listed below, nor is it in any file on the same computer. The Enterprise model is actually located on a Web server at the NASA National Space Science Data Centre.

    1	#VRML V1.0 ascii
    3	Separator{
    5	    # Define camera position and give it a name
    6	    DEF Camera1 PerspectiveCamera {
    7	 	position    -240 -30 30
    8	 	orientation 0.15 -1.0 0.0 1.44
    9	    }
   11	    # Light source
   12	    PointLight {
   13		location -270 0 220
   14	    }
   16	    # The textured mapped sphere hyperlinked to AGOCG Home Page
   17	    WWWAnchor {
   18		name ""
   19		description "Goto AGOCG WWW Home Page"
   20		Material {
   21		    diffuseColor  0.6 0.7 0.9
   22		    specularColor 1.0 1.0 1.0
   23		    shininess 0.5
   24		}
   25		Texture2 {
   26	 	    filename "agocg.gif"
   27		}
   28		Sphere {
   29		    radius 100
   30		}
   31	    }
   33	    # The inline Starship Enterprise
   34	    Separator {
   35		Transform {
   36		    translation -150 0 0
   37		    rotation 1 0 0 -1.57
   38		}
   39		WWWInline {
   40		  name ""
   41		}
   42	    }
   43	}

The VRML Header (line 1)

Now let's look in more detail at the VRML file. Note that the line numbers on the left hand side are included for reference only and are not part of the VRML document. The first line of a VRML file must always contain the header #VRML V1.0 ascii. This identifies it as VRML version 1.0 document, and so an application cannot confuse it with an Inventor file, for example.

Scene Graph and Nodes

The rest of the VRML document consists of a list of objects called nodes. These are arranged in a hierarchical structure called a scene graph, with nodes embedded within other nodes. Each node contains part of the information which is used to build up the whole scene. For example, a node may define part of the geometry of the model, or the position of a light source, or the Uniform Resource Locator (URL) of a hyperlink. Every node has the same general syntax:
	DEF objectname objecttype { fields children }

Objecttype is a name which indicates what type of node it is, for example a sphere or transformation. To give an object a name the DEF objectname syntax is used. Within the curly braces are the parameters which control the characteristics of the object, for example the radius of a sphere. Group nodes can contain other nodes, the children nodes are contained within the braces. Only the objecttype and braces are required, the rest are optional.

The order of nodes is important, because a node can affect other nodes which come after it. Group nodes, which gather other nodes together, are used to insulate sections of the scene graph from other parts and ensure that nodes within the group are treated the same way. The Separator node in line 3 is an example of a group node. Here it is collecting all the elements of the scene into one node. The end brace of the Separator node is on line 43. Indenting is used to make it easier to see the structure of the VRML file, but it is not a requirement of the language. Comments are also included to make things more readable. A comment is indicated by the # character. All characters after it until the new line will be ignored by the VRML software. An Info node can be used for important information about a VRML model, such as copyright notices.

Camera Node (lines 6 to 9)

The PerspectiveCamera node is used to indicate to the VRML browser where the initial viewpoint should be. This node has four fields to define the viewpoint and perspective projection, these are position, orientation, focalDistance and heightAngle. By default, the camera is located at (0,0,1), looking along the negative z-axis. The y-axis is up. To change to the new viewpoint at (-240,-30,30), only the position and orientation values need to be changed from their default values (as defined in the specification document), so only these fields need to be included (lines 6 and 7). The VRML browser will assume the focalDistance and heightAngle default values as read. This property is true for all nodes, and is a useful way of keeping the VRML file compact.

If no viewpoint is defined, then the VRML browser determines its own initial viewpoint. Note that in the example the DEF syntax has been used to give the camera node the name 'Camera1'.

Scene Illumination (lines 12 to 14)

The scene is illuminated from a white, omni-directional point light source at -270, 0, 220. Other lighting nodes are DirectionLight (parallel light rays) and SpotLight. Most VRML browsers have a 'headlamp' option which illuminates the scene if no light source is specified.

WWWAnchor (lines 17 to 31)

The WWWAnchor group node is used to implement the WWW hyperlinking feature of VRML. Whenever any of its children, in this case the textured sphere, are selected, the Web resource identified by the URL in the name field (line 18) will be loaded. Links can be to other VRML files, allowing the user to 'teleport' to other virtual worlds, or to HTML documents, audio files or images, in fact any file with a recognized MIME type. Non-VRML files will probably be displayed using other applications if configured correctly. The optional description field (line 19) provides additional text information about the hyperlink. How (and if) this information is presented to the user is dependent on the VRML browser.

Material Definition (lines 20 to 24)

We want the Planet AGOCG to have a shiny light blue appearance. So before the sphere shape (line 28) is defined it is necessary to set the diffuse, specular and shininess surface properties of the current material in the Material node. A colour is defined using the red-green-blue triplet. The ambient, emissive and transparency properties can also be defined in this node. Material properties are applied to all subsequent shapes until redefined or limited by the extent of a Group node.

Textures (lines 25 to 27)

The Texture2 node defines the texture map that is applied to all subsequent shapes. In this example, the WWWAnchor group node limits the extent of the texture mapping to the sphere. The texture is read from the URL specified in the filename field (line 26). The texture image could be located anywhere on the WWW, but in this case the GIF image file containing the AGOCG logo is in the same directory as the VRML file.

A problem with the VRML 1.0 specification is that it does not give a standard file format for the external texture image. A number of different formats are currently being used, including Silicon Graphics' RGB format, JPEG, GIF and BMP. An alternative method of defining a texture map, is to do it in-file in the image field of the Texture2 node, in the VRML uncompressed SFImage format.

Sphere and Other Shape Nodes (line 28 to 30)

To create a sphere in the scene the Sphere node is used. VRML contains a number of predefined shapes, as well as the sphere, there is the cube, cone, cylinder and ASCII text. By default the sphere is centred at (0,0,0) with a radius of one unit. In line 29 we have set the radius to 100 units. VRML is not just limited to these simple primitive shapes. More complex forms can be created from polygons using the Coordinate3 and IndexedFaceSet combination. The Coordinate3 node defines a set of points in space, IndexedFaceSet then joins these points to form polygons.

Transformations (lines 35 to 37)

To orientate the Enterprise model correctly and place it in the right place, a rotation and translation are required. This is achieved using the Transform node. VRML uses a right-handed coordinate system. Angles are measured in radians.

WWWInline (lines 39 to 41)

The WWWInline node enables other VRML models, located anywhere on the WWW, to be included our own VRML scene. A VRML file is referenced by including its URL in the name field of WWWInline. Our example uses a model of the Starship Enterprise located at the URL:

Like anything on the Web, it sometimes take a while for inline objects to be retrieved. Therefore the WWWInline node also allows bounding boxes to be defined. A wireframe bounding box will occupy the space taken by the object, while it is being loaded.


Although not included in the example, VRML allows the creation of multiple instances (or copies) of an object. If a node has been named using the DEF syntax, then an instance of it can be created later on in the file by using the USE keyword.

Multiple Viewpoints

A list of different viewpoints can be set up if more than one camera is defined in a Switch group node. Some VRML browsers then enable the user to select between these predefined viewpoints, thus creating a 'guided tour'.


The Level-Of-Detail or LOD feature permits alternate representations of the same object. This allows the complexity of a model to be reduced automatically as the distance between it and the viewer increases.


For more details about the VRML language see the specification document. Alternatively, an interactive tutorial on creating VRML worlds can be found at the URL

2.3 File Extension and MIME Type

The file extension for VRML files is .wrl, short for world. In order for Web servers and clients (such as browsers) to recognize the type of data they are handling a MIME type is defined. The MIME type for VRML files is x-world/x-vrml. Thus, if a VRML browser is installed on a UNIX system, the following line would need to be added to the user's or system-wide mime.type file:
		x-world/x-vrml    wrl
The x indicates that it is experimental, but registration is in progress, so it likely that the MIME type will be changed to world/vrml or model/vrml in the near future.
Back Next Contents

Graphics     Multimedia      Virtual Environments      Visualisation      Contents