VRML 1.0
In addition to the official VRML 1.0 specification there exists also a
VRML 1.0 specification with clarifications and a
VRML 1.0 specification with examples.
scene graph
A VRML-scene consists of a hierarchy (scene graph) of nodes. Each node defines
a primitive shape, a property of appearance,
a transformation, a lightsource, a camera,
a WWW-link, a information or a group of other nodes.
state and local coordinate systems
Nodes change the state of the scene graph in the order they appear. Therefore a
node affects the properties of the nodes that appear after it. For example a node
whitch defines the current material to be red causes the following shapes to be
drawn red. The change of state can be limited to affect only a part of the scene
graph by using a separator node.
The current local coordinate system is also part of the state. A series of
transformations
- T1
- ...
- Tn
produces a local coordinate system where a point pl is transformed into world
coordinates pw with the formula
- pw=pl*Tn*...*T1
3spheres is an example with a material and two sequential transformations per
sphere.
syntax of a node
A node of a predefined type is represented in the form
type { fields children }
where the fields and children are optional.
A Field is a specific parameter of that node, written in the form
fieldname value
Children are other nodes contained in that node. Only grouping nodes may have
children.
selfdefined nodetypes
The syntax for a new type of node is
DEF newtype type { fields children }
This also creates one node of this new type.
Every other instance of this nodetype is created with
USE newtype
To avoid that the instance created with the DEF is drawn you can use a
switch, allowing you to use DEF/USE like functions without parameters.
switch{
DEF ...}
extensions
Extensions to VRML are supported by supporting
self-describing nodes. This
enables all VRML-implementations to parse (and to ignore) these extensions. A
extended node-type is written in the form
extendtype { fields[ fieldtype fieldname, ... ] fieldname fieldvalue ... }
If a extended node-type is a superset of an existing one it can be defined using
isA
extendtype { fields[ MFString isA, ...] isA["existtype"] ... }
This allows the existing type to be used instead of the extended one. A extended
node-type can contain multiple isA-relations.
shape-nodes
AsciiText
Cone
Cube
Cylinder
Sphere
- These nodes represent primitive objects. Their parameters control specific
properties like size or which parts are visible.
IndexedFaceSet
IndexedLineSet
PointSet
- These nodes define a set of points, lines or faces by means of a list of points.
Therefore they must be used together with a preceding Coordinate3 (look at
Sierpinsky-Tetrahedron).
property of appearance-nodes
Coordinate3
- Defines a list of points in 3D-space. They are not visible unless used by a
following IndexedFaceSet, IndexedLineSet or PointSet.
FontStyle
- Sets the current font style for all following AsciiText-nodes.
Material
MaterialBinding
- They define the materials for all following shape-nodes.
The different parts of a shape can consist of different materials.
A material includes:
- ambient color
- diffuse color reflected from light sources
- specular color and shininess for reflection-highlights
(take a look at 3spheres)
- emissive color for self-radiating objects (lightsources)
- transparency (take a look at demo)
Theoretical VRML supports radiosity, but not all parameters
must be used by a VRML-browser and thats why it is theoretical.
Normal
NormalBinding
- Defines a list of surface-normals and how they are bound to shapes. They are not
visible unless used by a following IndexedFaceSet, IndexedLineSet or PointSet.
Texture2
Texture2Transform
TextureCoordinate2
- Shapes can be textured with a texture-map defined pixel per pixel in the VRML-file
or as a picture (JPEG, GIF, PNG) read from an URL. A texture can be gray-scale (multiplied with
material´s diffuse color) or color (replaces diffuse color) and with or without
transparency. Lighting of textures depends on the implementation of the specific
VRML-browser. The mapping of the texture on to the shape can be transformed.
(look at demo). For an extended guide look at
texture mapping in VRML 1.0.
ShapeHints
- Tells the VRML-browser if the following shapes are solid, convex or contain
ordered vertices. This information can be used for rendering-optimizations.
transformation-nodes
MatrixTransform
Transform
Rotation
Scale
Translation
- These nodes transform the local coordinate system. Therefore they are used to
set the position, rotation and distortion of all following shapes, lights and cameras
(look at demo, 3spheres and
Sierpinsky-Tetrahedron).
grouping nodes
These nodes contain other nodes which makes the hierarchy of the scene graph
possible.
Separator
- Pushes the current state before traversing its children an pops it afterwards so
that its children are isolated from the rest of the scene graph. In future versions of
VRML all grouping nodes will behave this way to avoid side-effects.
Switch
- Traverses a specific child or none, depending on the value of its whichChild-field.
Can be used to DEFine nodetypes without displaying a corresponding node.
LOD (level of detail)
Selects one of its children depending on the distance (in local object-
coordinates) to the eye-point. This allows different complex representations of an
object depending how near the camera is.
Theoretical it allows recursive definitions of objects like L-systems (look at
recursive Sierpinsky-Tetrahedron), but practical it results in a
stack-overflow on some VRML-browsers (then you should better look at
Sierpinsky-Tetrahedron with four levels of detail).
WWWAnchor
- Defines its children to be a link to a corresponding WWW-document (URL).
Usualy it is choosen by clicking on one of its children. It also consists of an
information-string which can be displayed. If WWWAnchors are nested then the
most deeply one is choosen.
WWWInline
- Reads its children from an URL. The corresponding document should be a
VRML-document otherwise results are undefined.
camera-nodes
OrthographicCamera
PerspectiveCamera
- Defines the current camera. Only one camera should be traversed. Multiple
cameras should be selected in a switch-node.
light-nodes
DirectionalLight
- It shines from every position into the specified direction.
PointLight
- It shines from a specified point into every direction.
SpotLight
- It illuminates in a specified cone from a specified point.
other nodes
Info
- This node contains an information-string which is not displayed (for example:
copyright).
don´t use this
These features will be removed in future versions of VRML, therefore they should
not be used anymore
Group
- This is the basic grouping node which doesn´t push/pop the state. In future
all grouping nodes will have to behave like Separator-nodes.
TransformSeparator
- This grouping node pushes/pops only the transformation but not the rest of
the state.
material cycling
- little practical value
general syntax
VRML is case-sensitive.
VRML-files have the extension .wrl (for world).
Their MIME-type is x-world/x-vrml.
Every VRML 1.0-file must begin with this line:
#VRML V1.0 ascii
A comment begins with a ´#´ (except for being a character in a string) and ends at
the end of line. Comments and whitespaces may not be preserved. A VRML-document server may
strip comments and extraneous whitespace from a VRML file before transmitting it.
Blanks, tabs, newlines and carriage returns outside of string fields are whitespace
characters.
Node names must not begin with a digit, and must not contain spaces or control
characters, single or double quote characters, backslashes, curly braces, ´#´, ´+´ or
´.´.
Field names start with lower case letters, Node types start with upper case. The
remainder of the characters must not be curly braces, square brackets, single or
double quotes, ´#´, backslash, ´+´, ´.´ or ´&´.
back to Index
Heinrich Hey 1996