PREVIOUS   NEXT   CONTENTS   HOME 

2.4 An Introduction to VRML

2.4.1 The VRML document - An anatomy Lesson

The VRML file starts with a header describing the contents. IN VRML version 1.0 this takes the form

#VRML v1.0 ASCII

but will be changed in subsequent versions.

Following the header are a number of nodes. Nodes represent the building blocks of VRML and describe shapes, lights, cameras, position and orientation.

Nodes take the form

 	Type {field
       field
       field}
 
 e.g.  Cylinder{height 10
        radius 0.5}
 
 This draws a cylinder of height 10 units
         and radius 0.5 units.
 

Or,

       Translation {translation 0.0 1.00.0}
 
 
 moves up one unit.
 

The number of fields varies according to type and defaults will exist if they are omitted, eg:

       Sphere { }
 
 draws a sphere with a radius of one unit.
 

The curly brackets after type are NOT optional.

The structure of a VRML file is known as the Scene Graph; the order of nodes within the Scene Graph is critical, as changes in position or orientation affect all subsequent nodes.

A tree-like structure can be created using separator nodes which allows parts of the Scene Graph to be functionally independent and isolated from subsequent nodes. Specific states, for example colour, will then be saved before entering the separator to make specific state changes, and restored upon leaving. DEF may be used to define objects and USE to subsequently re-use the object, thus allowing some degree of efficient, modular programming.

All of the objects need not necessarily be defined within the one file. Instances of objects on the same server or elsewhere on the internet may be included within the file. In addition, Colours may be applied to objects or bit-mapped images may be applied to the surfaces as textures. When completed the entire VRML file is saved with the extension .WRL to designate it as a virtual world.


 PREVIOUS   NEXT   CONTENTS   HOME 

© Internet Archaeology URL: http://intarch.ac.uk/journal/issue1/gillings/part9a.html
Last updated: Tue Sep 5 1996