| Authoring VRML 1.0 (Part 4 of 4)
|
| by Len Bullard
|
|
This article explains the use of platform/browser-specific features
to create non-standard VRML performance. Before we go further, let me
say Don't Do This!. Since I use these in some of my worlds,
that can seem hypocritical, but I want you to understand the tradeoffs.
|
|
|
- These extensions made sense a year ago when experimentation was
driving the browser implementors. It was thought that successful
extensions adopted by numerous modelers would make it into the next
revision of VRML. Instead, a better syntax and more flexible ways
of doing the same things were adopted.
- Some modelers such as myself did use the extensions. They allowed
us a smidgeon of motion, backgrounds, interframe targeting, etc. and
that allowed us to build more compelling worlds.
The global downside is now we have worlds that work on one browser best,
and sometimes, not at all on others. People are mislead into thinking these are
2.0 worlds. People believe they can get enough out of 1.0 to satisfy
their needs and that has confused the marketplace. The local downside
is that I have to explain this at least three times a week to people
who visit my site and wonder why things don't work as they should despite
the fact that I try to explain all of this in my HTML text. If they visit
my worlds with a 2.0 browser, some of them work but most of them return
errors. I look stupid and the surfer gets pissed. It gives me and VRML
a black eye. Very soon, I must convert all of these worlds into 2.0
grammar and replace these features. It is not an inconsiderable amount
of work but it will produce even richer worlds.
NOTE: I will show you syntax that makes it possible
to add extensions such that a browser that does not implement them can
skip them. It doesn't always work.
|
|
|
If you want animation, rich interactivity, internal spatial sound,
and all the rest, stop reading this article and move on to VRML 2.0.
You'll be glad you did. Enough lecture. We are sinking deep in sin;
here is a hand to pull you in. These are Live3D extensions.
|
|
|
Adding A Background
This extension is the most useful. It allows one to put an image
in the background similar to a theatre backdrop (rear curtain with
scenery painted on it). Here is an example:
DEF BackgroundImage Info{
string "chrome5.jpg"
}
|
Kate Bush Homeworld
|
This extension uses the VRML 1.0 Info node typically used
for putting copyright information and other character strings that
a browser could notice or ignore optionally. This extension should not
cause problems for browsers that don't implement it.
There are some tricks that are worth knowing. Live3D, for example,
tiles an image to the background similar to a background in an HTML
web page. If you want to make it big enough to cover the screen, you
must size it appropriately. When doing background scenery, either
the tiling must be unobvious as is the case with the ubiquitous
star background that I used in the Kate Bush Homeworld, or it must
fill the screen, perhaps in conjunction with a ground object such as
I used in Homeground Towers.
It is hard to get a background to tile. It is equally hard to
get it to wrap such that the seam does not show. In the Princess of
Talos, combined the chrome image with the
star background and copied some stars down into the clouds. Then I
cut the left edge, inverted it, and pasted it to the right so mirrored
ends would meet. Then I went into the pixel editor and evened out
some of the remaining seam by smearing the colors and copying over
small regions. All in all, about two days of work went into making
the illusion of a space station at the edge of space. The background
for HomeGround Towers was stock with Live3D. Using it was simply
a matter of making the ground plane big enough to hide the trees and
the lake, and setting the cameras.
|
|
|
Adding Sound with WWWAnchor
Sound is not a natural part of VRML 1.0. However, you can use
a WWWAnchor to instruct the Netscape
framework to play a soundfile. Simply replace the usual
target value with a sound file type supported by the browser,
(e.g. .wav). It will obligingly do so by
popping its sound control up over the frame and starting the
sound. This kills the drama, but it works. I use Netscape
frames and HTML commands instead. Here is an example of
an anchor node for sound.
WWWAnchor {
name "ruth.wav"
description "Running Up That Hill
- The Deal With God - Kate Bush."
DEF InnerKate Separator {
Cube {
height 45
width 35
depth 0.001
}
}
}
|
|
|
Inter-frame Targets
With Live3D and Netscape, you can point a WWWAnchor at a framename
and the system framework will cause the file named to be loaded into '
the frame specified. This is a handy trick, actually. I use it in the
Talosian Spacestation. When you click on a ship, the frame loads
a description of the ship, the race that flew it, and a bit of the
story of the Princess of Talos. It is one way to tell a story
indirectly, or to use a 3D graphic to load a parts description in a
technical manual.
|
|
|
Adding Spins
I hesitate to show you this one. It gets me the most hate mail second
only to using frames. On the other hand, it is the best deal one gets for
some motion in VRML 1.0. There are two spin nodes in Live3D:
- SpinGroup - acts like a separator and spins the objects beneath
the separator.
- Spin - is a non-local node that uses the DEF name of an
object or group of objects to spin them.
The SpinGroup looks like this:
DEF KBC3 SpinGroup {
rotation 0 1 0 -0.04
}
The rotation values determine the axis of spin (XYZ). The last value
determines the direction (negative or positive) and the rate.
The Spin node is more complex. It can be anywhere in the file after the
object it spins. It looks like this:
Spin { fields [
SFString objectname,
SFFloat yangle,
SFEnum axes ]
objectname "World" # DEF name of object to spin
zangle -.01732 # angle of spin, direction, and rate
axes LOCAL # spin in local or global coordinates
}
|
|
|
Notice the type designators in the fields declaration, eg, SFString objectname.
This enables a conforming VRML browser to ignore this node. It doesn't always work.
I made extensive use of these nodes to create the moving objects in Kate
Bush HomeWorld scene.
|
|
|
SpinGroup is implemented by other browsers. Spin is not. Spin was an
experiment by the Live3D development group that got loose, got used, and
couldn't be killed with a ship's phasers after that.
|
|
|
Animated Objects
This trick only works in Live3D. If you take a vertical strip
of square images (e.g, 128 x 128), and use them as a texture in
an object such as a cube, the strip will play on the object like
a flip book animation. It is a limited trick because one cannot
control the frame rate except by using multiple images. Also,
the size of the file is limited by the resources available on
the platform. The Kate and Cathy Worlds on my homepage are
animated rotating cubes.
|
|
|
These are very tedious to build by hand. If
you don't get each photo in the strip perfectly aligned without
overlapping pixels, you get little jaggy white lines at the
borders of the cube.
|
|
|
Test the World
Before you put the world on the Web, check that all of the
hyperlinks work in a local directory. Make sure all of the textures
are present. In other words, exercise the beasties and look
very carefully. After you publish it, look at it on the service
provider's site to make sure it all got there. Sometimes, if the
service provider has not configured the server, you will select
it an get text back. The correct configuration on the server
requires that they add VRML as a MIME type. See vrml.sgi.com
for instructions.
|
|
|
Publish the World
Typically, I make a publish directory and put everything
I need in it before transferring it to my service provider's
machine. This helps when doing final testing, and when using
WSFTP or some other utility to transfer the file, emptying
the source directory is sufficient to make sure it all gets
to the server.
|
|
|
Go to all of the lists you can think of, particularly the
VRML list, and tell everyone you have a new world to visit.
That's it. You're a WorldBuilder. Kiss On All Cheeks.
|
|
|
Hints
Here are some ideas to consider as you begin to
create VRML worlds. Most of this is opinion and subject to argument.
So take these with a grain of salt and healthy skepticism.
|
|
Reading and Sharing Code
While it ain't kosher to steal, it is common practice to
read other people's code to learn the techniques they used
to get a certain effect. Many of us post code to the VRML
mailing list (Have You Joined? You Should!) to show off or,
really to share what we have learned. Sometimes, when we
initially release a world, we don't compress it for a while
so it is easier for others to read the code. This act of sharing
is fundamentally what has driven VRML from it's inception, was
openly practiced by it's creators, and is still encouraged.
As Mark Pesce, OberLord of VRML said, "A resource shared is a
resource squared." It's true.
|
|
|
When someone posts that they have a new world or tutorial
for the community, go get it and study it. When you have made
something you think is cool, post to the list and share it.
The other modelers out there are the best resource
there is. We have been helping each other since the beginning
of VRML, and that has put VRML into the mainstream of the WWW
quicker than any other notation.
|
|
|
Acquire Techniques
There are lots of techniques for creating worlds. For example,
a Russian Doll is composed of several smaller dolls, each inside
another. The technique of creating objects inside objects and
using cameras to guide the user into them, or letting them discover
them while exploring is an old technique and cool. I learned it
from Rob Geiger who used it in his BYTET world and I applied to
the Kate Worlds main scene.
|
|
|
Everyone uses camera tours. This is setting up cameras in an
order so that the NEXT key sequence animates naturally through the
scene. Most of my 1.0 worlds apply this technique. Since I build
slowLoaders for low frame-per-second rendering, I consider this polite.
|
|
|
Backlighting a semi-transparent object is another technique I acquired
from theatre where we backlit scrims made of muslin to get firewall effects.
I use this in the Princess of Talos to create a red glow behind the dome.
In 2.0, I plan to experiment with surface animation and lighting to see
if the rippling effect of striking the muslin can be reproduced.
|
Isle of Jeenix
|
Another very useful technique is abstraction. This is looking at real
world objects and abstracting them into primitive shapes, then using
those shapes in a virtual object. A lot of times, when virtualized, the
shape becomes something completely different. For example, the Jeenix
birds in the Isle of Jeenix are modeled on a wooden armadillo at my studio.
The power spheres in the Princess of Talos are based on a parking lot
sidewalk light. The landscape of the islands in the Isle are just
left-overs from experiments with deforming spheres and toruses.
|
|
|
There is no end to this kind of synthesis and that's a joy of the
virtual modeler. Joy is the reward.
|
|
|
"Feel It, My Love"
That title is a line from a Kate Bush song, "Feel It". I like Kate
a lot. (Really?!?) Why? In the music business, she is an absolute
master of making a recording that expresses emotions. This is very hard
to do. I have made two albums and I can assure you, ninety percent of the effort
is getting a track to "feel" right, that is, to express the emotions
of the song. With it, a simple world is compelling; without it, a
complex world is wasted bandwidth. EtherNoise. VRML is a craft and
an art, and those that do it best create emotions in the visitor. That
is the hallmark of compelling worlds.
|
|
|
How one achieves "feel" is very individual. The best I can say is
that the world conveys a mood that comes to life as feelings as the
visitor explores your world and interacts with the characters you place
there and the situations you put them in. It is a difficult thing to
describe, but the doing is very simple. If the world is compelling you
as you make it, it will compel a visitor.
|
|
|
I study Kate's techniques to learn how to do this better,
but the personna of the voice allows no duplicity. To get the feeling,
you have to experience it. Simple technique won't do. You come off
sounding like one of those noveau soul singers trilling and thrilling,
but basically, walking all over the melody. Every country songwriter
can get more emotion into a simple I-IV-V progression than most
Juliard graduates if they have an emotion, something to say. It is
inside you, and if you don't want it to come out, don't do music. If
you do, prepare to work harder and take more risks. For me,
VRML is the same challenge and risk, and I work hard to meet them.
|
|
|
I discover most techniques for creating feeling serendipitously.
I do a lot of experiments with the language and suggestions made
by others. Often, I stumble into some combination of objects and
techniques that evoke a mood. In the Isle Of Jeenix, a VRML 2.0
world, I wondered if lights could be bound to moving objects. I
put one inside an orbiting sun and discovered to my delight that
the repainting emulated a shifting twilight effect. The Isle is
where the Princess of Talos was exiled for a time with her pets, the
Jeenix. It was a nadir of her time prior to her exile and I wanted
a dark moody but temperate feeling.
|
|
|
Sometimes, I am trying to express a theme and achieve a function.
The Russian Doll technique used in The Worlds Of Kate Bush is a thematic idea. Kate is well-known for the
sexy histrionics of her early work, exemplified by the poster of
her which is used for the cube at the center of the orbits. But as
one goes deeper into her work, particularly through her fan club
publications (exemplified by the counter-rotating cube and KT symbol
inside the main cube), one finds at the heart, a mysterious evocative
woman whose art and life are summed up in the words to her song,
"Running Up That Hill" and quoted beneath the picture at the
absolute heart of the orbiting objects.
|
|
|
Externally, one can click on any of the worlds and explore other
aspects of her world. Internally, one sees all of this as background
moving behind this marvelous artist who works reclusively protected by
her family and friends. She is a mystery, but all one needs to know is
there in her art if you look deep enough.
|
|
|
Functionally, it's a 3D table of contents; thematically, it
is a vision of a woman's heart.
|
|
|
Learn technique, but understand the importance of "feel": you can
study technique until you are a pedant. Feeling is the Master Craft; the
meaning. It is the highest and the one true magic.
|
|
|
Using VRML Editors
In my experience, creating complex scenes is faster and
more serendipitous with an editor that allows you to visualize
the piece as you build it. This saves you from continuously reloading
the world in a VRML browser as you create it. A good editor will make
your life easier. Choose an editor that fits your needs. You will
probably get more than one editor because each will have features you
like or best fit your work style.
|
|
|
As well as visualiztion, there are some features you may need. These
include:
- Dialog-driven Object Editing - This allows you to use the common
dialog types of text editors (e.g, sliders, thumbwheels, entry boxes,
drop down lists, etc.) to set the values of the object you are editing.
- 3D Object Editing - These are widgets created specifically for manipulating
values of 3D object properties. For example, when deforming a primitive,
they allow you to click on a vertex or face and manipulate it. Very handy.
- Conversion software - lets you take a variety of CAD or other graphic
formats and convert them into VRML or vice versa. Very handy for getting
objects from other libraries.
- DataFat Remover - Many VRML editors output complete node specificiation
with useless values such as transparency 0. Since zero is
the default value, this is fat in the file.
- Library Support - these are reusuable objects such as geometry, transforms,
etc. that you can select from a menu and place inside world you are building.
Good editors have stock objects, transforms, and textures. Study
these as examples of good code. They include hardToBuild shapes
such as toruses.
- Built In Gzip - To get the file size down for transmission, a
compression utility called Gzip is used. A good editor could let you save in Gzip form.
|
|
|
What I Like
I use three editors. My personal favorite is V-Realm Builder from
Integrated Data Systems. This is a VRML-centric editor. It supports all
of the VRML primitives, visualization, and it has a tree display of
the VRML instance as built. A tree view is valuable if you
are learning VRML. It lets you see VRML syntax in one window, and
transform or material effects immediately in the view windows. For me, V-Realm Builder is excellent
for the object creation stage and that is the bulk of the work.
|
|
|
However, many objects are not efficient as compounds of primitives.
They are irregularly shaped objects (e.g., most of nature) or have complex
perimeters such as three dimensional text. For these, I use Pioneer
from Caligari (organic shapes and three-dimensional text) and
Virtual Home Space Builder from Paragraph (complex cubes that are
heavily textured such as buildings).
|
|
|
Take Advantage of Free Demos
These companies offer good demo packages, 2.0 editors and tutorials
as well as sample worlds. Experiment with these, then choose what
works for you. These editors are improving rapidly and more offerings
are appearing as existing and emerging companies insert VRML technology
into their offerings.
|
|
|
Low Budget Alternatives
If you are just starting out and using an ASCII editor, most operating
systems and some word processors include macro support. For example in
Microsoft Windows, there is a Recorder application that records keystrokes
and commands and enables you to assign these to keys in your keyboard. In
the early days of SGML, we used these to store common keystroke sequences
for complicated productions. The same trick works for VRML because
like SGML, it's basic syntax is ASCII.
|
|
|
You can use these functions to record the keystrokes to build node
templates, then use a single keystroke to insert the production. This is a time-saver and it helps with syntax
when you forget the exact sequence. The recorder macro can also record
GUI clicks and selections. This can enable you to keep a directory of
named VRML objects which can be inserted directly into a file you are
editing, search for common errors, replace values, etc.
|
|
|
If you are so inclined, word processors such as Microsoft Word have
extensive macro scripting languages complete with the ability to use interactive
dialog boxes. You can do very complex operations
with these. If you aren't about to fork over the bucks for a real
VRML editor, and you have the time and tenacity, these can be very useful
tools for creating and configuring a VRML editing environment.
Remember to SaveAsText and use the .wrl extension.
|
|
|
Silicon Graphics and Sony both offer free utilities
for converting VRML 1.0 files to 2.0 files. Aside from saving you a tremendous
amount of work converting language versions, both delint (bug check) the
syntax of the files. They provide error messages that point
to the line where an error occurs. Most VRML 1.0 browsers with some
exceptions, don't provide this. It is a subject of debate whether an
application built for surfing, not modeling, should. Some do, some don't.
Browser writers also try to overlook common mistakes in VRML files, and
while that is a help for the surfer because the browser doesn't crash
and burn, it doesn't help the modeler find mistakes. That is why
getting and using a delint utility is a good idea for modelers particularly
as your files grow in size.
|
|
|
KISS Until Your Lips Bleed
A natural mistake for any modeler to make is to put too much
detail into their model. One can easily get caught up in the modeling
process and try to make it a perfect replica of reality. While it is
good to do realistic work, in many cases, it isn't needed and in very
many cases, counterproductive. Why?
- They Can't See It: Why model the inside of an object if the
user isn't intended to go inside? If they are intended to, it is often
better to do the inside in separate world and link to it. Some people
have machines straight off the shelf with no graphics accelerators or
boards that enable more than 16 colors. They can't see those subtle
color variations you work so hard to achieve.
- Too Many Notes, Mozart: The audience may not stick around
long enough for the complete world to load or does not have enough memory
to load and render the world.
- Digging In The Dirt: A very detailed world is slow to navigate.
The user scrubs with the mouse like a child digging in the dirt with a
stick. It makes them mad and kills the mouse.
- This Ain't Reality: We love the term, Virtual Reality, but
the fact is, this is 3D graphics and multimedia. You cannot achieve
the realism of a world that will fool a human eye for long even with
tools much more powerful. Don't be disappointed.
- Pet Tricks Work: Simple tricks that work and use less code
leave you resources for more content.
|
|
|
It's fun to push the envelope. I certainly do this in my worlds,
but listen carefully: I don't build worlds for a living. A lot of
my VRML work is a result of testing languages, editors and browsers to see what is
possible so I can make recommendations in my real job as a
hypermedia consultant. What I do for a paying customer
is strictly based on the requirements of that customer,
not my personal whims. I'm like a jet test pilot who is paid to take
risks with systems, not an airline pilot who is paid to get the
passengers there safely.
|
|
|
Humans are quite willing to suspend disbelief for the joys of a
compelling world. As you create complex scenes, and later, want
to add motion and other media, economy in the initial work pays
dividends.
|
|
|
Get an Idea and Tell A Story
Whether you are doing commercial work or art for art's sake, a world
should have a reason, a theme, a point. It is easier to conceive
of the objects you create and how to organize them if you have a story
to tell. The human imagination feeds on structure. Ancient bards
could recite thousands of lines of verse from memory and pass them
on vitually unchanged for generations because they used stock characters,
scenes, and strict structures.
|
|
|
I built The Worlds Of Kate Bush not only because I am a fan, but
also because the photographs I needed could be gotten off
the Internet. It saved me hours of scanning time. Those hours were
diverted to learning VRML. Having a project in mind gave me a
direction. The rest was mindless noodling. On the other hand, The Isle Of Jeenix
was built as a private effort to make a scene for a Kate Bush recording
from the Common Ground CD which she sings in Gaelic (perfect for an alien
princess). It turned out to be too big for the Internet, so I used a midi file of Debussy's
"Clare de Lune". The Kate version on my hard disk is much nicer, but
data pipes and copyright laws being what they are, Debussy wins.
|
|
|
Let your characters and scenes guide you. Most of us have an inherent
sense of what does and does not belong. Cultivate that sense and let it
guide your work. Don't neglect serendipity: the happy accident. Keep it.
It will find it's own place in your work. Like songwriting, a good idea
can be found as easily in a newspaper as in a broken heart. As John Lennon and Elton John
sang, "Whatever gets you through the night, it's alright."
|
|
|
Good Reading
The best I can do in this series of articles is introduce you
to VRML 1.0. There is much more to learn. I suggest one of the following
two books. Mark Pesce's book is the best introduction to VRML I have
used. It has the history, goals, the specification, and lots of good
examples. The VRML Sourcebook is like a VRML bible. It explains
each node in deep detail, has hundreds of examples, and teaches the
technical basis for the use of the language. Buy it second and
study it carefully.
|
|
|
Have Fun
It is attractive, and it shows in the world.
|
|
Len Bullard is a systems analyst
and a married father of two children.
He splits his consciousness between his job as a hypermedia consultant
and his rock band of ten years, Ground Level Sound. His interests
in VRML spawned from a conviction that this was the technology that
would rejoin his divorced psyches and help him fight a lifelong
addiction to endorphins. He spends his copious spare time recording
original music with his band at their studio, Blind Dillo, performing
in the southeast region with GLS, beta testing and answering email.
|