This is a heavily edited version of the original Version 1.0 Specification of VRML by
The FULL version of that document is located at http://www.web3d.org/VRML1.0/vrml10c.html
The Virtual Reality Modeling Language (VRML) is a language for describing virtual worlds, networked via the Internet and with W3.
VRML can be used to specify the
VRML is intended for use across the Web and hence leverages existing infrastructures and protocols. The history of the development of VRML has three distinct stages,
During the early development of VRML the search for existing technologies produced several candidates of which the Open Inventor ASCII File Format from Silicon Graphics, Inc. was selected as the primary model. The Inventor File Format supports
By adding extensions to support networking, it became the basis of VRML.
VRML 1.0 is designed to meet the following requirements:
The language specification is divided into the following sections:
VRML defines a set of objects (called nodes) which useful for doing 3D graphics. Nodes are arranged in hierarchical structures called scene graphs which are a collection and ordering of nodes.
The scene graph has a state and nodes earlier in the world can affect nodes that appear later in the world. Applications that interpret VRML files need not maintain the scene graph structure internally; the scene graph is merely a convenient way of describing objects.
A node has the following characteristics:
For example, this file contains a simple world defining a view of a red cone and a blue sphere, lit by a directional light:
#VRML V1.0 ascii
Separator {
DirectionalLight {
direction 0 0 -1 # Light shining from viewer into world
}
PerspectiveCamera {
position -8.6 2.1 5.6
orientation -0.1352 -0.9831 -0.1233 1.1417
focalDistance 10.84
}
Separator { # The red sphere
Material {
diffuseColor 1 0 0 # Red
}
Translation { translation 3 0 1 }
Sphere { radius 2.3 }
}
Separator { # The blue cube
Material {
diffuseColor 0 0 1 # Blue
}
Transform {
translation -2.4 .2 1
rotation 0 1 1 .9
}
Cube {}
}
}
Every VRML file must begin with the characters:
#VRML V1.0 ascii or #Inventor V1.0 ascii for ivview
The '#' character begins a comment token until the next newline, unless it is within a double-quoted string field.
VRML is case-sensitive; 'Sphere' is different from 'sphere'.
The VRML coordinate system is
By default, the scene is achieved by projecting the objects in the direction of the positive Z axis, with the positive X axis to the right and the positive Y axis up.
VRML worlds may contain an arbitrary number of local (or "object-space") coordinate systems, defined by modeling transformations using Translate, Rotate, Scale, Transform, and MatrixTransform nodes.
VRML has a "world" and "Camera" coordinate systems. The scene is viewed through a camera, introducing another conceptual coordinate system. Nothing in VRML is specified using camera coordinates.
Fields may contain a single value (single number, single vector, or even an image), or fields contain multiple comma separated values enclosed in square [] brackets.
SFBool a single boolean value, 0, 1, TRUE, or FALSE.
SFColor/MFColor containing one or zero or
more RGB
colors.
SFEnum contains an enumerated type value.
SFFloat/MFFloat contain one or zero or more
single-precision floating point numbers.
SFImagecontains an uncompressed
2-dimensional color
or grey-scale image.
SFLong/MFLong containing one or zero or
more 32-bit
integers.
SFMatrix containing a matrix written
row-major order
as 16 floating point numbers separated by whitespace.
SFRotation containing an arbitrary
rotation.
SFString/MFString containing one or zero or
more
ASCII string.
SFVec2f/MFVec2f containing a
two-dimensional vector.
SFVec3f/MFVec3f containing a
three-dimensional
vector.
There are (broadly) three (3) categories of VRML nodes,
AsciiText, Cone, Cube, Cylinder, IndexedFaceSet, IndexedLineSet, PointSet, Sphere
Coordinate3, FontStyle, Info, Material, MaterialBinding Normal, NormalBinding, Texture2, Texture2Transform, TextureCoordinate2, ShapeHints
MatrixTransform, Rotation, Scale, Transform, Translation
Separator, Switch, WWWAnchor, LOD
The following nodes do not fit neatly into any category.
OrthographicCamera, PerspectiveCamera
DirectionalLight, PointLight, SpotLight
WWWInline
This node represents strings of text characters from the ASCII coded character set. The first string is rendered with its baseline at (0,0,0).
JUSTIFICATION LEFT Align left edge of text to origin CENTER Align center of text to origin RIGHT Align right edge of text to origin FILE FORMAT/DEFAULTS AsciiText { string "" # MFString spacing 1 # SFFloat justification LEFT # SFEnum width 0 # MFFloat }
This node represents a simple cone whose central axis is aligned with the y-axis. By default, the cone is centered at (0,0,0) and has a size of -1 to +1 in all three directions.
PARTS SIDES The conical part BOTTOM The bottom circular face ALL All parts FILE FORMAT/DEFAULTS Cone { parts ALL # SFBitMask bottomRadius 1 # SFFloat height 2 # SFFloat }
This node defines a set of 3D coordinates to be used by a subsequent IndexedFaceSet, IndexedLineSet, or PointSet node. This node does not produce a visible result during rendering.
FILE FORMAT/DEFAULTS Coordinate3 { point 0 0 0 # MFVec3f }
This node represents a cuboid aligned with the coordinate axes. By default, the cube is centered at (0,0,0) and measures 2 units in each dimension, from -1 to +1.
FILE FORMAT/DEFAULTS Cube { width 2 # SFFloat height 2 # SFFloat depth 2 # SFFloat }
This node represents a simple capped cylinder centered around the y-axis. By default, the cylinder is centered at (0,0,0) and has a default size of -1 to +1 in all three dimensions.
PARTS SIDES The cylindrical part TOP The top circular face BOTTOM The bottom circular face ALL All parts FILE FORMAT/DEFAULTS Cylinder { parts ALL # SFBitMask radius 1 # SFFloat height 2 # SFFloat }
This node represents a 3D shape formed by constructing faces (polygons) from vertices located at the current coordinates. IndexedFaceSet uses the indices in its coordIndex to define polygonal faces. An index of -1 separates faces (so a -1 at the end of the list is optional).
FILE FORMAT/DEFAULTS IndexedFaceSet { coordIndex 0 # MFLong materialIndex -1 # MFLong normalIndex -1 # MFLong textureCoordIndex -1 # MFLong }
This node defines the current surface material properties for all subsequent shapes. To bind materials to shapes, use a MaterialBinding node.
The fields in the Material node determine the way light reflects off of an object to create color:
Material {
ambientColor [] diffuseColor [] specularColor []
emissiveColor [ 0.1 0.1 0.2, 0.5 0.8 0.8 ]
}
FILE FORMAT/DEFAULTS
Material {
ambientColor 0.2 0.2 0.2 # MFColor
diffuseColor 0.8 0.8 0.8 # MFColor
specularColor 0 0 0 # MFColor
emissiveColor 0 0 0 # MFColor
shininess 0.2 # MFFloat
transparency 0 # MFFloat
}
Material nodes may contain more than one material. This node specifies how the current materials are bound to shapes that follow in the scene graph.
BINDINGS DEFAULT Use default binding OVERALL Whole object has same material PER_PART One material for each part of object PER_PART_INDEXED One material for each part, indexed PER_FACE One material for each face of object PER_FACE_INDEXED One material for each face, indexed PER_VERTEX One material for each vertex of object PER_VERTEX_INDEXED One material for each vertex, indexed FILE FORMAT/DEFAULTS MaterialBinding { value OVERALL # SFEnum }
This node defines a geometric 3D transformation with a 4 by 4 matrix. Only matrices that are the result of rotations, translations, and non-zero (but possibly non-uniform) scales must be supported. Non-invertible matrices should be avoided.
Matrices are specified in row-major order, so, for example, a MatrixTransform representing a translation of 6.2 units along the local Z axis would be specified as:
MatrixTransform { matrix
1 0 0 0
0 1 0 0
0 0 1 0
0 0 6.2 1
}
FILE FORMAT/DEFAULTS
MatrixTransform {
matrix 1 0 0 0 # SFMatrix
0 1 0 0
0 0 1 0
0 0 0 1
}
This node defines a set of 3D surface normal vectors to be used by vertex-based shape nodes (IndexedFaceSet, IndexedLineSet, PointSet) that follow it in the scene graph.
FILE FORMAT/DEFAULTS Normal { vector [ ] # MFVec3f }
This group node performs a push (save) of the traversal state before traversing its children and a pop (restore) after traversing them. This isolates the separator's children from the rest of the scene graph. A separator can include lights, cameras, coordinates, normals, bindings, and all other properties.
CULLING ENUMS ON Always try to cull to the view volume OFF Never try to cull to the view volume AUTO Implementation-defined culling behavior FILE FORMAT/DEFAULTS Separator { renderCulling AUTO # SFEnum }
This node represents a sphere. By default, the sphere is centered at the origin and has a radius of 1.
FILE FORMAT/DEFAULTS Sphere {
radius 1 # SFFloat
}
This is a longer example of a VRML world. It contains a simple model of a track-light consisting of primitive shapes, plus three walls (built out of polygons) and a reference to a shape defined elsewhere, both of which are illuminated by a spotlight. The shape acts as a hyper-link to some HTML text.
#VRML V1.0 ascii
Separator {
Separator { # Simple track-light geometry:
Translation { translation 0 4 0 }
Separator {
Material { emissiveColor 0.1 0.3 0.3 }
Cube {
width 0.1
height 0.1
depth 4
}
}
Rotation { rotation 0 1 0 1.57079 }
Separator {
Material { emissiveColor 0.3 0.1 0.3 }
Cylinder {
radius 0.1
height .2
}
}
Rotation { rotation -1 0 0 1.57079 }
Separator {
Material { emissiveColor 0.3 0.3 0.1 }
Rotation { rotation 1 0 0 1.57079 }
Translation { translation 0 -.2 0 }
Cone {
height .4
bottomRadius .2
}
Translation { translation 0 .4 0 }
Cylinder {
radius 0.02
height .4
}
}
}
SpotLight { # Light from above
location 0 4 0
direction 0 -1 0
intensity 0.9
cutOffAngle 0.7
}
Separator { # Wall geometry; just three flat polygons
Coordinate3 {
point [
-2 0 -2, -2 0 2, 2 0 2, 2 0 -2,
-2 4 -2, -2 4 2, 2 4 2, 2 4 -2]
}
IndexedFaceSet {
coordIndex [ 0, 1, 2, 3, -1,
0, 4, 5, 1, -1,
0, 3, 7, 4, -1
]
}
}
WWWAnchor { # A hyper-linked cow:
name "http://www.foo.edu/CowProject/AboutCows.html"
Separator {
Translation { translation 0 1 0 }
WWWInline { # Reference another object
name "http://www.foo.edu/3DObjects/cow.wrl"
}
}
}
}
The MIME type for VRML files is defined as follows:
x-world/x-vrml
The MIME major type for 3D world descriptions is x-world. The MIME minor type for VRML documents is x-vrml. Other 3D world descriptions, such as oogl for The Geometry Center's Object-Oriented Geometry Language, or iv, for SGI's Open Inventor ASCII format, can be supported by using different MIME minor types.