- Back to Home »
- VRM Language
Posted by : Unknown
Monday, April 22, 2013
Introduction
VRML stands for ``Virtual Reality Modeling Language''. It allows to
specify dynamic 3D scenes through which users can navigate with the help of a
VRML browser. VRML scenes can be distributed over the World-Wide Web and
browsed with special VRML browsers, most of which are plug-ins for Netscape or
Internet Explorer. VRML is well integrated with the WWW, e.g. VRML scenes can
be connected with other VRML scenes (as well as other WWW formats) via URLS.
The Virtual Reality Modeling Language (VRML) is a file format for
describing interactive 3D objects and worlds. VRML is designed to be used on
the Internet, intranets, and local client systems. VRML is also intended to be
a universal interchange format for integrated 3D graphics and multimedia. VRML may
be used in a variety of application areas such as engineering and scientific
visualization, multimedia presentations, entertainment and educational titles,
web pages, and shared virtual worlds
What is VRML?
VRML
is "an open standard for 3D multimedia and shared virtual worlds on the
Internet."
1. An open standard: VRML was recognized as an
international standard (ISO/IEC-14772-1:1997) by the International Organization
for Standardization (ISO) and the International Electrotechnical Commission
(IEC) in December, 1997.
2.
3D multimedia: Long before its official standardization VRML became the de
facto standard for sharing and publishing data between CAD, animation, and
3D modeling programs; virtually every one of those programs now exports VRML or
has a utility or plugin to convert its native file format to VRML.
3.
Shared virtual worlds: Work in a 3D shared virtual space was one of the
earliest motivations of the VRML pioneers. The VRML works has a whole section
on cyberspace that talks about the work that's being done to realize this
vision.
4.
On the Internet: Unlike previous 3D applications, using the Internet to share
3D objects and scenes was built into VRML from the very beginning. The standard
is even published in HTML.
What kind of language is VRML?
VRML isn't
a general purpose programming language like C++, a script language like
JavaScript or a page specification language like HTML. It's a scene description language that
describes the geometry and behavior of a 3D scene or "world".
VRML isn't
a programming language, it's a scene description language. We can build VRML worlds with a plain text editor. But many people don't want to use a text
editor and get into the syntax of VRML.
VRML 2.0 VERSUS OTHERS
The major difference that VRML 2.0 has is that it is more
interactive, more realistic. VRML 1.0
had static worlds, that is, no interaction and the shapes you see in the world
are the shapes that will stay, no movement.
VRML 2.0 enhances this by adding JAVA and JavaScript support, as well as
sound and Animation. Now instead of
just looking at an unexciting house, you can see the Windows flutter, the doors
open, cars entering and exiting the garage.
What's a VRML world?
VRML
"worlds" got their name from an original goal of VRML: shared virtual
worlds on the Internet. VRML worlds can
be single files or groups of files that load at the same time. They can range from simple objects to very
complex scenes, but never include the entire geometry and all the features of
the earth.
What is the format of a VRML file?
A VRML
file is a compressed binary format is approved, a plain UTF-8 or ASCII (a
subset of the UTF-8 character set) text file.
A VRML file may be compressed using gzip, a freely available utility,
and may be created, viewed, and edited in any plain text editor.
What filename extensions designate a VRML file?
A VRML
file ends in "
.wrl
". A VRML file name may
end in ".wrl.gz
" or ".wrz
" to
indicate that the file has been gzipped, but this is not necessary, and
browsers are not required by the spec to support these file name extensions.
How do I gzip/gunzip a VRML file? Will PKZip work?
Use the
free program gzip. Some of the regular
zip programs like WinZip will unzip files, but will only create PKZip format
files, which most VRML browsers will not handle properly.
Because of a bug in some web
browsers, it's best to follow the following steps:
1. Gzip your world. This will turn your
file
foo.wrl
into a file named foo.wrl.gz
.
2. Rename your world to
foo.wrl
.
When you want to edit the
file again:
1. Rename your file to
foo.wrl.gz
2. Use gunzip to turn it back into
foo.wrl
, which will be a text file you can edit.
A free
program for Win9x/NT/2k at the VRMLworks called Win-GZ takes care of both of
these operations at once. Put it on your right-mouse menu for VRML files, and
you can do it all with two clicks
What do I need to view (or visit) a VRML world?
There are three kinds of VRML
browsers:
1.
A stand-alone application. We can compile stand-alone applications that can
view and manipulate VRML worlds with development kits such as Open Worlds,
JVerge, WorldView for Developers, and Open Inventor. Many people will not want to or need to
compile applications and will use one of the other two kinds of browsers.
2.
A helper application. A helper application has all the capabilities it needs to
view and manipulate VRML worlds and doesn't need to be compiled. It generally identify a program to the web browser as a helper application,
much as you do for a PostScript or Microsoft Word viewer, and whenever the web
browser receives a link to a VRML world, it will launch the helper application.
Many helper applications will call on the web browser when they activate a link
for an HTML page. Two popular VRML
helper applications are Sony's Community Place, and VRWave.
3.
A plugin. Plugins use the facilities provided by many web browsers to display
VRML worlds in the web browser. The two
most popular VRML plugins are WorldView, also called Microsoft VRML, for
Microsoft Internet Explorer and Cosmo Player for Netscape Navigator and
Communicator. Many versions of web
browsers come with a VRML plugin pre-installed.
There is a page at the VRMLworks that can help to see any VRML plugin
already, and check how it's working. If
the web browser does not have a VRML plugin installed, it can downloaded from
Microsoft, Intervista, or Cosmo Software.
It is not
necessary to use a particular VRML browser with a particular web browser,
unless the VRML browser maker says that their VRML browser will not work with a
particular web browser. And you aren't
required to use the browser that came preinstalled in your web browser. Check the list of VRML browsers at the VRML
Repository for alternatives.
What's the difference between VRML 1.0 and VRML 97?
VRML 1.0
|
VRML 2.0
|
o
Standard
objects (cube, sphere, cone, cylinder, text)
o
Arbitrary
objects (surfaces, linesets, pointsets)
o
Ability
to fly through, walk through, examine scenes
o
Lights
o
Textures
on objects
o
Cameras
(viewpoints)
o
Clickable
links
o
Define
and reuse objects
|
All VRML 1.0 features
plus
o Animated
objects
o Switches
o Sensors
o Scripts (Java
or JavaScript) for behaviors
o Interpolators
(color, position, orientation, etc.)
o Extrusions
o Background
colors and textures
o Sound (.wav
and MIDI)
o Animated
textures
o Event routing
o Define and
reuse objects and behaviors and effectively add new nodes to the language
with PROTO and EXTERNPROTO
|
VRML compiler?
There
isn't one. VRML is plain text, and a
VRML browser reads that text in and builds a scene according to the instructions
it finds in text file(s).
VRML worlds in a C++ or Java application?
Open
Worlds has a C++ toolkit that allows you to develop a stand-alone application
that can view and manipulate VRML worlds.
A number of VRML browsers, among them Cosmo Player 2.1, WorldView 2.1,
and Blaxxun CCPro 3.x, can use Microsoft's COM to interface between the VRML
browsers and applications.
Justin
Couch has a set of classes called JVerge that replicate the VRML 97 nodes as
individual Java classes.
Intervista
has a package WorldView for Developers that lets you develop applications in
C++, Visual Basic, Java, and Macromedia Director Xtras and use WorldView as an
embedded VRML application.
Open
Inventor from Silicon Graphics can use their own nodes, VRML 1 nodes, and VRML 97 nodes.
PRODUCING VRML
There are three ways of
producing VRML.
v Code VRML by hand : If you like to hand code VRML , consider getting
a VRML assisting editor like emacs.
v Usea a VRML supporting Modeler : There are basically two types of
tools you need:
a)
A object creation tool
b)
A space (or “walk thru”)
creation tool such as Cosmo’s Home Space
Builder or Virtus Walkthrough Pro.
v
Use a Filter : to transform
other 3D Formats into VRML.
VRML EDITORS
Before
selecting an authoring editor we must ask the following questions to ourselves
:
--Does the editor include
object modeling or is it just a scene editor ?
--Does the edtor come with a
library of ready-to-use objects ?
--Does it support VRML 2.0 ?
--Does it generate
“efficient” VRML ?
VRML FILE STRUCTURE
A VRML file always starts with the
header:
#VRML V2.0 utf8
The identifier "utf8"
which appears on the header lets you use international characters in your VRML
models.
Comments start with #, all
characters until the end of the line being ignored.
After the header the following can
appear:
nodes, prototypes, routes
Here is a typical VRML file with a single node:
# VRML v2.0 utf8
# A sample file with a single
node
Transform
{
Translation 0 2 0
Children [
Shape {
geometry Sphere{}
}
] }
The color model in VRML is RGB. In
order to define a color three values are needed: Red Green and Blue, these
values are between 0.0 and 1.0. For instance 0.0 0.0 0.0 is Black, 0.0 0.0 1.0
is Blue, and 1.0 1.0 1.0 is White.
The units in VRML are assumed to be
meters. Although you do not have to follow this convention it is advisable that
you do. If everyone follows this convention then all worlds will be scale
compatible.
The angles in VRML are measured in
radians, not in degrees.
Defining fields and events, setting
initial values
Only
fields can have initial values according to the specification. All the other
variable types, eventIn and eventOut, can't define an initial value.
To
define a field you must specify a data type for it.
The
following are valid field definitions:
Example:
field
SFRotation myRot 0 0 1 0
field
MFVec3f myPos [0 0 0, 1 1 1]
field
MFString myURLs ["clock2.wrl","land.wrl"]
For
eventIn and eventOut fields you do not define an initial value. The following
are valid eventIn and eventOut definitions:
Example:
eventIn
SFRotation rot_changed
eventOut
SFBool set_start
VRML Data Types
VRML |
Javascript |
Description |
SFBool
|
Boolean
|
Single
Boolen Field
|
SFColor
|
float
array with 3 components [Red,Green, Blue]
|
Single
Color Field
|
MFColor
|
Array of
float array with 3 components
|
Multiple
Color Field
|
SFFloat
|
Float
|
Single
Float Field
|
MFFloat
|
Float
array
|
Multiple
Float Field
|
SFImage
|
int
array with at least 3 components. The first two specify the width and height
of the image, the third specifies the image type (see PixelTexture). The
remaining components specify the pixel colors as defined in the PixelTexture node.
|
Image
Field
|
SFInt32
|
int
value
|
Single
Integer Field
|
MFInt32
|
int
array
|
Multiple Integer Field
|
|
|
|
|
|
|
SFRotation
|
float
array with four components: the first three indicate the axis of rotation,
the last component specifies the angle
|
Single
Rotation Field
|
MFRotation
|
Array of
SFRotation
|
Multiple
Rotation Field
|
SFString
|
String
|
Single
String Field
|
MFString
|
String
Array
|
Multiple
String Field
|
SFTime
|
Double
|
Single
Time Field
|
MFTime
|
double
array
|
Multiple
Time Field
|
CONVERTING FROM OTHER 3D SOFTWARES
If you’ve worked with other 3D software, you may just want to
convert it from its native file format to .wrl, the VRML format.
Filename Converts From Converts
To System
Mus2wrl.exe .mus (core 3d Format) .wrl(VRML 2.0) Windows95
Max2wrl.exe .max(3d Studio MAX) .wrl(VRML 2.0) Windows95
Vrmllto2.exe .wrl( VRML 1.0) .wrl(VRML 2.0) Windows95
Can I integrate JavaScript
and Java applets with VRML ?
The Script nodes in VRML 2.0 use JavaScript--rather than
Java—to extend VRML functionality. When
you use a VRML 2.0 editor to drag and drop behaviours onto an object, you are
really appending the scene graph with in-line JavaScript in a Script node.
To facilitate complete Java/VRML interaction, VRML97,
includes a standard for the external authoring interface (EAI), which enables
rich interaction between external processes, such as a Java applet and the
scene graph.
VRML SCENE GRAPH
A VRML text file describes a 3D world and the objects
inside it. Open a file with a WRL(world)
extension, and you’ll see lots and lots of descriptive text. That text is called a scene graph. It’s your 3D world defined one piece at a
time in logical nodes.
Nodes, which are part of a scene graph, describe a variety
of items: a major feature, like a physical object in the world(e.g. a Shape
node), an attribute of an object(such as its color), ab attribute of the world,
and so on. Nodes are arranged hierarchically,
so that an Object node, for example, consists of the main object and numerous
subordinate nodes, or children, that flfesh out its details. Like HTML, VRML scene graphs use references
to external files to handle external media, such as sounds and textures.
HOW TO NAVIGATE THROUGH A VRML SCENE?
The most comman navigation
means are:
1.
Walk(6 degrees of
freedom)
2.
Plane Walk: restricted
walk in x-y or x-y-z axis, heads up/down in y-z axis, etc;
3.
Flight: start/stop
flying and accelerate/decelerate.
4.
Point at ( or seek).
Jumping to an object, or selecting on with a harpoon and get closer in several
steps.
5.
Examine mode is
special. It can be used to
examin4e(rotate and zoom) either the whole scene or a selected object(or both).
HOW TO INCORPORATE VRML SCENE IN HTML DOCUMENT?
A VRML scene allows movement along any three degrees, or
axes, of movement. You can rotate along any of these three axes, yielding what
3D designers call six degrees of freedom.
In VRML there’s an additional degree of freedom: the hyperlink. Objects in the world can point to other
worlds or to plain old HTML documents. Once you’ve created a scene graph file,
you can put a VRML scene on your Web site by simply using an <EMBED> tag
in your HTML code.
<embed
scr=”samle.wrl” width=400 height=300>
The size of the pages view port in determined by the height
and width specifications you use. By
placing an >EMBEDS> command within a frame you can give visitors the
opportunity to continue browsing your HTML
site in one frame while they roam your VRML world in another.
THE NODES IN VRML
VRML 2 has about 9 node types. We will shortly list the features of some
important nodes as explained in detail in the concepts and the =>Node
Reference sections in the VRML97 specification.
Grouping nodes: =>Grouping
nodes are used to create hierarchical transformation graphs. Groupiing nodes have a children field that
contains a list of nodes which are the transformation descendants of the
group. Each grouping node defines a
coordinate space for its children. This
coordinate space is relatife to the parent node’s coordinate space.
Special groups: The
=>Inline is a grouping node that reads its children data from a location in
the World Wide Web. The =>LOD
specifies various levels of detail for a given object, and provides hints for
browsers to automatically choose the appropriate version of the object based on
the distance from the user. The
=>Switch grouping node traverses zero or one of the nodes specified in the
choice field.
Common nodes: Used for things
like light ,sound, scripts,etc.
Sensors: =>Sensor nodes
generate events. Geometric sensor nodes
generate events based on user actions, such as a mouse click or navigating
close to a particular object. TimeSensor
nodes generateevents as time passes. The
=>TimeSensor is a kind of =>Time
Deplendant Node. TimeSensors can be used
to drive continuous simulations and animations, periodic activities and/or
single occurrence eventrs such as an alarm clock.
Geometric nodes:
=>Geometry nodes must be contained by a Shape node in order to be visible to
the user. The Shape node contains
exactly one geometry node in its geometry field.
Appearance: The Appearance
nodespecifies the visual properties of geometry by defining the material and
texture nodes.
Interpolators:
=>Interpolators nodes are designed for linear key framed animation. Let’s look at the orientation Interpolators
which is one kind of VRML’s =>Interpolators.
In short, they allow you do simple animations (e.g. rotate objects, move
objects, around, change colors of things).
An interpolator will generate values based on clues defined by a set of
keys.
Bindable Nodes: =>Bindable
nodes have the unique behavior that only one of each type can be active(i.e.
affecting the user’s experience) at any point in time.
Ordering nodes: =>Ordering
is quite simple: VRML is a declarative language and all declaration are
executed in the order they appear.
Basically speaking, VRML nodes can be nested at any level of
detail. The usual scoping principles
apply.
ANIMATION
KEY FRAME ANIMATION:
VRML provides a set of tools for keyframe animations. An animation sequence can be understood as a
cycle with a beginning(the first frame) and end (the last frame) and everything
in between. In order to build keyframe
animations you define a set of so-called keyframes, i.e. specific critical
moments in an animation cycle.
You then use interpolator nodes (or custom made script
nodes) to compute all the intermediary positions that are
necessary fo ram smooth animation in function of the fraction of the animation
cycle computed. Key frames are usually
virtual definition of some VRML geometry that you want to animate, e.g.
position, shape, color of some group of objects. But you can animate whatever exposed fields
or eventIns of any node you wish.
There exist a variety of builtin =>Interpolator nodes
that cover some common linear animations needs:
1.
The
=>ColorInterpolator
2.
The
=>CoordinateInterpolator
3.
The
=>NormalInterpolator
4.
The
=>OrientationInterpolator
5.
The
=>PositionInterpolator
6.
The
=>ScalarInterpolator
How do I make my VRML content dynamic?
Using a
technique called routes, VRML2.0 lets you specify dynamic events that can
affect one or more objects in your scene.
Usually these events take the form of transforms ( movements or
rotations) that are activated when a user clicks an object. For example, you can create events that let
user click the On switch of a
fan to make that fan’s blades rotate.
The blades stop rotating when the Off switch is clicked.
What other VRML special effects are there?
The VRML 2.0 spec includes such extras as the ability to
map a moving image ( in MPEGI format) onto an object. This allows you to create a TV set or
terminal in a VRML world that appears to play videos or advertisements, for
example. Large video files take too long
to load if people are viewing your VRML scenes via dial-up connections, but you
can use tiny looped animations to
convincingly achieve effects such as fire or static.
EXTERNAL AUTHORING INTERFACE (EAI)
To Java, the EAI is a set of classes with methods that can
be called to control the VRML world
. To VRML the EAI is just another
mechanism that can send and receive events, just like the rest of VRML . In more general terms, the EAI is an
interface specification that allows an external program to communicate with a
VRML scene. Uses of EAI:
Control of interactive
multimedia presentations involving more the VRML.
Visualizations needing a 2-D
interface applet that controls the VRML scene in real time (e.g. users slides a
button and somethins grows/shringks/moves in the scene).
Custom VRML navigation.
Multiuser Worlds with chat
windows and other networking applications that need a user interface applet.
What are the barriers to VRML?
Until recently, one major barrier to acceptance of VRML
technology has been the confusing variety of VRML browsers and plug-ins
available. Users simply didn’t know what
they needed to view VRmL worlds. Other
include long down load time for complex
VRML worlds and high hardware requirements to navigate the environments
fluidly.
CONCLUSION :
The next big step for VRMl is
to make it accessible to multiple users.
Ideally, several visitors to your VRML world will be able to be interact
with each other in real time. Their
avatars will see each other in your world and interact through text chat or b
manipulating objects. Even better,
future extensions of VRML should allow avatars to tgravel seamlessly from one
site to the next, maintaining a consistent visual identity. So that people like myself would be able to
play games effortlessly on the net. Also
with the advent of P4-processors, advanced AGP cards and high speed modems
would help in generation and access of quality graphics in less time.
In the future, there should be tools that make it easier to generate
VRML content from abstract data, such as databases and spreadsheets. These advancements will help VRML play a
bigger role in business applications and intranets. Because most of the computer and business
market survives on business interests.