VRML files contain a set of objects.  Technically these objects are 
called nodes.  Nodes are arranged in "hierarchical structures", similar to 
directories and sub-directories on a disk.  For example, on a PC, the 
directory C:\WINDOWS\SYSTEM comes under (is a member of) the 
C:\WINDOWS directory.  In VRML, things at higher levels (in 
this example, the C:\WINDOWS directory) affect their members 
(C:\WINDOWS\SYSTEM).  For example, if a statement at the 
C:\WINDOWS level to make new objects red existed, then any 
objects created at the C:\WINDOWS\SYSTEM level would also be 
red.  However, if a statement at the C:\WINDOWS\SYSTEM level 
then changed it so that new objects were blue, objects at the 
C:\WINDOWS level are not necisarily blue, because the statement 
came at a lower level.  Therefore, when a node is closed, any changes made 
to the default material, translation, rotation etc. are lost.  A special 
node, called the separator node exists to separate these defaults.  Whilst 
this may sound complicated, it isn't that bad, and is easy to pick up.
Headers
Every VRML file must start with the same line so as to identify it easily as 
a VRML file :
#VRML V1.0 ascii
Comments
Comments can be started by using the '#' (hash) character.  Anything after 
this on the same line is ignored.  The comment is ended by the end of the 
line (ASCII newline or carriage return).  There is one exception to this 
where the '#' character is inside a string data type.  Note that some 
servers may strip out comments, so if you want to include copyright info or 
a bit about the author then use the Info node (see later).  Example:
#My Comment ...
General Layout
Each VRML file contains exactly 1 node at the highest level (in our example, 
each disk drive has only 1 root directory, C:\).  This node is 
therefore usually either the "Separator" or "SpinGroup" node.  You will see 
later that both of these nodes can contain any number of 'child' nodes, (or 
subdirectories in our example). A typical VRML file might look like this:
#VRML V1.0 ascii
Separator {
	#The first level-2 node
	#The second leve-2 node
	'
	'
	#The 'n'th level-2 node {
		#The first level-3 node
		'
		'
		#The last level-3 node
	}
	'
	'
	#The last level-2 node
}
Node Parameters
Almost every node has an ascosiated set of parameters.  For example, the 
'Sphere' node has the parameter 'radius'.  In VRML, you do not have to 
specify parameters that you do not wish to change from the default value.  
For the 'Sphere' node, the 'radius' parameter has a default value of 
1 unit, so
Sphere {}
Sphere { radius 1 }
Sphere {
	radius 1
}
Cube {}
Cube {
	width 8
	depth 1
}
Coordinate System
VRML worlds use a "cartesian, right-handed, 3D coordinate system".  What 
does this mean?  Well, if you were looking at the origin (0,0,0) with +x 
going off to the right, and +y going straight up, then +z would be coming 
out towards you.
![[Picture of RH carterian axes]](axes.gif)
Standard VRML Units
VRML uses meters as the standard unit of distance, and radians as the 
standard unit for angles.  If you don't know how to convert from radians to 
degrees then use these formulas:
 Next Topic (Data Types)
Next Topic (Data Types) Previous Topic (Introduction)
Previous Topic (Introduction) Back to the VRML Reference
Back to the VRML Reference Back to the Main Page
Back to the Main Page