Virtual Reality Markup Language (VRML)

Working Specification

Revision 1.3.1 * June 1994

Anthony Parisi (dagobert@netcom.com) Mark Pesce (mpesce@netcom.com) Labyrinth Group, 45 Henry Street #2, San Francisco, CA 94114, USA


Introduction

An integral part of a visualized Web viewer is a "world parser", that is, a software engine which converts between geometry definitions, given in .vrml files, and a visualized geometry. For the purposes of user-configurability without additional tools, the decision was made to use a simple YACC-based parser and a very simple syntax to specify VRML worlds.


Syntax

VRML syntax is straightforward. A VRML file contains a series of declarations. Each declaration describes an object or a scene composed of objects. Declarations are block structured, with blocks delimited by the keywords Open and Close. The keywords Begin and End, and "{" and "}" are synonyms for Open and Close.

Whitespace is insignificant; declarations may extend across multiple lines and be separated by spaces or tabs.

Comments may be included at any point in a VRML file; they begin with the "/*" symbol, and continue through the first detected delimeter "*/".


Include

A standard file inclusion mechanism is provided for in VRML. In this manner, standard object definitions can be provided from other, predefined files. The syntax is as follows:

Include "filename"		/* includes file content here */

Note: Include is currently unimplemented.


Vertices

Vertices are where polygonals come to their points. They are, in essence, points which define polygonals. All vertices can be specified by the ordered tuple {x, y, z}. These three floating-point values refer to the placement of the point in the x, y, and z axes.

The definition of a vertex is as follows:

Vertex  xVal yVal zVal


Polygonals

The base type for all geometry is the polygonal. Polygonals may theoretically have an arbitrary number of vertices, though the current implementation allows only three (triangular)- or four (quadrangular)- vertex polygonals. The syntax for specifying polygons is

Poly Open
[Vertex 1, [Vertex 2, ...] ]
[qualities]
Close


Qualities

Polygons can have visible qualities attached to them, of the following types; Color, Material, and Texture. Each of these surface components can also be applied to an Object. These qualities are specified with the following syntax:

Color redComponent greenComponent blueComponent

Each of the color components are a floating point value between 0 and 1.

Material specularComponent powerComponent

The specularComponent is the "shininess" of the material, and the powerComponent is the reflectivity of the material. Each of these are represented by a floating-point value in the range of 0 to 1.

Texture "filename" orientx orienty mapping

The texture map file "filename" is read in and applied to the polygon (or object) and it is applied to the surface at the given orienation and mapping. Orientation is specified with an x and y component, and specifies the angle of application of the texture map onto the polygon or object. The mapping is one of the following:

Flat, Cylinder, or Sphere.


Objects

Objects are collections of polygons. Objects are hierarchical; an object can form part of another object. Objects need not be topologically "closed", that is, an object can have a "hole". Objects are named, and this name serves as a reference for further instances of the object within the VRML file. An object definition for a Box would look like the following:

Object "Box" Open		/* Begin definition */
	Poly Open		/* First polygon */
		Vertex	0 0 0	/* Has four vertices */
		Vertex	0 0 1
		Vertex	0 1 1
		Vertex	0 1 0
	Close
	Poly Open			/* Second polygon */
		Vertex	0 0 0		
		Vertex	1 0 0
		Vertex	1 1 0
		Vertex	0 1 0
	Close
	Poly Open			/* Third polygon */
		Vertex	0 0 0		
		Vertex	0 0 1
		Vertex	1 0 1
		Vertex	1 0 0
	Close
	Poly Open			/* Fourth polygon */
		Vertex	1 1 1		
		Vertex	0 1 1
		Vertex	0 0 1
		Vertex	1 0 1
	Close
	Poly Open			/* Fifth polygon */
		Vertex	1 1 1		
		Vertex	1 0 1
		Vertex	1 0 0
		Vertex	1 1 0
	Close
	Poly Open			/* Sixth polygon */
		Vertex	1 1 1		
		Vertex	0 1 1
		Vertex	0 1 0
		Vertex	1 1 0
	Close
	Color 1 0 .025			/* Color it redish */
	Material 1 .05			/* Make it specular */
	Texture "nerp" 0 0 Flat		/* Texture map specs */
Close					/* End definition */


Scenes

The highest-level construct in VRML is the Scene. A scene is a collection of independent objects which reside within a single "frame", or logical space. It is used primarily as a convenient grouping mechanism for definition of worlds. A scene is defined as a set of elements. Each Element of a scene is defined with an Object, a Position, which is equivalent to the Vertex construct, an Orientation in the y and z axes, given as two vertices, and an optional URL specification.

The syntax for a scene is as follows:

Scene "Magic" Open			/* Scene def with name */

	Element Open			/* Begins element def */
		Object "Bell"		/* Element object */
		Position 0 0 0		/* Position in scene */
		Orientation 0 1 0 0 0 1	/* Orientation, as above */
	Close

	Element Open
		Object "Book"		/* Element */
		Position 2 2 0		
		Orientation 0 1 0 0 0 1 	
		URL http://fool.netzero.com/grimoire.html
					/* HTML link for object */
	Close

	Element Open
		Object "Candle"		/* Element */
		Position 0 2 3		
		Orientation 0 1 0 0 0 1 	
		URL http://fool.netzero.com/banana.vrml 
					/* VRML link to world */
	Close

Close					/* End of scene def */


Sample VRML Files

This is a basic four-object cubic world.

This is a relatively complex object.


Open Issues

There are a lot of open issues. This list is by no means exhaustive.

There's no way to define a scene's position or orientation. What happens if multiple scenes are defined?

There's no way to define normals for polygon shading. This feature is in the upcoming version 1.4 of the VRML specification.

Include strings should be URL specifications, not file names.

It is desirable to specify a polymesh as three lists of objects; a list of polygon vertices, a list of polygon normals, and a list of faces, where each face is composed of entries from the other two lists. VRML object definitions should be similarly extended.

It should be possible to attach a URL to a single face of an object's geometry, as well as to the entire object.

Mark D. Pesce * Tony Parisi * June 1994

Copyright (c) 1994, Labyrinth Group
Permission is given to duplicate this document in any form.