0% found this document useful (0 votes)
29 views18 pages

VR Toolkit Overview and Scene Graphs

The document discusses Augmented Reality (AR) and Virtual Reality (VR) toolkits, focusing on their role in creating virtual worlds through an Application Programming Interface (API). It highlights the importance of scene graphs in organizing objects within a virtual environment and explains the functionality of WorldToolkit (WTK), one of the oldest VR programming toolkits. Additionally, it covers the hierarchical structure of scene graphs and their impact on rendering and user interaction in virtual simulations.

Uploaded by

singhsnow045
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views18 pages

VR Toolkit Overview and Scene Graphs

The document discusses Augmented Reality (AR) and Virtual Reality (VR) toolkits, focusing on their role in creating virtual worlds through an Application Programming Interface (API). It highlights the importance of scene graphs in organizing objects within a virtual environment and explains the functionality of WorldToolkit (WTK), one of the oldest VR programming toolkits. Additionally, it covers the hierarchical structure of scene graphs and their impact on rendering and user interaction in virtual simulations.

Uploaded by

singhsnow045
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3-2

Augmented Reality / Virtual


Reality

is an Application
Programming Interface (API) -
VRProyae
An authoring environment
allows interact with
users to
base
the created w
runtime environment
creating virtual worlds, A
real time.

3.1 Toolkits and Scene Graphs


For maximum programming flexibility,
authoring can be done ina low-eevel graphics
(such as OpenGL). This is an iterative process of
trial and error that requires skill \ang
and [Link].
lack of standards between different programming languages and knowledge gaps that
programmers complicates this task. For this reason, the VR industry has developed a
hamper n
advanced software tools, called VR toolkits, to support the authoring task. number c
Toolkits are extensible libraries of object-oriented functionality developed for
specification. Asimulated object is part of aclass and inherits its default the V
programming task.
attributes, simplifying
the
The library is extensible, allowing developers to create
same simulation kernel. These functions are written to work
application-specific modules and use
with a variety of
and are generic in
nature. This is achieved by the fact that high-level hardware platforns
about the particular hardware they are running functions do not "know"
on. A low-level translator identifies a
1/0 device at runtime. This is very particular her
useful when porting an application
another. Additionally, the toolkit supports from one platform to
network formats to allow multiple user
The first toolkits introduced in the interactions.
early
Developer Kit (CDK), Virtual Reality Toolkit 1990s included VCToolkit (VCT), Cyberspace
low-performance and expensive graphics hardware (VRT3) and Rend386. These were
hampered by the
toolkits such as VRT3 and Rend386 available at the time. As a result,
were designed towork without low-end
only flat shading and reducing graphics accelerators, allowing
scene complexity. Rend386 was
Waterloo, Canada. It was distributed developed at the University of
scientists interested in virtual reality. free of charge to encourage the
and assembly code. A PC The toolkit used integer arithmeticcreativity of students and
without a graphics accelerator and a combination of C
second. can render up to 22,000
polygons per
All of the above toolkit
examples are generic and
applications. Modem general-purpose developed for a variety of
Reality Modeling Language toolkits include WorldToolKit (WTK), simulation
Java 3D
for haptic programming and (VRML). Other toolkits include special libraries such and Virtual
PeopleShop, which is primarily used for as his GHOST
Another way to classify toolkits is military simulations.
classify has been summarized in whether they are public domain (free) or
are suitable for his the table 3.1.1 Public proprietary. Toolkit
lab-based VR teaching. Both are domain toolkits such as Java 3D and VRML
used in the VR teaching lab
that accompanies
Augmented Reality / Virtual Reality
3-3
VP Prgrarmring
this book. Own toolkits such as
devices such as WorldTooIKit are bctter documented and support more of his 1/0
trackers, sensor gloves,
price (thousands of dollars in
HMDs, workbenches, ctc. This enhancement comes at a
licensing).
Toolkit
Application /O devices Library size
domain supported
World Tool EDS/Sense8
Kit
General purpose All >1000 Cfunction

Java 3D Sun microsystems


General purpose Mouse, Keyboard Cand Java
GHOST SensAble
Haptics PHANTOM C++
Technologies
PeopleShop Boston dynamics Military Joystick, Mouse CC++

Table 3.1.1 Toolkit summary


VR toolkits follow the author's path. : modeling geometry,
associating objects with input
devices, defining intelligent behavior and providing networks. A common authoring task
required
in both graphics and haptic programming is creating scene diagrams.
3.2 Scene Graph
Ascene graph is a hierarchical organization of objects (visible or not) in a virtual world (or
universe) and aview of that world. Ascene graph represents atree structure with nodes connected
by branches.'
The top node in the hierarchy is the root node and parent for the entire diagram. It connects to
multiple inner nodes /which are parents to other inner or outer nodes. Outer nodes, also called
Ieaves, have no child nodes. Interior nodes represent v1sible objects with their properties
(geometry, appearance, behavior). Interior nodes typically represent transformations that place
child objects in space relative to a root node or other object. Transforms applied to a particular
Internal node affect all its child nodes.
Scene diagrams are not static and change to reflect the current state of the virtual world Such
changes can be due to user input or the behavior of intelligent objects (such as changing the
position 1of the hands ofa virtual clock).
3-4

Augmented Reality /Virtual Reaity


Root node

Internal node
Viewpoint O
node
Ball node
Palm node
OInternal node
Leaf node Thumb node Pinkie node
Scene graph
3.2.1 Before the virual ball is grasped -
Fig.
For example, consider a simulation where a user wears sensor gloves with trackers and tries
grab a virtual ball. Fig. 3.1.1 shows the first scene showing both the virtual hand and the bouncim,

Scene graph, the ball leaf node (which contains geometry and color) is achild
ball. In the
the bounce effect.
inner node whose values change to reflect
After the virtual ball is grabbed, it becomes a child of the palm object, as shown in Fig. 321
Now the parent node inside represents the position inside the palm. In this way, atransform applict
to the palm also affects its children (fingers and ball),. indicating that they move together. Th
tracker worn by the luser
parent node inside the palm represents the deformation caused by the
Root node

Internal node
View point O
node
Ball node
Palm node
O Internal node
Leaf node Thumb node Pinkie node

Fig. 3.2.2 After the ball is grasped - Scene graph

Scene grah updates occur once per frame and affect node attributes. This process hapat
recursively from the root node to the leaves and back to the root node. The down loop n
changing node attributes (including update transforms); and the up loop. Computes the nok
bounding volume. A bounding volume is a bounding box that encloses the virtual obja
represented by a node. A parent node's bounding volume encloses all of its children's bounditg
volumes.
Once the scene graph has been updated, it can be processed by the graphics Pipeline. This
called traversal and new frames are generated. The scene diagram reflects the spatialandtempord

coherence of the sceneand plays an important role in A d d i t i o n a l

speeding up collision detection.

TECHNICAL PUBLICATIONS. an up-thrust


for knowledge
Reality / Virtual
A u g m e n t e d

Reality 3.5 VR Programming


the Scene Graph can speed up the graphics pipeline by allowing the CPUto perforn view frustum
culling.

During the apply phase, the CPU performs intersection checks between parts of the scene
diagram(called subtrees) and the virtual camera's view cone. If the bounding volume surrounding
the subtree is outside the viewing cone, all associated objects will not be visible. Therefore, they
are not sent to the geometry stage of the graphics pipeline for processing. When the bounding
volume intersects the view cone, the object is sent through the graphics pipeline and clipped at the
geometry stage. This hierarchical culling of bounding volumes reduces the armount of computation
and leads to higher refresh rates.

3.3 WorldToolKit

WorldToolkit is one of the oldest toolkits for VR programming. having been introduced in the
early 1990s. Its popularity stems from support of most commercial 1/0 devices (such as trackers.
stereo glasses,and sensing gloves), multiplatform portability (from PCs running Windows, to SGl.
HP, and Sun platforms running some form of Unix), and substantial code examples that facilitate
setting up a new simulation. The toolkit is mostly used for smallto medium-size models owing to
the requirement to fit the entire virtual world on available system RAM memory.
Although many of the early toolkits have disappeared, WTK has grown in functionality and
functions
size (from 400 functions in 1994 to over 1000 functions in its latest release). The WTK
classes include
use an object-oriented naming convention and are organized in classes. These
and others. A special
geometris, nodes, viewpoints, windows, lights, sensors, paths, motion links,
the other objects.
class is the universe, which manages the simulation and contains all

3.3.1 Model Geometry and Appearance


WTK using geometry primitives as well
Virtual object geometry can be created from scratch in
import already created geometry from AutoCAD
as vertices and polygons. Another method is to imported
DXF files. Other file formats that can be
and Pro/Engineer authoring tools that output
created by 3D Studio (.3DS), Wavefront (.0BJ), Multigen (.FLT), and VRML
include those
as the Neutral File Format (.NFF). have. For example, if auser has created a
T
(.WRL), as well the
hand geometry and saved it in a file named 'hand', he can import it into WTK using
Virtual
following command : primitives- sphere and
cone/
/"using geometry

WTgeometry newsphere ():


WIgeometry newcone(); /'custom geometry'l;

WIgeometry begin():
WIgeometry_save(); knowledoe
PUBLICATIONS- an up-thust for
TECHNICAL
toobe included and
Realty/ Vitual
keality nodes in order
declaed as
Aignrsted
must be
properties of its material
geonetry detemined by tlhie
object
Note that appcaranceis he dark surface. Such
Ihe scene
graph. An obiets
andthe
cmissivity of a
glowin
naterial pope
anhient and
difluse
hehting
indexed by the
number of
[Link] be
Contained
materials,
Contained in
the table of
refercnce the
sane material table.
Material

create the
properties

surlace Leometry. If
specified ty
the
Peometies can
Studio, VRML, ete.)
uscd to materal
authoring tool
(3D follows :
if desired)as
modified
loaded and
CUsts, itcan be
WTyeometrynode load(hand);
property of an
object's appearance is its
surface
texture."Textures
Another inportant JPEG formats) and applied to the surface of
imported into WIK (in
RGB, TGA and obyuso
rotated, scaled) and mixed as nceded for example
(moved,
manipulated
Textures can also be
WTmtable load(filoname):
WTmtable_setvalue():

3.3.2 WTK Scene Graph


Fig. 3.3.1 shows an cxan1ple scene diagram implemented in WTK.. At cach frame, the sote
graph moves fromtop to bottom, left to right. So the nodes are traversed in the following orde
node A(root), node B(vicwpoint), node C, ., node J. Viewpoint nodes are traversed before c.
nodes (except the root), so their values affect how all other display objects are displayed in t
scene. WTK allows multiple display windows to cocxist, as shown in Fig. 3.3.2.

Flg. 3.3.1 Scene


graphTraverse order
This allows users to see the
same sccne in multiple vicws.
configuration would be identical except for In such a casc, the S
are different and only the valuc of node B. diaga
the common root node is Alternatively,
kept. In this case, the user
the scene ofit
sarne virtual world (universe). secs different
parts

In Fig. 3.3.1, nodes


F, G, H, andI are
Since node Fis
traversed first, its value cansiblings becausc they share the samc parent nodde b
(E
scene. Because it is
diflicult for programmers affect how its visible siblings are in displayed

to anticipate all t r a n s l a t i

these cffects, WTK uses


TECHNICAL PUBLICATIONS)
A u g m e n t e d Reality / Virtual Reality 3-7 VRProgramming
nodes to simplify the creation of scene diagrams. Movable nodes are self-contained structures that
separate, transform and group content (geometry, light, level of detail) nodes. Detached nodes
prevent the value of a transform node from affecting the values of other movable nodes it passes
through.
Scene graph for window 1
Scene graph for window 2

H H

Fig. 3.3.2 WTK scene graph - multiple scene graphs

Multiple mobile nodes can be connected hierarchically, as shown in Fig. 3.3.3. Here we build a
virtual hand using movable nodes. The mobile plmar joints are superior to the thumb, 1index
finger, middle finger, ring and small proximal mobile joints. The proximal movable thumb knot is
superior to the distal movable thumb knot and the proximal index knot is superior to the
intermediate movable index knot. (Refer Fig.3.3.3 on nextpage)
The lowest node in the hierarchy is the finger distal mobile node. If the geometry for each of
these hand segments exists (e.g. in NFF format), it must first be loaded into WTK. Next, create a
scene graph by attaching movable nodes, as in the following example.
/*load hand model geometry*/
Palm = Wtmovnode load(Root, "[Link]," 1.0);
ThumbProximal= WTmovnode load(Palm, "[Link],"'1.0);
ThumbDistal=WTmovnode load ThumbProximal, "[Link],"1.0);
IndexxProximal=Wtmovnode load(Palm,'[Link],"1.0);

IndexMiddle=WImovnode load(IndedProximal,"[Link],"1.0);
IndexDistal=WInovnode load(IndexMiddle, "[Link],"1.0);
MiddleProximal=WTmovnode load(Palm,"Middle [Link],"'1.0);
MiddleMiddle=WTmovnode load(Palm,'[Link]," 1.0);
'[Link],"1.0):
MiddleDistal= Wtrmovnode load(MiddleMiddle,
RingProximal=WTmovnode load(Palm,"[Link],"1.0);
load(RingProximal,"[Link], "1.0):
RingMiddle =WTmovnode
ingDistal =Wtmovnode load(RingMiddle,"RingDistal.
nff, "1.0);
DmalProximal=WTnovnode load(Palm,"[Link],"1.0);
'[Link],"1.0):
OmalMiddle =Wtmovnode load(Smal Proximal,
load(SmallMiddle,:[Link], "1.0);
OmallDistal =WTnovnode

TECHNICAL PUBLICATIONS- an up-thrust for knowledge


VR Programming
3-8

Augmented Reality
/ Vitual Reality
Parent node

Separator

Palm

(Transform) Content

Movable node
Separator Middle proximal
Separator
Thumb proximal/
(Transform) Content
Transform) Content

(Separator
Index proximal
Separator (Transform Content

(Transfom Content

Separator
Thumbdistal
Index middle
(Transform) Content

Separator
Index distal|
Transform Content

Fig. 3.3.3 WTK movable nodes to construct a virtual hand


/*construct scene graph"/
Wtmovnode _attach(Palm, Thumbproximal);
Wtmovnode_attach(Thumbproximal,ThumbDistal);
Wtmovnode _attach(Palm,IndexProximal);
Wtmovnode_attach([ndexProximal, IndexMiddle);
Wtmovnode_attach(IndexMiddle, índexDistal);
Wtmovnode_attach(Palm,MiddleProximal);
Wtmovnode attach(MiddleProximal, MiddleMiddle);
Wtmovnode attach(MiddleMiddle, MiddleDistal);
Wtmovnode_attach(Palm, RingProximal);
Wtmovnode_attach(Ring Proximal, RingMiddle);
A i e n t e d
Reality /Virtual Reality VR Progranning
3-9
Wmovnode attach(RingMiddle,.RingDistal);
Wtmovnode attach(palm,,SmallProximal)
Wnovnode attach(SmallProximal,SmallMiddle);
Wtmovnode attach(SmallMiddle.e, SmallDistal);

3.3.3 Sensors and Action Functions


Assume that the universe exists at this noint and that there are various objccts (ayham
static). This Is accomplished by successively calling WTuniversenew() to initialize the untverSe,
then WTuniverseload(filename) to load each world to be simulated. Then the WTK function
WTuniversego) starts the simulation loop (infinite iterations) and ends it with WTuniversestop.
During simulation, user input is sampled via input devices, s0-called sensors. This input is read
in real time every W
TK simulation cycle tóminimize latency, The data is then used to update the
virtual object's position, shape, velocity,etc. The resulting scene is graphically displayed on the
user's girlfriend's HMD or other display. Acoustic and haptic feedbacks are also displayed.
Sequencing or scheduling all these events in real time is a significant programming task handled by
the underlying toolkit functions.
Universes have custom action functions that are called before the current frame is rendered.
These action functions are set with the WTuniversesetaction call, allowing the application to
control the simulation. Each graphical virtual object can also perform his one-time task per frame.
Examples of action features are collision detection and collision reaction (via acoustic, tactile,
or graphical feedback). Tasks are specified by WTobjectsettask and model object behavior. Finally
the universe is rendered and the loop starts a new cycle by reading the' 1/0 device (sensor). The
resulting simulation real-time loop is shown in Fig. 3.3.4. Consider the specific case of an
immersive simulation where the user navigates with a trackball. In this case, we need to monitor
two external sensors.
One of these is his HMD tracker (believed to be the Polhemus tracker) that controls his view of
the universe. Another sensor is a trackball (perhaps a spaceball) that changes the position of your
viewpoint in space. WTK treats sensors as objects that produce position, orientation and other
types of data by reading real-world inputs.
When asensor is created, it is automatically managed by the Simulation Manager as well as the
graphic object to which the sensor is attached. Sensor objects can be created using the generic
function WTsensomew or WTK device-specific macros. These include WTpolhemusnew() for
Polhemus trackers and WTspaceballnew() for Space Ball trackballs. The sensor objects
Polhemus and "Ball" are casily created.

TECHNICAL PUBLICATIONS "an up-thrust for knowledge


Ainjerted Fieality / Virtust feealily

the 6einl o t 2"/


bail tra kiail to
Ia vtegarebali ew(i.EIAIL2),

To enter simulation loop

furnctioris Calls
Unnere's acion

sonsor input
Objects arsupdated witth

Graphical objets porforn tasks

Universe is rendered

To exit simulation loop

Fig. 3.3.4WTK simulation loop


view with the externa
The WTKWT View Poirt Addressor() function associates a simulation
viewpoint, each serisors
sensor that controls it. When mutiple sensors are connectcd to a single
always has only oe
input affects the current position and orientation of the viewpoint. A uníverse
function. So you hav
active viewpoint, which is accessed through the WTuniverse getviewpoint()
to call the two sensors in succession. Hlere's a small example that integrates these sensorS
shows the encoding of the runtime loop.
mair){
WTsenaor "potsetnus, "ball
WTne ° r t , BCer;
/°iritialize the universe/
WTursver se_rew(WTDISPLAY_DEFUALT, WINDOW_DEFUALT)
f° iroad sere atd lik to rot rode/
RWIvetse gstroBs);
sCELe WTnode_osdro, "nyaniverse," 1.0);
attachthe Poite uus tracker to the serial port1/
pterRIS WTpliemus _tiw(SERIAL1).
/attach the pae all trackhaü to the sorial port 2|

TECHIICAL PUBLICA TIOS an up-thrust for knowledge


Augmented Reality / Virtual Reality 3- 11 VR Programming
ball-WTspaceball new(SERIAL2);
/*attach viewpoints*/
WTviewpoint addressor(WTuniverse getviewpoint().polhemus):
WIviewpoint addressor(WTuniverse getviewpoint(),spaceball);
s t a r t the simulation*/

WTuniverse_ready();

WTuniverse_go():

/'stop the simulation when user presser a button on the trackball"/


WTuniverse_delete():

return();

B.4 WTK Networking


WTK provides networking through the World2World library extensions. Unlike typical
communication
client/server architecture where the server handles both administrative and data
tasks. World2 World uses a two-tier client/server architecture.
multiple simulation servers. The Server
Server tasks are split between the Server Manager and
Manager is the first point of contact for new
clients (users) requesting a connection to the
simulation servers
authenticated, it is assigned to her one of the
simulation. As soon as the client is
tasks. This way, the simulation will not be interrupted when new customers
for further simulation
join the user pool. the
in a number of virtual objects after being handed over to
Customers register their interest by
then manages the distribution of shared properties
server
simulation server. The simulation server can grant locks on shared
the simulation
clients. In addition,
sending updates to interested clients that lock a shared set of objects can
first-served basis. Only
object sets on a first-come, status
clients interested in the same object will receive
change the properties of
those objects. Other
server.
continue to be sent by the simulation
updates and will
layered on top of the UDP internet protocol.
communication protocol is communication because the
The World2 World used for client/server
protocol
the TCP/IP best-effort communication protocol and,
UDP has lower traffic than Therefore, UDP is a
acknowledged. World2World solves this
data packets are not data will be received corectly.
guarantee that data is
unlike TCP/IP, it does not
new data packets and sending them when
into World2World uses a
reduce simulation delays,
acknowledgments

problem by bundling
updates sent and
reckoning
received, To reduce the number of
estimate intermediate positions using dead
applications to
global Sync time. This allows
Or smoothing algorithms.

knowledge
CATIONS®. an up-thrust for
3- 12
VR Proga

AupmentedReality
/ Vitual Reality
Java has become the
3.5 JAVA3D Microsystems
in the
mid-1990s,

distributed applications. Java


prograt
by Sun highly
of interactive 3D graphics
intrduced p l a t f o r m - i n d e p e n d e n t ,

of choice for programming


Java 3[D uses
appica
CT ironncnt

APIs
developdfor
object-oriented

passing using
WTK. Like
WTK, low-level
the Java
shown the
message
accelerators
graphics that implenent
Fig 351 functions and
the
library
download from
the Internet.
and Direct3D graphics
WTK. Java 3D
is a free
hosever, unlike New client

Server Simulation server 2


Simulation manager
server 1

Client Client
Cient Clent with lock

VIrtual world Information


Information

Fig. 3.5.1 Message passing using WTK

3.5.1 Model Geometry and Appearance


whichs
The 3D shape and appearance of anobject is specified by the Java 3D class Shape3D,
an extension of the leaf nodes of the scene graph. Certain values in the Shape3D)class are set
functions called methods setGeometry0 and setAppearance(). Geometry can be created m
scratch using points, lines, triangles, boxes, arrays,etc. For example, if the geometry was Crea
using a triangle array,
/Create list of 3D coordinates for vertices*/
point3() mycoords ={
new Point3f 0.0f,0.0f,0.0f, ....

/Create list of vertex normals for lighting"/


Vector3() TayNormals = {
new Vectors3f 0.0f,0.0f,0.0f, .

/Create the triangle aray"/


triangleArray mylris new TriangleArray

TECHNICAL PUBLICATIONS -an


up-thrust for knowledge
Reality / Virtual Reality
3-13 VR Proqramring
myCoords length,
(teometiyAiray. COORDINATES
GeotryAnay.
.NORMALS),
nyTis setCoordinates(0, myCoords),
setNomals(0, myNormals),
/Assenmble the shape/
myyShape = new
Shape3D
Shape3D
(myTris, myAppeat).
Another way tosct the object
geomctry is to files in formats such as 3DS. DXF, NFF,
WRL. Importing geometry is done through a import
method called a loader. Java 3D provides loaders for
geometry created with the Lightwave and
formats, such as those created by WTK and VRMI
Wavefront authoring tools. Loaders for other file
can he downloaded for free tron
[Link]'utilities [Link].
The loader adds the contents of the loaded file as a single
object to the scene graph. Ir tne oojc
geometry needs to be segmented to preserve the inherent parent-child dependencies of the object
geometry, the parts must be called separately through subsequent method calls. Consider the case
of a hand in a virtual hand geometry file. wrl created in VRML. To access that part (fingers). you
need to:
add fle to scene graph/
Scene Sc=[Link]('[Link]);
BranchGroup Bg=[Link]():
/'access to the finger subparts of the loaded model"/
Thumb=[Link] Child(0):
Index-Bg-getChild(1)
Middle =[Link] (2)
Ring=[Link](3);
Small =[Link] (4);

The object's appearance (color, rendering mode, texture, transparency) is specitied by the Java
FD Appearance() class. These material and texture attributes need to be defined first and then
gTouped to form a new appearance as in

Mat=new Material():
Mat setDiffuseColor(r.g.b):
[Link] Color(r.g,b);
Mat setSpecularColor(r.g.b);
import texture file"/
Texdd= new textureLoader('checkered jpg..
Tex=TexlLd getTexture():
createtthe appearance and set it'/
Appr=new Appearance[%

TECHNICAL
PUBLICATIONS® an up-thrust for knowledye
3-14
VR Program
Reality
Augmented
Reality/ Virtual

A p p r . s e t M a t e r i a l ( M a t ) ;

[Link](Tex);

[Link](Appr);

3.6 Java 3D Scene Graph Avirtual world or diagram.


components of a Java 3D scene univer
Fig. 3.6.1 shows the main application. It has a locale node that anchin
typically one per
has a collection of scene graphs, associated with a locale are
live and
multiple branch diagrams to
the world. Only topics
process.
therefor:
branch diagram reverses the
rendered in the scene. Deleting the
Virtual
universe

Behavior
Locale
View
Content
branch branch
Behavior
handler
code
BranchGroup BranchGroup
Ambient
light
Dir.
TransformGroup light
TransformGroup)
TransformGroup/TransformGroup/TransformGroup/

ViewPlatform
ViewCanvassD)
Shape3D Shape3D Shape3D

Appearance Geometry Appearance Geometry Physical Physical


environment
body
Fig. 3.6.1 Java 3D Scene graph

Each branch graph has a group node called BranchGroup that defines
and acts like the glue that holds the elements of the branch together. A compatible subgraphs
places and group node
aligns leaf nodes into atransformation group node. Aswitch node allows you
to choose between
multiple subgraphs within a group and specify the level ofc detail. Finally, the
set determine the order in which branch leaf nodes (objects) are nodes in the ordered
rendered.
Java 3D's scene graph traversal order is less structured: Leaf nodes have Therefore, unlike WTK.
no child nodes
contain information or reference node component objects. A and either
very important leaf.
ViewPlatfom which sets the position and orientation of the virtual camera in the node is the
world. The Java
·TECHNICAL PUBLICATIONS an up-thrust for knowlere
nming d Reality/
A u g m e n t e d

Virtual Reality
3-15
3D application
manipulates
the value of VR Programming
through the virtual
world.. A his
form a Java
ViewPlatform node to allow the user to navigate
ViewPlatform together
3D
platform-independent with a View objcct (described later in this
chapter)

3D
erse
Shape3D leaf nodes
contain information view model.
(described above), as well
as the
about the virtual object's geometry and appearance
Ors bounding box needed for collision detection. Other leaf nodes
ore specify lighting conditions (ambient, point, directional),
background colors. predefined behaviors, fog and universe
If we need to add a virtual hand
to the virtual
into the scene graph. The
world, we need to load that her VRML WRL file
following example shows howto
individually and how to define a load each segment of the virtual hand
parent-child hierarchy between these segments (nodes).
B.6.1 Sensors and Behaviors
Input for simulations programmed in Java 3D is
provided via a set of 6DOF input deyices
Specified in the physics environment" class, Unlike WTK, Java 3D does not
support trackers or
other VR-specific input devices. Instead, the APIprovides an input device interface with which
device drivers (written in CICt+ by developers) must be linked. Users then define methods for
opening, closing and reading a particular device, as wellas setting and querying its status.
The above approach is taken to preserve the independence and versatility of the Java 3D
platform as a high-level graphics API. This generality is illustrated by the fact that input device
interfaces accept data from both real and virtual devices. This allows the simulation to be driven by
data stored in files, as is normally done when replaying user actions. Alternatively, the simulation
can read data from a network connection (remote sensing). Finally, the user can create a
"ranslator" between 2D mouse data and 6D tracker data, turning the mouse
into a virtual tracker

device.
sensor objects are associated with each input device object. The latest data from
One or more
buffer. The
sensor obiect is contained in a series of SensorRead objects placed in a circular
each
obiect contains his 6DOF data (or less) with a timestamp and an integer array of
SensorRead
simplifies the task of averaging sensor data and making predictions
pushbutton, values. Java 3D button value indicates whether the
time-stamped data. The
based on existing data by providing trigger state.
button-down state, or
button is in button-down state, Java
graphic and audio displays are linked to
devices and output to
Input from simulated input graphics display(CRT, Stereo HMD or
CAVE) used
3D View objects. This describes the type of
vicew has one or more Canvas3D obiects
PhysicalEnvironment. Each
specified by
e Simulation
knowledge
PUBLICATIONS- an up-thrust for
uCAA
Aiyt Aeaih/\itval Reaty
part of the
VROj at
which it is drawn. Thus area is display's
arcaN in
nat seltthe sorvn initial position relative to the
The Vicw objcct also describes the user's
Sereen3
availability and position as determined by the display policy.
and the tracker's
(such as height and IPD) are specificd by
the PhysicallBody.
Charactersthes

Virtual
univerSe

Behavior
Content Locale View
branch branch
Behavior
handler
code
BranchCGroup BranchGroup
Ambrent
aght
Dir.
TransformGroup light
TransformGroup/
TransformGroup TransformGroup TransformGroup/

Shape3D Shape3D Shape3D ViewPlatform

AppearanceGeometry AppearanceGeometry

Vew Canvas3D Viewarvas

Physical Physical Physica


body environment Physical environment

body
Fig. 3.6.2. Java 3D scene
graph for single
ViewPlatform node and multiple views
Augmented Reality / Virtual Reality
3-17
VR Programming
Virtual
universe
Behavior

Content
Behavior branch Locale View
handle branch
code

BranchGroup
Ambient BranchGroup
light
TransfomGroup Dir.
light
TransformGroup,
TransformGroup TransformGroup TransformGroup

Shape3D Shape3D Shape3D ViewPlatform ViewPlatform

AppearanceGeometry Appearance Geometry

ViewCanvas3D ViewCanvas3D

Physical Physical Physica Physical


body environment body environment

Fig. 3.6.3 Java 3D scene graph for multiple ViewPlatform nodes


This View model provides a clean separation between the virtual world (provided by the
ViewPlatform node) and the actual he 1/0 device used for interaction. This separation allows
simulation code tobe preserved even if the l/0device changes and iscentral to Java 3D portability.
Multiple users can be tracked simultaneously and assigned to the same location in the virtual
world. This is the case shown in Fig. 3.6.2, with multiple views and his ViewPlatform. Conversely.
one user can control multiple ViewPlatforms, as shown in Fig. 3.6.3. Each ViewPlatform node has
its own Her View (and Screen3D), llowing the user to teleport between remote locations in the
virtual world, each corresponding to a different ViewPlatform.
AViewPlatform node has an activation radius that represents the adjacent area of the virtual
world. Reposition the activation radius as the user moves through the simulation. Java 3D
Tecognizes when the activation radius intersects the planned boundary of the virtual object that
Tepresents the motion. These are user-specified bounding volumes (such as spheres or boxes) that
Surround objects with behaviors. An intersection with the ViewPlatform activation radius triggers a
knowledoe
TECHNICAL PUBLICATIONS an up-thrust for
3-18 VR Progamn
Reality
Augmented Reality / Virtual as long as they are scheduled,
Behaviorsthen run

Wake of the
user-specified
behavior.
animations,
transform
changes and SO On.
level
Multiple operalions
result in scene graphchanges,
other. Aspecial behavior is of
detail, which
interfering with each and
Tùn in parallel without ViewPlatform position
the calculate he
generalized by the Java
3D class LOD. Track appropriate child node of the dislat
This distance isassigned to the switch no
to the object surface. distance-based
switching of object level of detail.
The DistanceLOD class implements

3.7 Java 3D Networking


an integrated solution for networked
virtual environments, but
rele
Java 3D does not provide 3D applications to run
capabilities. This allows Java as applets o
onwebJava's
pagespowerful networking
or as standalone applications. The Virtual Reality Transfer Protocol (VRTP) Cuen
addresses the need to reduce the development effort required to create 3D--enabled websts
Currently under research, VRTP combines desktop-optimized client/server and peer-0-8
communication, It includes a region of interest management layer similar to WTK and supports te
distribution of VRML and Java 3D scene diagrams.

3.8 WTK and Java 3D Performance Comparison


A number of tests were performed , in order to compare the performance of WTK (Release 9
and Java 3D (version 1.3 Beta 1). The rendering was done by a Wildcat 4110 graphics acceleran
with 64 MB of frame buffer memory and 64 MB of texture memory. The board was installed on
dual Pentium II933-MHz PC with 512 MB of RAMrunning under Windows NT 4.0.
In this test, latency was measured as the time between user input (tracker position change) aot
simulation response (rendered scene change). As can be seen, system latency increased with seas
complexity and number of light sources. For scenes with less than l5,000 polygons, WI
produced lower system latency than Java 3D.
However, Java 3D has faster system response for high polygon count scenes. System late
with Java 3D and a single light source was fairly constant (50 ms) as long as the Scene contained
.40,000polygons or less. By comparison, WTK had a significant increase in system
latenc),
80 ms for 40,000 polygons (for scenes with light sources). This represents his 60-degree "
gradatir
in system response compared to Java 3D renderings with identical scenes and identical hardwu
settings.
Finally, a test was run to determine the variation in frame render times over a 200 frum
sequence, These tests measure the time it takes the graphics pipeline to render a new frame whe
all other factors (polygon count, rendering mode, number of lights, user input) are held consta!
hottom. The frame render times fora complex scene of approximately 50,000 polygons renderedi
stereo and Gouraud shading with 5lights. As you can see from the graph, WTK has less variatit
(smaller standard deviation) than Java 3D.

TECHNICAL PUBLICATIONS an
up-thrust for
Augmented Reality / Virtual Reality 3-19
VR Programning

Note thatthe Java 3D version tested here is a improvement over


the previous
significant "garbage collection"
which had more variation
version, in frame render times. However, due to the
Java 3D version 1.3 Betal times and
mechanism, can result in significantly longer frame rendering effect
spikes.
These spikes can cause occasional freczes in graphics scenes, having an undesirable
on
simulation interactivity and user immersion.
the
The WTK and Java 3D toolkits primarily support graphics and 3D sound feedback. Leave
emerged specifically
haptic integration to the application developer. In recent years, toolkits have conjunction
designed to support commercial haptic interfaces. These include VirtualHand used in
for interacting with
with CyberGrasp and CyberTouch haptic gloves, and a user interface toolkit
PHANToM. Another such toolkit is the General Haptics Open Software Toolkit (GHOST).

B8.1 HOST Integration with the Graphics Pipeline


OpenGL-based graphics
GHOST makes it easy to programhaptic effects in simulations that use
processes.
pipelines. The VR engine renders the graphics and haptic rendering pipelines as separate
own dedicated CPU.
Due to the high computational overhead, each pipeline preferably has its
about 30 times per second,
AVR application models a graphical scene graph that iterates
communicating with haptic processes as needed. The haptic loop
contains another scene graph that
the hapticscene diagram and
is traversed 1000 times per second. GHOST manages both traversing
running on the PHANToM
communicating with application processes. Send input toa servo loop
event occurs, a message is
control electronics (part of the haptic interface itself). When a haptic
function.
sent to your application using a graphical callback
3.9 Two Marks Questions with Answers
0.1 Define API.
Programming Interface (API)-based way of
Ans. : An authoring environment is an Application
interact with the created world in
creating virtual worlds. A runtime environment allows users to
real time.
Q.2 What is toolkit ?
functionality developed for the VR
Ans. : Toolkits are extensible libraries of object-oriented
specification. Asimulated object is part of aclass and
inherits its default attributes, simplifving
he programming task.
0.3 toolkits.
List the general purpose
Ans. : Modern general-purpose toolkits
include WorldToolKit (WTK), Java 3D and Virtual
Language (VRML).
Other toolkits include special libraries such as his
Reality Modeling

PUBLICATIONS-an up-thrust for knowledge


TECHNICAL

You might also like