It may be replaced by an XML based form called W3D (Web 3 dimensions) in the future.
Official Specifications
VRML Consortium home page
[ home.html ]
VRML Standards and Specifications [ Specifications ]
Hint. if you are looking for an old or obsolete version of the VRML specification (e.g. VRML 2.0, VRML97 DIS, etc.), try putting ".old" at the end of the directory name. For example: .See http://www.vrml.org/Specifications/VRML2.0.old .
Air Hockey [ VRCS ]
Leonard Daly's examples [ example.html ]
Web3d.Guide's VRML Applications [ http://web3d.miningco.com/ ]
Resources
SGIs VRML resource page
[ http://vrml.sgi.com/ ]
. . . . . . . . . ( end of section Introduction) <<Contents | End>>
UML Model
The following is a downloadable Rational Rose 4.0 file
describing many of the classes of objects and their associations
[ vrml.mdl ]
Syntax
Disclaimer
This VRML grammar is ambiguous; semantic knowledge of the names and types of
fields, eventIns, and eventOuts for each node type (either builtIn or
user-defined using PROTO or EXTERNPROTO) must be used
to parse a VRML document correctly. See a specification of the various type of
Nodes to find out the details.
Lexicon
The '#' (0x23) character begins a comment wherever it appears outside
of quoted SFString or MFString fields. The '#' character and all
characters until the next carriage-return or newline make up the
comment and are treated as whitespace.
The carriage return (0x0d), newline (0x0a), space (0x20), tab (0x09), and comma (0x2c) characters are whitespace characters wherever they appear outside of quoted SFString or MFString fields. Any number of whitespace characters and comments may be used to separate the syntactic entities of a VRML file.
Some of the basic types that will typically be handled by a lexical analyzer:
Notation
The following have been used to defined the syntax and are not
part of the VRML itself.
. . . . . . . . . ( end of section Syntax) <<Contents | End>>
Fields
author_defined_types are generated by proto and externProto nodes.
(MF):
Predefined Field Names
There are many predefined field names:
backUrl="backUrl", in Background.
bind_changed="bind_changed", output from Background.
set_bind="set_bind", Background.
A Box for example is a rectangular parallelopiped with its center at the origin and a size determined by default or by its declaration. The VRML does not display a Box without making sure that the author has declared what it looks like - transparency, color, reflectivity, inner light, and so on.
(morphing): Notice that it is possible for the geometry of
a Shape to change, and yet the parameters defining a geometry (like the size
of a Box) can not be changed. Morphing has to be done by changing
the coordinates listed in the more flexible geometries: PointSet,
IndexedLineSet, and IndexedFaceSet. The actually morphing is done by an
Interpolator of the correct type.
The geometries listed here are all positioned near the origin of the co-ordinate system and in a standard orientation and scale. They can not be transformed however. Instead the shapes that use them can be translated, rotated and scaled... and so positioned where the author wants them to be. This is because the appearances of the shape must also be transformed at the same time as its geometry.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | size | SFVec3f | 2.0 2.0 2.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | radius | SFFloat | 2.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | bottomRadius | SFfloat | 1.0 |
| field | height | SFfloat | 2.0 |
| field | side | SFBool | TRUE |
| field | bottom | SFBool | TRUE |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | radius | SFfloat | 1.0 |
| field | height | SFfloat | 2.0 |
| field | side | SFBool | TRUE |
| field | top | SFBool | TRUE |
| field | bottom | SFBool | TRUE |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | string | MFString | [ ] |
| exposedField | length | MFFloat | [ ] |
| exposedField | maxExtent | SFFloat | 0.0 |
| exposedField | fontStyle | FontStyle | NULL |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | family | ("SERIF"|"SANS"|"TYPEWRITER"} | "SERIF" |
| field | style | ("PLAIN"|"BOLD"|"ITALIC"|"BOLDITALIC") | "PLAIN" |
| exposedField | size | SFFloat | 1.0 |
| exposedField | spacing | SFFloat | 1.0 |
| field | justify | ("BEGIN"|"FIRST"|"MIDDLE"|"END"} | "BEGIN" |
| field | leftToRight | SFFBool | "TRUE" |
| field | horizontal | SFFBool | "TRUE" |
| field | topToBottom | SFFBool | "TRUE" |
| field | language | language_value | "" |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | coord | Coordinate | NULL |
| exposedField | color | Color | NULL |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | coord | Coordinate | NULL |
| field | coordIndex | MFInt32 | [ ] |
| eventIn | set_coordIndex | MFInt32 | |
| exposedField | color | Color | NULL |
| field | colorIndex | MFInt32 | [ ] |
| eventIn | set_colorIndex | MFInt32 | |
| field | colorPerVertex | MFBool | TRUE |
If colorPerVertex is FALSE then each color in the colorIndex describes the color of a polyline, else it describes the colors of the points and the colors are interpolated on the lines.
A faceted object has faces. IndexedFaceSet, ElevationGrid and fields = following, Extrusion are all faceted:
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | ccw | MFBool | TRUE |
| field | convex | MFBool | TRUE |
| field | solid | MFBool | TRUE |
| field | creaseAngle | SFFloat | 0.0 |
A surface is a faceted object where the shading varies from place to place. It is an abstraction shared by IndexedFaceSet and ElevationGrid:
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | normal | Normal | NULL |
| field | normalIndex | MFInt32 | [ ] |
| field | normalPerVertex | MFBool | TRUE |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | vector | MFVec3f | [ ] |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | texCoord | TextureCoordinate | NULL |
| field | texCoordIndex | MFInt32 | [ ] |
| eventIn | set_texCoordIndex | MFInt32 | [ ] |
| eventIn | set_normalIndex | MFInt32 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | xDimension | SFInt32 | 0 |
| field | xSpacing | SFFloat | 0.0 |
| field | zDimension | SFInt32 | 0 |
| field | zSpacing | SFFloat | 0.0 |
| field | height | MFFloat | [ ] |
| eventIn | set_height | MFFloat | |
| exposedField | texCoord | TextureCoordinate | NULL |
Colors
Colors in VRML are specified using the RGB(Red-Green-Blue) coding.
[ colors.html ]
A list of colors is described by a Color node. This is used in several ways: to describe the colors of faces or surfaces, to allow a range of colors to be mapped onto an object, to attach colors to points, to allow colors to change, etc.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | color | MFColor | [ ] |
It is also possible to interpolate colors, see ColorInterpolator.
Visual Properties of Objects
These properties are used when defining geometries and Shapes. Also see
Colors.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | point | MFVec3f | [ ] |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | material | Material | NULL |
| exposedField | texture | textureNode | NULL |
| exposedField | textureTransform | textureTransformNode | NULL |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | diffuseColor | SFColor | 0.8 0.8 0.8 |
| exposedField | emissiveColor | SFColor | 0.0 0.0 0.0 |
| exposedField | specularColor | SFColor | 0.0 0.0 0.0 |
| exposedField | ambientIntensity | SFfloat | 0.2 |
| exposedField | shininess | SFfloat | 0.2 |
| exposedField | transparency | SFFloat | 0.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | repeatS | SFBool | TRUE |
| field | repeatT | SFBool | TRUE |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | url | MFString | [ ] |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | image | SFImage | 0 0 0 |
if number_of_bytes = 0 then texturing is disabled else following
| number_of_bytes | Meaning of each byte |
|---|---|
| 1 | Grayscale |
| 2 | Grayscale plus alpha |
| 3 | RGB |
| 4 | RGB plus alpha |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | url | MFString | [ ] |
| exposedField | speed | SFFloat | 1.0 |
| eventOut | isActive | SFTIme | |
| eventOut | duration_changed | SFFloat |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | point | MFVec3 | [ ] |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | translation | SFVec2f | 0.0 0.0 |
| exposedField | scale | SFVec2f | 0.0 0.0 |
| exposedField | center | SFVec2f | 0.0 0.0 |
| exposedField | rotation | SFVec2f | 0.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | appearance | Appearance | NULL |
| exposedField | geometry | geometries | NULL |
Selections
Switch chooses to display a choice to display.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | choice | MFNode | [ ] |
| exposedField | whichChoice | SFInt32 | -1 |
Grouping
Certain nodes have a field called "children": Group, Transform, etc. Others
have the property of being able to be bounded by a box.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | children | M Node | [ ] |
| eventIn | addChildren | M Node | |
| eventOut | removeChildren | M Node |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| field | bboxCenter | SFVec3f | 0.0 0.0 0.0 |
| field | bboxSize | SFVec3f | -1.0 -1.0 -1.0 |
Grouping nodes share the both of the above properties:
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | axisOfRotation | SVec3f | 0.0 1.0 0.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | url | MFString | [ ] |
Anchors and the WWW
An Anchor group of nodes makes it easy to move
from one world to a different one found on the WWW.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | url | MFString | [ ] |
| exposedField | parameter | MFString | [ ] |
| exposedField | description | SFString | "" |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | translation | SFVec3f | 0.0 0.0 0.0 |
| exposedField | rotation | SFRotation | 0.0 0.0 1.0 0.0 |
| exposedField | scale | SFVec3f | 1.0 1.0 1.0 |
| exposedField | scaleOrientation | SFRotation | 0.0 0.0 1.0 0.0 |
| exposedField | center" | SFVec3 | 0.0 0.0 0.0 |
Rotation uses the Right-Hand-Grasp-Rule: if your right hand grasps the vector (first three numbers) and its thumb points in the direction of the vector then its fingers point in the direction of a positive rotation. The center specifies the position about which the rotation occurs.
Rotation and translation can be used together. The object is rotated and then
translated
Lighting
By default a VRML world is provided with two forms of lighting: a
head-light for the viewer and a degree of reflected "ambient" light.
Other sources of light can be added easily but the shadows cast
by objects from these light sources are not automatic. VRML interpreters
treat each facet as it was all the same lighting so with special light
sources it may be necessary to divide up a flat surface into a series
of facets using an elevation grid or indexed face list. On the otherhand
VRML has define the specularColor and shininess fields for a Material that
describe like a mirror (speculum) a material is. Glowing objects
contain a light sources and given a larger ambientIntensity.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | on | SFBool | TRUE |
| exposedField | intensity | SFFloat | 1.0 |
| exposedField | ambientIntensity | SFFloat | 0.0 |
| exposedField | color | SFColor | 1.0 1.0 1.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | location | SFVec3 | 0.0 0.0 0.0 |
| exposedField | radius | SFFloat | 100.0 |
| exposedField | attenuation | SFVec3f | 1.0 0.0 0.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | direction | SFVec3 | 0.0 0.0 -1.0 |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | beamWidth | SFFloat | 1.570796 |
| exposedField | cutOffAngle | SFFloat | 0.785398 |
Backgrounds
It possible, by including a special Background node in a world to
describe a standard sky and ground plus a backdrop or panorama.
A new Background can be stacked on top the current one as part
of an animation.
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | skyColor | MFColor | [ 0.0 0.0 0.0 ] |
| exposedField | skyAngle | MFFloat | [ ] |
| exposedField | groundColor | MFColor | [ ] |
| exposedField | groundAngle | MFFloat | [ ] |
| exposedField | backUrl | MFString | [ ] |
| exposedField | frontUrl | MFString | [ ] |
| exposedField | rightUrl | MFString | [ ] |
| exposedField | leftUrl | MFString | [ ] |
| exposedField | topUrl | MFString | [ ] |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | color | SFColor | 1.0 1.0 1.0 |
| exposedField | visibillityRange | SFFLoat | 0.0 |
| exposedField | fogType | "LINEAR" | "EXPONENTIAL" | "LINEAR" |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| eventIn | set_bind | SFBool | |
| eventOut | bind_change | SFBool |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | source | sound_source | [ ] |
| exposedField | intensity | SFFloat | 1.0 |
| exposedField | direction | SFVec3 | 0.0 0.0 1.0 |
| exposedField | minFront | SFFloat | 1.0 |
| exposedField | maxFront | SFFloat | 10.0 |
| exposedField | minBack | SFFloat | 1.0 |
| exposedField | maxBack | SFFloat | 10.0 |
| exposedField | priority | SFFloat | 0.0 |
| field | spatialize | SFBool | TRUE |
Movies can also contain synchronized sounds and VRML permits
movies to supply textures to surfaces of objects... thus also
making them play various sounds. The teture has
to appear in two contexts: as a texture of an object
and as a source in a Sound. The "DEF" and "USE" syntax
handles this well. See MovieTexture.
Animation
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | enabled | SFBool | TRUE |
| eventOut | isActive | SFTIme |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | startTime | SFTime | 0.0 |
| exposedField | stopTime | SFTime | 0.0 |
| exposedField | cycleInterval | SFTime | 1.0 |
| exposedField | loop | SFBool | FALSE |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| eventOut | time | SFTime | |
| eventOut | cycleTime | SFTime | |
| eventOut | fraction_changed | SFTime |
| loop | Condition | Effect |
|---|---|---|
| TRUE | stopTime<=startTime Runs forever | |
| TRUE | startTime<stopTime | Run until stopTime |
| FALSE | stopTime<=startTime Run for one cycle at startTime+cycleInterval | |
| FALSE | strtTime<startTime+cycleInterval<=stopTime | Run for one cycle at startTime+cycleInterval |
| False | startTime<stopTime<startTime+cycleInterval | Run for less than one cycle then stop at stopTime. |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField center | SFVec3f | 0.0 0.0 0.0 | |
| exposedField size | SFVec3f | 0.0 0.0 0.0 | |
| eventOut | enterTime | SFTime | |
| eventOut | exitTime | SFTime | |
| eventOut | position_changed | SFVec3f | |
| eventOut | orientation_changed | SFSFRotation |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField collide | SFBool | TRUE | |
| field | proxy | SFNode | NULL |
| eventOut | collideTime | SFTime |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | autoOffset | SFBool | TRUE |
| exposedField | offset | SFVec3f | 0.0 0.0 0.0 |
| exposedField | maxPosition | SFVec3f | -1.0 -1.0 |
| exposedField | minPosition | SFVec3f | 0.0 0.0 |
| eventOut | trackPoint_changed | SFVec3f |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| eventOut | translation_changed | SFVec3f |
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| eventOut | rotation_changed | SFRotation |
Interpolators
Movement is smoothed by the use of Interpolators that have
lists of times and values. When they receive a number
(a float
eventIn called set_fraction that varies) between 0 and 1.
They output (via an eventout) a position, rotation, color
or some other field value. They have a table of keys and
a table of keyValues. If the input float is a key then the corresponding
keyValue is output. If the input value
is not in the table the work out a suitable intermediate
value. They can output positions, rotations, colors, scales, and
co-ordinates. The following describes an abstract and generic interpolator that
is not implemented in VRML but describes the shared properties of
all the different
interpolators that have been implemented:
| access:Access | fieldname:FieldId | type:Type | default:optional_Value |
|---|---|---|---|
| exposedField | key | MFFloat | [ ] |
| exposedField | keyValue | T | [ ] |
| eventIn | set_fraction | SFFloat | |
| eventOut | value_changed | T |
. . . . . . . . . ( end of section Animation) <<Contents | End>>
. . . . . . . . . ( end of section Predefined Nodes) <<Contents | End>>
Things left out
Scripts
It is possible to embed either Javascript or Java programs inside
a node in a VRML world. In theory other languages might be used as well
but none are standardized as yet. A Script node must have an url field.
Often however this will have a "javascript:" protocol and so
allow the script to be embedded in the node itself. The Script
can also declare a number of fields, eventIns, and eventOuts that
act as an interface between the VRML world and the variables
in the script. See the syntax Script. The interface also
described a new type of node along with its events and fields.
See also
Creating new types of Node
The PROTO and EXTERNPROTO nodes define whole new classes
of node -- complete with public and private parts. The verb "IS"
is used to connect fields and interface items.
Details.... later.
Avatars
The NavigationInfo Node permits the world designer to describe
how the viewer appears to other viewers in the same world.
Navigation
It is possible to restrict how the viewer can move using a
NavigationInfo Node.
. . . . . . . . . ( end of section The Viewer) <<Contents | End>>
Semantics
Each node describes an object in a class of objects. In terms of the
MATHS model the objects described by a node with fields F belong to
a set of structured objects $ N with fields based on F, where
The default object is similar but is a set of objects $ I with only has the fields and exposed fields of the node defined:
The actual object at any time has values taken from the default object, overridden and extended by the values supplie in the node declaration, and updated by the last values to arrive as eventIns.
. . . . . . . . . ( end of section Things left out) <<Contents | End>>
Abstractions
A number of names for classes of nodes have been created
to simplify this description and make it a little more
meaningful. Terms such as parental, group, sensor, and so on
are not part of the VRML syntax but used to explain the VRML. I've
tagged the definitions of these terms:
. . . . . . . . . ( end of section The Virtual Reality Modeling Language) <<Contents | End>>