A VRML file consists of the following major functional components:
the header, the scene graph, the prototypes, and event routing. The
contents of this file are processed for presentation and interaction
by a mechanism known as a browser.
For easy identification of VRML files, every VRML file shall begin
with:
#VRML V2.0 <encoding type> [comment] <line terminator>
The header is a single line of UTF-8 text identifying the file as
a VRML file and identifying the encoding type of the file. It may also
contain additional semantic information. There shall be exactly one
space separating "#VRML" from "V2.0",
"V2.0" from "<encoding type>",
and "<encoding type>" from "[optional
comment]".
The <encoding type> is either "utf8"
or any other authorized values defined in other parts of ISO/IEC 14772.
The identifier "utf8" indicates a clear text encoding that allows
for international characters to be displayed in VRML using the UTF-8
encoding defined in ISO 10646-1 (otherwise known as Unicode); see [UTF8]. The usage of UTF-8 is detailed under the specification
of the Text node. The header for a UTF-8
encoded VRML file is
#VRML V2.0 utf8 [optional comment] <line terminator>
Any characters after the <encoding type> on the first
line may be ignored by a browser. The header line ends at the occurrence
of a <line terminator>
. A <line terminator>
is a linefeed character (0x0A) or a carriage return character (0x0D)
.
The scene graph contains nodes which describe objects and their properties.
It contains hierarchically grouped geometry to provide an audio-visual
representation of objects, as well as nodes that participate in the
event generation and routing mechanism.
Prototypes allow the set of VRML node types to be extended by the
user. Prototype definitions can be included in the file in which they
are used or defined externally. Prototypes may be defined in terms of
other VRML nodes or may be defined using a browser-specific extension
mechanism. While VRML has a standard format for identifying such extensions,
their implementation is browser-dependent.
Some VRML nodes generate events in response to environmental changes
or user interaction. Event routing gives authors a mechanism, separate
from the scene graph hierarchy, through which these events can be propagated
to effect changes in other nodes. Once generated, events are sent to
their routed destinations in time order and processed by the receiving
node. This processing can change the state of the node, generate additional
events, or change the structure of the scene graph.
Script nodes allow arbitrary, author-defined event processing. An
event received by a Script node causes the execution of a script function
which has the ability to send events through the normal event-routing
mechanism, or bypass this mechanism and send events directly to any
node to which the Script node has a reference. Scripts can also dynamically
add or delete routes and thereby change the event-routing topology.
The ideal event model processes all events instantaneously in the
order that they are generated. A timestamp, the time at which an event
is delivered to a node, serves two purposes. First, it is a conceptual
device used to describe the chronological flow of the event mechanism.
It ensures that deterministic results can be achieved by real-world
implementations which must address processing delays and asynchronous
interaction with external devices. Second, timestamps are also made
available to Script nodes to allow events to be processed based on the
order of user actions or the elapsed time between events.
A generator is a human or computerized creator of VRML files.
It is the responsibility of the generator to ensure the correctness
of the VRML file and the availability of supporting assets (e.g., images,
audio clips, other VRML files) referred to therein.
The interpretation, execution, and presentation of VRML files will
typically be undertaken by a mechanism known as a browser, which
displays the shapes and sounds in the scene graph. This presentation
is known as a virtual world and is navigated in the browser by
a human or mechanical entity, known as a user. The world is displayed
as if experienced from a particular location; that position and orientation
in the world is known as the viewer. The browser may define navigation
paradigms (such as walking or flying) that enables the user to move
the viewer through the virtual world.
In addition to navigation, the browser may provide a mechanism allowing
the user to interact with the world through sensor nodes in the scene
graph hierarchy. Sensors respond to user interaction with geometric
objects in the world, the movement of the user through the world, or
the passage of time.
The visual presentation of geometric objects in a VRML world follows
a conceptual model designed to resemble the physical characteristics
of light. The VRML lighting model describes how appearance properties
and lights in the world are combined to produce displayed colours.
Figure 2-1 illustrates a conceptual model of a VRML browser. This
diagram is for illustration purposes only and is not intended for literal
implementation. The browser is portrayed as a presentation application
that accepts user input in the forms of file selection (explicit and
implicit) and user interface gestures (e.g., manipulation and navigation
using an input device). The three main components of the browser are:
Parser, Scene Graph, and Audio/Visual Presentation. The Parser component
reads the VRML file and creates a Scene Graph. The Scene Graph component
consists of a Transform Hierarchy (the nodes) and a ROUTE Graph (the
connections between nodes). The Scene Graph also includes an Execution
Engine that processes events, reads and edits the ROUTE Graph, and makes
changes to the Transform Hierarchy (nodes). User input generally affects
sensors and navigation, and thus is wired to the ROUTE Graph component
(sensors) and the Audio/Visual Presentation component (navigation).
The Audio/Visual Presentation component performs the graphics and audio
rendering of the Transform Hierarchy that feeds back to the user.
Figure 2-1: Conceptual Model of a VRML Browser
VRML conceptually supports the concepts of profiles. A profile is
a named collection of functionality which must be supported in order
for an implementation to be conformant to that profile. Only one profile
is defined in this standard. The functionality and minimum support requirements
described in ISO/IEC 14772-1 form the Base profile for VRML.
Additional profiles may be defined in other parts of ISO/IEC 14772.
Such profiles shall incorporate the entirety of the Base profile.