Editor: Peiya Liu
The Virtual Reality Modeling
Language Explained
FRML. (pronounced “vermal’) stands for Vir
‘ual Reality Modeling Language. Technically,
VEML is neither virtual reality nor a modeling
language. Virtual reality generally implies an
immersive 3D experience, which typically requires
a head-mounted display (HMD) and 3D input
devices, such as digital gloves. VRML neither
requires nor imposes immersion. Furthermore, a
true modeling language would contain richer geo-
metric modeling primitives and mechanisms.
VEML provides a bare minimum of geometric
modeling features but contains numerous features
unavailable in a modeling language.
If VRML is not virtual reality ora modeling lan
guage, what is 17 This question has several
answers. At its core, VRML serves as a 3D inter:
change format. It defines most of the commonly
used semantics found in today’s 3D applications
such as hierarchical transformations, light
sources, viewpoints, geometry, animation, fog,
‘material properties, and texture mapping. One of
the primary goals in designing VRML was to
censure that it at least succeed as an effective 3D
file interchange format,
Here's a second answer to “What is VRML?"
it's a 3D analog to HTML This means that VEML.
serves as a simple, multiplatform language for
publishing 3D Web pages. The fact that some
information, including games, engineering mod-
els, scientific visualizations, educational expert-
ences, and architecture, can best be experienced
in 3D has motivated this language. Typically.
these types of projects require intensive interac
tion, animation, and user participation and explo-
ration beyond what a page, text, or Image-based.
format can handle,
‘Another answer is that VRML provides the
technology to integrate 3D, 2D, text, and multi
‘media into a coherent model. When these media
types combine with scripting languages and Inter~
net capabilities, an entirely new gene of interac:
ve applications becomes possible, A 3D
metaphor presents a natural user experience that
supports classic 2D desktop models and extends
them into broader contexts of space and place.
Many have speculated that a 3D world model will
prevail and thus replace the popular 2D desktop
‘model as the primary user interface paradigm in
the next decade, However, 3D user interface
design, user education, and ubiquitous 3D graph
ics performance present significant unsolved
problems that must be overcome before a 3D
desktop has a chanee.
A fourth answer, the one most publicized and
debated, claims that VRML forms the foundation
for cyberspace and online virtual communities
popularized by science fiction writers William
Gibson in (Ace Books, New York,
1984) and Neal Stephenson in. Gan-
tom Books, New York, 1992). Critics have acci
rately pointed out that VRML does not yet define
the networking and database protocols necessary
for true multiuser simulations. However, the strat-
egy behind VRML has been
Evolve the standard one step at a time,
1 Keep it simple.
1 Standardize only on problems that are com-
pletely understood and reasonably solved,
1 Encourage experimentation and extensions.
1 Don'treinvent technologies that can be solved
outside of VRML (for example, hypertext
transfer protocol, or http).
Several working multiuser systems have been
implemented on top of VRML, proof that the
incremental approach works.
The answer to "What is VRML7" is actually “Allof the above.” Most likely the answer will never
simply be one-sided, However, afew misconcep-
tions or “wrong” answers exist, For example,
\VRML is not a programming library for applica-
tion developers. Since VRML builds on the Open.
Inventor file format, many people assume that it
also provides the rch programming interfaces and
tools included in the Open Inventor toolkit. In
actuality, VRML is an extended subset of Open.
Inventor's file format and does not define an
application programmer interface (APD. The fact
‘that VRML includes scripting language integration
tends to promote this misconception—scripting
language capabilities are mainly intended for
authors who need more power or integration,
Overview
Here I'll give a brief overview, describing the
‘major architectural aspects of VRML. See the VRML.
standard (http://www-vrml.org/Specifications/
‘VRML97) or
(Addison-Wesley Developers Press, Reading,
Massachusetts, 1997, http:/Anww.wasabisoft.com:
Book) for more detail.
‘Scene graph
VRML files describe 3D objects and worlds
using a hierarchical Entities in the
scene graph are called. VRML defines 54 dif
{ferent node types. including geometry primitives,
appearance properties, multimedia objects, ani
‘mation interpolators, interaction sensors, and var-
{ous types of grouping nodes. Nodes store their
datain_. VRML defines 20 different types of
fields that can store everything from a single num-
ber (the "SFloat” field type, where “SF” stands for
single-valued field) (o an array of 3D rotations (the
‘MFRotation” field type, where “MF” stands for
‘multiple-valued field).
‘The VRML scene graph is a
Nodes can contain other nodes (some types
of nodes may have “children”) and may be con-
tained by more than one node (they may have
‘more than one “parent"). However, a node must
not contain itself, This scene graph structure
‘makes it easy to create large worlds or complicat-
ed objects from subparts,
Figure 1 illustrates a very slmple scene graph of
‘one node (see Figure 2 fora screen shot of Figure 1
ina VRML browser).
‘The first line in all VRML files is the header,
#VRML V2.0 utf8. The second statement in this
example defines the root node, Shape, which.
specifies two elds: and The
geometry field defines
(or references) one of
the nine geometry shape (
nodes in the VRML
speeifieation—in this
case, a Sphere. The
appearance field always
defines (or references) >
an Appearance node; >
this was designed in >
cease we add new types
of appearance nodes
later. The appearance node specifies several
appearance properties that can be applied to the
geometry node; in this case, a simple red materi
al, Note that in VRML parlance, Sphere, Appear
ance, and Material aren't considered Shape's
children, but they're contained by Shape.
Grouping
VRML features eight grouping nodes. These
nodes define a local coordinate system for their
children nodes. They create hierarchical seenes
and support specialized grouping behaviors.
Anchor defines its descendants as a hyperlink to a
uniform resource locator (URL). Billboard auto-
‘matically rotates its descendants to face the viewer.
Collision specifies collision-detection properties
for its decedents, Group, a generic grouping node,
simply clusters other nodes into a coordinate sys-
tem, Inline specifies its children through a URL,
enabling distributed, hierarchical file structures
ava. v2.0 utea
geometry Sphere { radius 3.0 )
rance Appearance (
cerial Material (
B661 soquiordos-Kinr
EyWvRML v2.0 utes
Group (
children [
‘Transform (
translation 4.00 4
# tet chile
trang +4 in x
children shape ¢
geonetry sphere ( radius 3.0 )
appearance Appearance (
material Material (
aiffusecoler 10 0 rea
yy
‘transform ( # 2nd chia
rotation .707 .707 0.785 # rotate
translation -3 00 # trang -3 in x
children shape (
geonetry Box ( size 535)
appearance Appt
ance (
material Material <
diffusecoler 0 0 1 ‘
>»
blue
1 # end children
) # end Group
LOD defines multiple versions of an object for
automatic level-of-detail switching by the brows:
cr. This reduces the complexity of distant objects.
Switch selects one of its children as “active.” Trans
form, probably the most commonly used group.
{ng node, specifies transformations to apply to the
Group
ae
Transform Transform
Shape Shape
children (such as rotate, translate, and scale)
Figure 3 illustrates a simple use of grouping
nodes to create a hierarchical scene, The root node,
Group, contains two children, both Transform
nodes. The first child defines a red sphere (from the
first example). The second child defines a blue box.
‘The red sphere's Transform node parent translates
it units in the direction, The blue box rotates
about an axis (0.707, 0.707. 0) by 0.785 radians and
twanslates ~3 units in the direction, See Figure 4
for the results of reading Figure 3 into a VRML
browser and Figure 5 for a diagram of Figure 3's
scone graph. Again, note that the geometry and.
property nodes technically do not lie in the scene
graph, but are contained inside the Shape nodes.
Geometry
Geometry nodes create the visual presentation
in VRML. VRML features 10 types of geometry
nodes: Box, Cone, Cylinder, ElevationGrid, Extru:
sion, IndexedFaceSet, IndexedLineSet, PointSe,
Sphere, and Text.
Event processing
\VRML 97 defines an event or message-passing
mechanism by which nodes in the scene graph
can communicate with each other. Each node
{ype defines the names and types of events that it
generates or receives, ROUTE statements define
event paths between event generators and
receivers. Routing creates reactive behaviors by
"using sensor nodes or scripts to initiate changes in
the scene graph. Figure 6 illustrates a simple
example of event routing. Here TimeSensor
(clock) animates the color of the red sphere from
Figure 1 and routes it to Colorlnterpolator and
then to the diffuseColor field, Notice the use of
the Dz node-naming syntax (“DEF TS TimeSen-
sor (..°) that defines node names and is subse
quently used by the ROUTE syntax to wire events,
Sensors
Nine sensor nodes provide the built-in user
Interaction primitives for VRML. Sensor nodes
combine with other nodes via ROUZE stalements tovem v2.0 utes
Shape (
geonetry Sphere ( radius 3)
appearance Appearance (
material DEF M Material
( 4iffusecoler 100)
y
>
DEP CI Colorinterpolater (
key [0.2.4.6 81] # keyframe timing
keyvalue (100, 010,001,110,
101, 1003 # colors
>
DEP TS TimeSensor <
Loop TRUE
eyclernterval 5
>
ROUTE 7S. fraction_changed
70 CI.set_fraction
ROUTE CI.value_changed
70 M.set_diffusecolor
415 second loop cycle
visibly affect a scene. Sensors have two categories:
environmental and pointing devices, The four
environmental sensors—Collision, ProximitySen-
sor, TimeSensor, and VisibilitySensor—detect
changes in the world. Collision sets the coliston-
detection state and detects collision events between,
‘the user's avatar and geometry in the scene. Prox
imitySensor detects when the user's avatar navi-
gates in and out of a user-defined region and tracks
user's position while in the region. VisibilitySen-
sor detects the rendering visibility status of specific
geometry in a scene, TimeSensor generates events
as time passes and serves as the basis for all ani-
mated behaviors. See Figure 6 for a simple use of
TimeSensor. Figure 7 illustrates a simple use of
ProximitySensor. In this example, ProximitySensor
detects when the user approaches the box and
issues a sound alert, Notice that Collision was need-
fed to disable collision detection on the “force
eld.” Figure 8 shows a screen shot of Figure 7
‘There are five pointing device sensors: Anchor,
CylinderSensor, PlaneSensor, SphereSensor, and
TouchSensor. These device sensors detect and
react to user manipulation of a pointing device
activated over any geometry that descended from.
the pointing-device sensor's parent node. Typi-
cally, the sensor implements user interface wid-
gets on sibling objects. Clicking on geometry
HvaML v2.0 utes
DEF PS ProximitySensor ( size 20 10 20 )
collision ¢
collide FALSE # need to turn collisions
off for the box
children shape (
jonetry Box ( size 20 10 20 )
appearance Appearance (
material Material (
transparency 0.75
4 semi-transparent force field
aigeusecolor 110
»»
Shape (
geonetry Sphere ( radius 2 )
appearance Appearance (
material Material ( diffusecolor 10 1 )
»
Sound (
source DEF ALARM AudiClip
(url “alarn.wav" )
spatialize FALSE
minPront 20 minBack 20
maxPront 20 maxBack 20
>
Viewpoint ( position 00 30)
ROUTE PS.enterTime 70 ALARM. a
ROUTE PS.exitTime TO ALARM
£222 5,8
Brom Sine sets
37IEEE MultiMedia
WvRM v2.0 utes
Group ( chiléren
DEF TOS TouchSensor ( ) # Uses sphere below to
activate
SW Switch (
whichchoice 0
choice [
Shape (
# button off
geometry DEF SPH Sphere ( )
‘appearance Appearance (
material
»
Shape (
Material ( diffusecolor .3 .2 0)
# button on
geometry USE SPH
appearance App.
naterial
rrance (
Material
( Aiffusecolor .3 10)
»
moggle script (
eventin SPPine touch
eventout S¥int32 which_changed
url "Javascript:
function initialize( } ( which changed
o>
function touch(value, time) (
which changed = which changed; // Toggle
‘button value
Pa
>
1)
ROUTE TOS.touchTime TO Toggie.touch
# Fire the script on click
ROUTE Toggle.which changed TO SW.
jet_whichChoice
# Toggles the button
influenced by Anchor (inherited from VRML. 1.0)
causes the browser to load a new URL or view in.
the existing URL. CylinderSensor, PlaneSensor,
and SphereSensor define invisible geometry, rep-
resenting a movable widget’s shape and con-
strained behavior. CylinderSensor can be used to
create dials, PlaneSensors to create 1D or 2D slid
ers or constraints, and SphereSensors to create
trackballs. TouchSensor, a generic pointing-dlevice
sensor that detects pointing-device motion and
activation over geometry, can be used for many
applications.
Scripting
Scripts let the world creator define arbitrary
behaviors. Script nodes can be inserted between,
ent generators (typically sensor nodes) and
event receivers, The VRML 97 specification defines
Script node bindings for the Java and ECMAScript
{also known as JavaScript programming lan
‘guages). Figure 9 illustrates a simple case of using
Script to ereate a toggle button. See the section on
Prototypes for how to package this button into a
reusable object.
Animation interpolators
Interpolator nodes—bullt-in Scripts that per
form simple anim?
‘with a TimeSensor and some node in the scene
_graph to make objects move or change. There are
six lypes of interpolator nodes: Colorinterpola
tor, Coordinatelnterpolator, Normallnterpolator,
OrientationInterpolator, PositionInterpolator,
and ScalarInterpolator. See Figure 6 for a simple
case of using Colorinterpolator to animate an
object's color.
jon caleulations—combine
Prototypes: encapsulation and reuse
\VRML 97 includes a prototyping mechanism
for encapsulating and reusing a scene graph (the
PROTO statement). Geometry, properties, and ani.
mations or behaviors can be encapsulated, either
separately or together. Prototyping permits defin.
ing a new node type in terms of a combination of
existing node types, This makes VRML easier to
‘use and reduces the size of VRML files. Figure 10
creates a prototype toggle button out of Figure 8
and uses it to create a simple combination lock
composed of two buttons.
Distributed scenes
\VRML 97 includes two primitives that let asin
{gle VRML world definition span the World Wide
Web. The Inline node allows the inclusion of
another VRML file stored anywhere on the Web.
‘The EXTERNPROTO statement permits fetching
new PROTO definitions (that is, new node types)
from anywhere on the Web. More generally,
EXTERNPROTO lets nodes be defined external to
the VRML file. In addition, it serves as the basic
extensibility mechanism for VRML
Figure 11 illustrates how to create an external
prototype that refers to the prototype defined in
Figure 10, The exreRwpRoTO0 statement simply
refers to the fictional URL http://www.foo.com/
Button.wrl, which contains the PROTO statement
in Figure 10
Relationships to major standards
VEML fits into the existing infrastructure of
the Internet and Web, It uses existing standards‘WVRME V2.0 utes
PROTO Button [
field sFNode geon Sphere { )
‘eventout SFint32 state_changed
‘
# This defines the PROTO, but does not
instance anything
Group { children [
DEF 70S Touchsensor ( )
DEF SW Switeh (
whichchoice 0
choice [
Shape ( # off
geometry IS geon
# appearance
>
Shape ( # on.
geonetry IS geon
# This script creat
4 Buttoni-0FF & Button’
DEF TwoButtons Script (
field seint32 bi 0
field sPrnt32 b2
feventIn sFint32
eventin sFint32
feventout SPrine startTine
url “Javascript:
function set_bi(value, tine) (
bi = value;
LE ((bL == 0) && (b2 == 1))
startTime = tine;
>
function set_b2(value, time) (
ba = value;
Af (bi == 0) ke (b2 =
startTime = time;
a simple combo ieck.
<0N triggers the lock.
»
# appearance ...sane as in Figure 9 >
»
DEF Toggle Script ¢
# ..-same as in Figure 9...
>
Dd
ROUTE TOS.touchTime TO Toggle.touch
ROUTE Toggle.which changed TO SW. set
waiehchoice
>
# tow create two Buttons
Transform {
translation -2 00
children DEF Bi Button ( geom Box () } RouzE
>
‘Transform (
translation 20 0
>
DEF 7 Transform ( children [
Shape ( geonetry Sphere ( radius 0.01) }
# Initially tiny
DEP SI Positioninterpolater (
# Explosion effect
Key [ 0.0 0.999 1.0]
KeyValue [ 0.01 0.01 0.01, 1000.0 1000.0
1000.0 0.01 0.01 0.01}
>
DEF TS Timesensor ( )
»
ROUTE
ROUTE TwoButtons.startTime TO 7S. startTine
ROUTE TS. fraction_changed TO ST.set_fraction
ROUTE SI.value_changed 10 7.scale
children DRP B2 Button ( geom Cone ¢ ) }
>
wherever possible, even if those standards have
some shortcomings when used with VRML. Using.
existing standards instead of inventing new,
incompatible standards makes it much easier for
Web developers to use their existing tools to cre-
ate VRML content, It also makes it easier for
somebody implementing the VRML standard,
since libraries of code for popular standards
already exist
‘VRML files may contain references to files in
many other standard formats. JPEG, PNG, GIF,
and MPEG files may be used as texture maps on.
‘objects. WAV and MIDI files may specify sound in.
vaML v2.0 utes
EXTERNPROTO Button [
Sela sPiode geon
‘eventout sPInt32 state_changed }
*nttp: //www. foo. com/Button. wri”
Button ( geom Box ( ) } # Instances a Button
the world. Files containing Java or ECMAScript
(formerly JavaScript) code may be referenced and
used to implement programmed behavior for
VRML objects. Each of these indepeiSecu a
IEEE MultiMedia
ii
dards were chosen to integrate with VRML
because ofits widespread use on the Internet. The
‘VRML 7 specification describes how they're used
with VRML—it does not attempt to define these
other standards or describe how to create files in
these other file formats
‘The definition of how VRML should be used
with other standards is generally done by the orga-
nizations that define those standards, For example,
‘the World Wide Web Consortium (WSC) is stan-
ddardizing an