PC-based Telerehabilitation System with Force Feedback

Report
Electrical and Computer Engineering Dept.
VR PROGRAMMING
VR Toolkits
System architecture
VR Programming Toolkits
 Are extensible libraries of object-oriented functions
designed to help the VR developer;
 Support various common i/o devices used in VR (so
drivers need not be written by the developer);
 Allow import of CAD models (saves time), editing of
shapes, specifying object hierarchies, collision detection
and multi-level of detail, shading and texturing, run-time
management;
 Have built-in networking functions for multi-user
interactions, etc.
VR Toolkits can be classified by:
 Whether text-based or graphical-programming;
 The type of language used and the library size;
 The type of i/o devices supported;
 The type of rendering supported;
 Whether general-purpose or application specific;
 Whether proprietary (more functionality, better
documented) or public domain (free, but less
documentation and functionality)
VR Toolkits in Early ‘90s
RenderWare (Cannon), VRT3/Superscape (Dimension
Ltd.), Cyberspace Developer Kit (Autodesk), Cosmo
Authoring Tool (SGI/Platinum/CA), Rend386 and others;
 They allowed either text-based programming
(RenderWare, CDK and Rend386), or graphical
programming (Superscape and Cosmo);
 They were platform-independent and generally did not
require graphics acceleration hardware;
 As a result they tended to use “low-end” I/o devices
(mouse) and to support flat shading to maintain fast
rendering.

Rend386 scene
VR Toolkits discussed in this chapter
Name
Application
Java3D
(Sun Microsystems)
General Purpose
no
Vizard Toolkit and
General Purpose
PeoplePak (WorldViz) avatar extension
yes
GHOST (SensAble
Technologies)
Haptics for
Phantom
yes
C++
Military/civilian
yes
C/C++
Game engine
yes
C++
PeopleShop
(Boston Dynamics)
3DGame Studio
Proprietary Library size language
Implemented in C
Programming in Java
19 packages, 275 classes
OpenGL-based
Python scripting
language
The scene graph:
Is a hierarchical organization of objects (visible or not) in the
virtual world (or “universe”) together with the view to that world;
 Scene graphs are represented by a tree structure, with nodes
connected by branches.
 Visible objects are represented by external nodes, which are
called leafs (they have no children). Example nodes F, G, H, I
 Internal nodes represent transformations (which apply to all their
children)
Root node

A
B
Internal node
C
D
E
J
F
G
H
External node
I
Scene graphs are not static
Scene
palm
Ball
Scene graph shows that
the ball is a child of “scene”
Scene
palm
Ball
Scene graph has been modified, such that
the ball is now a child of the palm
VC 6.1
on book
CD
Model Geometry
Define scene graph
Authoring
(Modeling)
Stages
Define and link
sensors
Define action
functions
Define networking
Start Simulation
Run-time loop
Update Objects
(from sensors and
intelligent actions
Render scene
(graphics, audio,
haptics)
Exit Simulation
Repeats every frame
Read Sensor Data
VR Toolkits discussed in this chapter
Name
Application
Java3D
(Sun Microsystems)
General Purpose
Vizard and
General Purpose
PeoplePak (WorldViz) avatar extension
GHOST (SensAble
Technologies)
PeopleShop
(Boston Dynamics)
3DGame Studio
Proprietary Library size language
no
yes
Implemented in C
Programming in Java
19 packages, 275 classes
OpenGL-based
Python scripting
language
Haptics for
Phantom
yes
C++
Military/civilian
yes
C/C++
Game engine
yes
C++
Java and Java 3D
Java
 object oriented programming language
 developed for network applications
 platform independence
 slower than C/C++
 Java 3D
 Java hierarchy of classes that serves as an interface to 3D
graphics rendering and sound rendering systems
 Perfectly integrated with Java
 Strong object oriented architecture
 Powerful 3D graphics API

Model Geometry
Define scene graph
Java 3D
Initiation
Setup sensors
Define behaviors
Networking
Model Geometry
Define scene graph
Java 3D
Initiation
Setup sensors
Define behaviors
Networking
Java 3D geometry:
Geometry can be imported
from various file formats
(e.g. 3DS, DXF, LWS, NFF,
OBJ, VRT, VTK, WRL)
 Can be created as a
primitive geometry (e.g.
sphere, cone, cylinder, …)
 Custom geometry created
by specifying the vertices,
edges, normals, texture
coordinates using specially
defined classes

Imported geometry
loader.load(“Hand.wrl")
Geometry primitive:
new Sphere(radius)
Custom geometry:
new GeometryArray(…)
new LineArray(…)
new QuadArray(…)
new TriangleArray(…)
Java 3D object
appearance:
The appearance of a
geometry is specified using
an appearance object
 An appearance-class object
stores information about the
material (diffuse, specular,
shininess, opacity, …) and
texture

Mat = new Material();
Mat.setDiffuseColor(r, g, b);
Mat.setAmbientColor(r, g, b);
Mat.setSpecularColor(r, g, b);
TexLd = new TextureLoader(“checkered.jpg”,
...);
Tex = TexLd.getTexture();
Appr = new Appearance();
Appr.setMaterial(Mat);
Appr.setTexture(Text);
Geom.setAppearance(Appr)
Model Geometry
Define scene graph
Java 3D
Initiation
Setup sensors
Define behaviors
Networking
Java3D node types:
BranchGroup
Group
TransformGroup
Switch
Node
Compilable sub-graph
Select which of the children are visible (useful for LOD)
Background
Behavior
Fog
Transform + child nodes
Universe background. Can be a color or an image
Actions to be performed by the simulation
Fog node
Leaf
Light
Light node. Special derived classes: AmbientLight, PointLight,
DirectionalLight
Shape3D
Geometry + Appearance + BoundingBox
Java3D scene graph
Node
Loading objects from files
Java3D offers by default support for Lightwave and Wavefront
model files
 Loaders for other file formats can be downloaded for free from
the web http://www.j3d.org/utilities/loaders.html
 Loaders add the content of the read file to the scene graph as a
single object. However, they provide functions to access the
subparts individually

Universe
Root
Cube
Sphere
Thumb
Hand
Index
Middle
Ring
Small
Java3D model loading
Adding the model to the scene graph
Scene Sc = loader.load(“Hand.wrl”);
BranchGroup Bg = Sc.getSceneGroup();
RootNode.addChild(Bg);
Accessing subparts of the loaded model
Scene Sc = loader.load(“Hand.wrl”);
BranchGroup Bg = Sc.getSceneGroup();
Thumb = Bg.getChild(0);
Index = Bg.getChild(1);
Middle = Bg.getChild(2);
Ring = Bg.getChild(3);
Small = Bg.getChild(4);
Java3D virtual hand loading:
Palm = loader.load("Palm.wrl").getSceneGroup();
ThumbProximal = loader.load("ThumbProximal.wrl").getSceneGroup();
ThumbDistal = loader.load("ThumbDistal.wrl").getSceneGroup();
IndexProximal = loader.load("IndexProximal.wrl").getSceneGroup();
IndexMiddle = loader.load("IndexMiddle.wrl").getSceneGroup();
IndexDistal = loader.load("IndexDistal.wrl").getSceneGroup();
MiddleProximal = loader.load("MiddleProximal.wrl").getSceneGroup();
MiddleMiddle = loader.load("MiddleMiddle.wrl").getSceneGroup();
MiddleDistal = loader.load("MiddleDistal.wrl").getSceneGroup();
RingProximal = loader.load("RingProximal.wrl").getSceneGroup();
RingMiddle = loader.load("RingMiddle.wrl").getSceneGroup();
RingDistal = loader.load("RingDistal.wrl").getSceneGroup();
SmallProximal = loader.load("SmallProximal.wrl").getSceneGroup();
SmallMiddle = loader.load("SmallMiddle.wrl").getSceneGroup();
SmallDistal = loader.load("SmallDistal.wrl").getSceneGroup();
Java3D virtual hand hierarchy:
Palm.addchild(ThumbProximal );
ThumbProximal .addchild(ThumbDistal );
Palm.addchild(IndexProximal );
IndexProximal .addchild(IndexMiddle );
IndexMiddle .addchild(IndexDistal );
Palm.addchild(MiddleProximal );
MiddleProximal .addchild(MiddleMiddle );
MiddleMiddle .addchild(MiddleDistal );
Palm.addchild(RingProximal );
RingProximal .addchild(RingMiddle );
RingMiddle .addchild(RingDistal );
Palm.addchild(SmallProximal );
SmallProximal .addchild(SmallMiddle );
SmallMiddle .addchild(SmallDistal );
Model Geometry
Java3D
Initiation
Define scene graph
Setup sensors
Define behaviors
Networking
Input devices in Java3D
The only input devices supported by Java3D are the mouse and
the keyboard
 The integration of the input devices currently used in VR
applications (position sensors, track balls, joysticks, sensing
gloves…) relies entirely on the developer
 Usually the drivers are written in C/C++. One needs either to rewrite the driver using Java or use JNI (Java Native Interface) to
call the C/C++ version of the driver. The latter solution is more
desirable.
 Java3D provides a nice general purpose input device interface
that can be used to integrate sensors. However, many times
developers prefer custom made approaches

Java3D General purpose sensor interface
class PhysicalEnvironment - stores information about all the input devices
and sensors involved in the simulation
class InputDevice - interface for an input device driver
class Sensor - class for objects that provide real time data
One input device can provide one or more sensors
A sensors object needs not be in relation with an input device (VRML style sensors)
PhysicalEnvironment
InputDevices
Sensors
Model Geometry
Java3D
Initiation
Define scene graph
Setup sensors
Animating the scene
Networking
Java3D - Animating the simulation
Java3D offers Behavior objects for controlling the simulation
 A Behavior object contains a set of actions performed when the object receives
a stimulus
 A stimulus is sent by a WakeupCondition object
 Some wakeup classes:

WakeupOnCollisionEntry
WakeupOnCollisionExit
WakeupOnCollisionMovement
WakeupOnElapsedFrames
WakeupOnElapsedTime
WakeupOnSensorEntry
WakeupOnSensorExit
WakeupOnViewPlatformEntry
WakeupOnViewPlatformExit
Java3D - Behavior usage
Universe
Root
• We define a behavior Bhv that rotates the
sphere by 1 degree
• We want this behavior to be called each
frame so that the sphere will be spinning
WakeupOnElapsedFrames Wup = new WakeupOnElapsedFrames(0);
Bhv.wakeupOn(Wup);
VC 6.3 on book CD
VC 6.4 on book CD
The Java 3D View object describes the graphics display used in the
simulation, as well as the user’s position versus that display (given
by the tracker);
 The View model provides a separation between the virtual world
provided by the ViewPlatform node and the real I/O devices used in
the interaction; This separation helps portability.
 Several users that are tracked
can be mapped to the same
location in the virtual world. This
corresponds to several Views and
a single ViewPlatform;
 Conversely, a single user can control several ViewPlatforms;
 This corresponds to several Views since each ViewPlatform has its own View;
Thus a single user can have several Views to a virtual world, and can “teleport”
between them. Thus a single user can have several Views to a virtual world, and
can “teleport” between them.
View platform 1
View platform 2
Model Geometry
Java3D
Initiation
Define scene graph
Setup sensors
Define behaviors
Networking
Java3D - Networking
Java3D does not provide a built-in solution for networked virtual environments
 However, it’s perfect integration in the Java language allows the developer to
use the powerful network features offered by Java
 Java3D applications can run as stand alone applications or as applets in a web
browser

Server
Java3D
simulation
Java3D
simulation
Java3D
simulation
Java
Applet
Java
Application
Java
Applet
Java3D
simulation
Java
Application
Java3D and VRML
VRML provides possibilities for defining the objects and
animating the objects in a virtual world
 Graphics APIs such as Java3D or WTK load from a VRML file
only the static information, ignoring the sensors, routes, scripts,
etc.
 Java3D structure is general enough to make the import of
sensors and routes possible but currently we are not aware of any
loader that does it
 One of the most popular library of Java3D loaders is the NCSA
Portfolio (http://www.ncsa.uiuc.edu/~srp/Java3D/portfolio/)

NCSA Portfolio
Offers loaders for several model
files
3D Studio (3DS)
 TrueSpace COB loader (COB)
 Java 3D Digital Elevation Map (DEM)
 AutoCAD (DXF )
 Imagine (IOB)
 Lightwave (LWS)
 Sense8 (NFF )
 Wavefront (OBJ)
 Protein Data Bank (PDB)
 Visualization Toolkit (VTK)
 VRML97

Loades the following parts of
VRML97 files
Appearance
 Box
 Coordinate
 Collision (for grouping only)
 Group
 IndexedFaceSet
 IndexedLineSet
 Material
 Normal
 Shape
 Sphere
 Transform

Java3D on-line resources
http://java.sun.com/products/java-media/3D/index.html
 http://www.j3d.org
 http://www.ncsa.uiuc.edu/~srp/Java3D/portfolio/

Comparison between Java3D and WTK
 A comparative
study was done at Rutgers between Java3d
(Version 1.3beta 1) and WTK (Release 9);
 The simulation ran on a dual Pentium III 933 MHz PC (Dell)
with 512 Mbytes RAM, with an Wildcat 4110 graphics accelerator
which had 64 Mbytes RAM;
 The I/o interfaces were a Polhemus Insidetrack or the Rutgers
Master II force feedback glove;
 The scene consisted of several 420-polygon spheres and a virtual
hand with 2,270 polygons;
 The spheres rotated constantly around an arbitrary axis, while
the hand was either rotating, or driven by the user.
Java3D –WTK Comparison
Graphics scene used in experiments
Comparison between Java3D and WTK
The simulation variables used to judged performance were:
 graphic mode (monoscopic, stereoscopic),
 rendering mode (wireframe, Gouraud, textured);
 scene complexity (number of polygons 5,000 – 50,000);
 lighting (number of light sources 1, 5, 10);
 interactivity (no interaction, hand input, force feedback)

Java3D –WTK Comparison
Java3d is faster on average than WTK, but has higher variability
Java3D –WTK Comparison
Java3d Release 3.1 Beta 1 has less system latencies than WTK Release 9
But Java3d has more variability in the scene rendering time
WTK does not have spikes in the scene rendering time
VR Toolkits discussed in this chapter
Name
Application
Java3D
(Sun Microsystems)
General Purpose
Vizard and
General Purpose
PeoplePak (WorldViz) avatar extension
GHOST (SensAble
Technologies)
PeopleShop
(Boston Dynamics)
3DGame Studio
Proprietary Library size language
no
yes
Implemented in C
Programming in Java
19 packages, 275 classes
OpenGL-based
Python scripting
language
Haptics for
Phantom
yes
C++
Military/civilian
yes
C/C++
Game engine
yes
C++
Vizard characteristics:
 Uses Python which is a scalable and cross-platform;
 It is object-oriented and simple to integrate with C/C++
 It runs on Unix, Windows, Mac and other platforms;
 Uses a 4-window “workbench” which allows programmers to
write and execute code, inspect 3D models, drag-and-drop objects,
and issue commands while the scene is being rendered.
Resource window –
Text list of word assets
3D window –
Explore individual
objects
Stack of scripts – errors
are highlighted as you type
Interactive window –
input commands
Workbench use:
Icon menu
Scene exploration
with the mouse
Importing objects
Vizard virtual hand:
import viz
import hand
viz.go()
#Identify the 5DT glove's port.
PORT_5DT_USB = 0
#Add the 5DT sensor
sensor = viz.add('5dt.dls')
#Create a hand object from the data glove
glove = hand.add(sensor,hand.GLOVE_5DT)
#Place the hand in front of the user
glove.translate(0,1,5)
glove.rotate(180,-90,180)
# now when you run the script the glove should be moving
Vizard multi-texturing:
import viz
viz.go()
logo = viz.add('logo.wrl') #add vizard logo and place it in front of user
logo.translate(0,2,4)
tex1 = viz.add('gb_noise.jpg') #add two textures that will then be applied to
the logo
#tex2 = viz.add('brick.jpg')
logo.texture(tex1) #applies the first texture
logo.texture(tex2,'',1) #applies the second texture to the logo
blend = viz.add('multitexblend.fp') #indicate how to blend the two textures
logo.apply(blend)
Vizard Simulation Servers:
 More than one user can inhabit the same environment. Each user
needs to run Vizard. After the world is set up, each user has to set
up two “mail boxes”.
 One receives information from the other user after it was given
network name. Messages come in sequence [0] who sent it, [1]
what is sent, [2] and larger the actual data
Position is the property
information
Ball is the object
action
User 1
User 2
Vizard networking example:
Import viz
Viz.go()
Ball=viz.add(‘ball.wrl’) #create a Ball object that is controlled by the other user
#add the world that will be displayed on your computer
#Use a prompt to ask the other user the network name of his computer.
target_machine = viz.input('Enter the name of the other machine'). upper()
#Add a mailbox from which to send messages to the other user. This is your outbox.
target_mailbox = viz.add(viz.NETWORK, target_machine)
#Add an id for the timer.
BROADCAST = 1
#Add the timer.
def mytimer(num):
if num == BROADCAST:
#Retrieve your current position.
position = viz.get(viz.HEAD_POS)
#Send the data to the target mailbox. All the recipient will get your yaw, x and z
coordinates.
target_mailbox.send(position[0], position[1], position[2])
Vizard networking example:
#This function will deal with incoming messages.
def mynetwork(message):
#message[0] is who sent the message, message[1] is a description of what he
#sent and message[2] and greater are the messages themselves.
x = message[2]
y = message[3]
z = message[4]
ball.translate(x,y,z)
# Callback the network function to await incoming messages.
viz.callback(viz.NETWORK_EVENT, mynetwork)
# Callback the timer.
viz.callback(viz.TIMER_EVENT, mytimer)
# Start the timer.
viz.starttimer(BROADCAST, 0.01, -1)
VR Toolkits discussed in this chapter
Name
Application
Java3D
(Sun Microsystems)
General Purpose
Vizard and
General Purpose
PeoplePak (WorldViz) avatar extension
GHOST (SensAble
Technologies)
PeopleShop
(Boston Dynamics)
3DGame Studio
Proprietary Library size language
no
yes
Implemented in C
Programming in Java
19 packages, 275 classes
OpenGL-based
Python scripting
language
Haptics for
Phantom
yes
C++
Military/civilian
yes
C/C++
Game engine
yes
C++
GHOST Toolkit for the PHANToM
 Provides realistic haptic interaction
 Provides and intuitive interfaces to haptics
 Provides a haptic scene graph aligned with
3D graphics APIs
 Provides an extensible environment for
extending haptic interaction technologies
 Point haptic interaction with PHANTOM
 geometry based on user defined force models
 Geometry moves dynamically in response to
forces
y
z
(0,0,0)
x
PHANToM Desktop model
30 fps
GHOST – Application interaction
Application Process
Haptic Process
Scene Creation
Haptic
Rendering
Scene Rendering
Collision detection
Collision response
y
z
(0,0,0)
x
1000 Hz
Haptic State
Update
Clean-up
Haptic
Servo loop
adapted from Ghost SDK Programmer’s Guide
(version 3.1)
30 fps
The GHOST haptics scene graph
Application Process
Haptic Process
Scene Creation
Haptic
Rendering
Scene Rendering
Collision detection
Collision response
y
z
(0,0,0)
x
1000 Hz
Haptic State
Update
Clean-up
Haptic
Servo loop
adapted from Ghost SDK Programmer’s Guide
(version 3.1)
Haptic scene graph
 Provides a structured way to construct a haptic scene,
including geometry and dynamics;
 is traversed only from top to bottom (unlike WTK);
 each node reachable by only one (unique) traversal from the
root (a child node has only one parent node)
 Each node has its own transform (no separate transform
nodes);
 cannot use pointers to repeat instances of the same object,
since similar objects have different haptic interactions;
 Separator nodes to create a hierarchy – Transforms on the
Separator affect its sub-tree;
GHOST node classes
gstNode
gstBoundedHapticObj
gstTransform
gstShape
gstPHANToM_SCP
gstBoundary
gstBoundary Cube
gstCone
gstCube
gstForceField
gstCy linder
gstSphere
gstTorus
gstConstantForceField
gstSeparator
gstPoint
gstDynamic
gstTriPoly MeshHaptic
gstDial
gstButton
gstVector
gstSlider
gstTransf ormMatrix
gstRigidBody
gstSpatialObject
gstPHANToM
gstPlane
gstPHANToMDy namic
gstTriPoly Base
gstPHANToMTranslation
gstTriPoly
gstPHANToMRotation
gstSpatialPartition
gstBinTree
gstTriPoly MeshBase
gstTriPoly Mesh
gstEffect
gstInertiaEf f ect
gstManipulator
gstTranslateManip
gstBuzzEf f ect
gstScaleManip
gstConstraint
gstRotateManip
3D support
Static Nodes
Dynamic Nodes
Utility Classes
GHOST nine node classes
GHOST nine node classes (continued)
GHOST nine node classes (continued)
Scene graph example
y
Head
y
Left Elbow
z
x
y z
x
y
Left Shoulder
Right ShoulderRight Elbow
x
z
y
x
z
z
Torso
z
x
y
Body
z
y
x
x
Static scene graph – only separators and geometry nodes as leaves
GHOST code example:
#include <stdlib.h>
#include <gstBasic.h>
#include <gstSphere.h>
#include <gstPHANToM.h>
#include <gstSeparator.h>
#include <gstScene.h>
Main()
gstScene *scene = new gstScene;
gstSeparator *root = new gstSeparator;
gstSphere *sphere = new gstSphere;
Sptere -> setRadius(20);
gstPHANToM *phantom = new gstPHANToM (``PHANToM name``);
Root -> addChild(phantom);
Root-> addChild(sphere);
Scene-> setRoot(root);
Scene -> startServoLoop();
While(!scene -> getDoneServoLoop())
// end application by calling scene -> stopServoLoop ();
30 fps
Force calculation and dynamics
Application Process
Haptic Process
Scene Creation
Haptic
Rendering
Scene Rendering
Collision detection
Collision response
y
z
(0,0,0)
x
1000 Hz
Haptic State
Update
Clean-up
Haptic
Servo loop
adapted from Ghost SDK Programmer’s Guide
(version 3.1)
Collision detection and response
 The scene graph contains at least one representation of the
haptic interface through gstPHANToM node. There can be up
to four such nodes (four haptic interfaces in one haptic scene)
 Collisions are detected between this node and the geometry
nodes through the gstShape node that goes from “untouched”
to “touched”;
 When collision exists, the gstPHANToM_SCP (surface
contact point) is added to the scene graph. This node should
be added to the scene graph under the same parent as
gstPHANToM node.
Collision detection and response
 Forces are calculated following collision;
 Collision response through dynamic effects (movable
nodes, solid body dynamics);
 Application informed if needed (user defined).
Normal Force
(depends on spring
and damper coefficients)
Friction Force
(depends on static and dynamic
friction coefficients)
Dynamic nodes
 The gstDynamic node adds movement ability to the
geometry nodes beneath it. A subtree under a gstDynamic
node represents one physically dynamic object.
 Forces generated by gstPHANToM node colliding with one
of the geometries of such object are added to the state of the
gstDynamic node
 Transformations (rotations, translations) are always applied
to the gstDynamic node, not its children;
 It has four derived classes gstDial, gstButton, gstSlider and
gstRigidBody.
Dynamic nodes (continued)
 When a gstDynamic node changes state, an event is
generated which calls a user-defined callback function.
 Example – the application may quit if a gstButton changes
state from pressed to released.
gstButton
behavioral example
30 fps
Updating the application
Application Process
Haptic Process
Scene Creation
Haptic
Rendering
Scene Rendering
Collision detection
Collision response
y
z
(0,0,0)
x
1000 Hz
Haptic State
Update
Clean-up
Haptic
Servo loop
adapted from Ghost SDK Programmer’s Guide
(version 3.1)
Graphics and event callbacks
 The user selects which nodes have call-back functions, and
what information needs to be sent back to the application;
 This way the application calls updateGraphics to have graphics
information updated. Nodes that have a graphics call-back
defined, and have a new state since the last call to
updateGraphics will copy their current state to a defined data
structure
 Call-backs pass new state information of the haptic scene nodes
from GHOST haptics process to the application process;
 For example, the user can create a callback for the graphics
representation of the position of the gstPHANToM node. This
should change to callback of gstPHANToM_SCP after collision,
so the user can see the location of the contact point on the object.
Mapping the user to the haptic scene
User workspace
Phantom workspace
Camera mapping to PHANToM workspace
z-axis
phantomSep
Transform M rotation
Camera
phantomSep
Transform M camera
phantomSep
Transform M zaxisOffset
from Ghost SDK Programmer’s Guide (version 3.1)
Camera
Scaling camera and PHANToM workspaces
Phantom workspace
Phantom workspace
Phantom workspace
Camera
Camera workspace
too large
Camera
Camera
Camera workspace
too small
Camera workspace
appropriate
Scaling camera and PHANToM workspaces
Dxmax
Dphantomxmax
Camera
 The scale factor depends on the distance Dxmax from
the focal point to the frustum
The distance Dphantomxmax from the non-scaled
PHANTOM workspace center to the side limit must
also be determined
The scale factor is then Sfrustum=Dxmax/Dphantomxmax
Scaling camera and PHANToM workspaces
 To maintain haptic fidelity, the gstShape node physical
properties (compliance and damping) need to be scaled
too;
 SurfaceKspringnew = SurfaceKspringcurrent/Sfrustum
 SurfaceKdampingnew = SurfaceKdampingcurrent/Sfrustum
where SurfaceKspring and SurfaceKdamping are gstShape
compliance and damping coefficients.
VR Toolkits discussed in this chapter
Name
Application
Java3D
(Sun Microsystems)
General Purpose
Vizard and
General Purpose
PeoplePak (WorldViz) avatar extension
GHOST (SensAble
Technologies)
PeopleShop
(Boston Dynamics)
3DGame Studio
Proprietary Library size language
no
yes
Implemented in C
Programming in Java
19 packages, 275 classes
OpenGL-based
Python scripting
language
Haptics for
Phantom
yes
C++
Military/civilian
yes
C/C++
Game engine
yes
C++
BDI PeopleShop/DI-Guy characteristics
 Provides a realistic way to simulate human characters in
real-time scenes without using tracking suits;
 Is a task-level programming environment combined with a
menu-based GUI;
 Tasks are mapped to pre-defined (stored) joint motions
which are interpolated in real time;
 Well-suited for Distributed Interactive Simulations (DIS)
due to low bandwidth requirements and live reckoning;
 Initially designed for the military, now extended to civilian
applications, such as accident reenactment, architectural
walk-through, driving simulators, police training, etc.
BDI PeopleShop/DI-Guy characteristics - continued
 Linkable object library that runs on SGI, Intel PCs, as well
as other platforms;
 The library has modules for run-time motion engines,
graphics display, motion data, 3D graphics models, textures,
and network interfaces for DIS;
 Runs under OpenGL, Direct3D, Mak Stealth and other
packages;
 Recommended hardware is Intel > 200MHz, 64 MB Ram,
and graphics accelerator (for Open GL, OpenGVS or
Direct3D).
Scene Geometry
PeopleShop
Initiation
Define character
path
Define
sensors
Define
behavior
Define networking
Scene Geometry
PeopleShop
Initiation
Define character
path
Define
sensors
Define
behavior
Define networking
PeopleShop Characters
 Are articulated polygonal structures with 54 DOF and 11
links;
 Vehicles are also treated as characters;
 Different types of characters have different acceptable
actions;
 Each type of character has different user-selectable
appearances (ex. Character vehicle can be a tank or a police
car, etc.);
 Characters are textured to increase realism and reduce
polygonal count
Character selection
Character type determines acceptable actions (menu selectable)
Appearance selection
Bob_shorts
Joe_blue
Bridget_skirt
Character appearance (menu selectable)
Diane_teen
BDI Toolkits
38 polygons
2500 polygons
Supplemental bdi.DIGuy-LOD.mpg
Character level-of-detail segmentation based on distance to virtual camera
improves real-time performance (up to about 100 characters can be in a scene)
Scene Geometry
PeopleShop
Initiation
Define character
path
Define
sensors
Define
Behavior
Define networking
PeopleShop path specification
Waypoint
Slope
Adjuster
Path
Initial path
Extended path
Added waypoint
BDI Toolkits
Action
bead
End
bead
Last action bead
Stacked action
beads
Editing actions
VC 6.6
on book CD
VC 6.5
on book CD
Scene Geometry
PeopleShop
Initiation
Define character
path
Define
sensors
Define
behavior
Define networking
BDI Toolkits
Sensor boundary
Soldier A
Soldier B
When soldier A enters the sensor volume, the system is notified – this triggers
soldier B’s shooting of A
PeopleShop sensors
Sensor boundary
Supplemental
bdi.farmhouse.mpg
Sensors are user-defined volumes in space that detect
when a character enters them
(PeopleShop User’s Manual)
Scene Geometry
PeopleShop
Initiation
Define character
path
Define
sensors
Define
behavior
Define networking
PeopleShop Behaviors
 Behaviors can be reflex (based on signals received from sensors);
 Behaviors can also be specified with decision beads;
 Decision beads can be placed on the character’s path (colored red);
 The two parameters characterizing a decision bead are
distance and length;
 Distance specifies how far from the start of the path the decision
Bead is placed;
 Length indicates the distance from the beginning of the decision
region that the decision bead is active;
 Decisions can be converted to script:
BDI Toolkits
Decision clauses (IF/THEN/ELSE)
PeopleShop
Run-time
PeolpeShop
Initiation
Scenario Visualization
Interactive Training
Immersive Training
User(s)
User(s)
User(s)
PeopleShop Run-time
PeolpeShop
Initiation
Scenario Visualization
Interactive Training
Immersive Training
User(s)
User(s)
User(s)
BDI PeopleShop Toolkit
VC 6.7
User is interacting in real time with the simulation using a joystick or mouse
and menu. Limited control and immersion. Natural speeds should not be
exceeded.
(from Koechling et al., 1997)
PeopleShop
Run-time
PeolpeShop
Initiation
Scenario Visualization
Interactive Training
Immersive Training
User(s)
User(s)
User(s)
BDI PeopleShop – Run time modes
Sensorized weapon
Omni-directional treadmill
User is interacting in real time with the simulation using a trackers and sensors.
Control is at the joint level and immersion is increased.
(BDI, 1997)
Scene Geometry
PeopleShop
Initiation
Define character
path
Define
sensors
Define
behavior
Define networking
PeopleShop Networking
 Updating human figures in DIS is much more bandwidth
expensive than vehicles;
Vehicles have few degrees of freedom, while a human
figures with 40 joints updated at 20 Hz require 800
packets/sec.;
Instead of updating every joint, PeopleShop only updates at
the task level (action, position, velocity). It requires about two
packets/sec to produce a smooth simulation;
Works well for large number of participants such as in
dismounted infantry training.
Uses “live reckoning” vs. dead reckoning used previously
for vehicles
BDI Toolkits
Classical DIS using dead reckoning
(from Koechling et al., 1997)
BDI Toolkits
DIS using live reckoning and human-in-the-loop
DI-Guy model
DI-Guy model
Task-level change
(action, orientation, velocity)
(from Koechling et al., 1997)
PeopleShop “Top Gun”
(courtesy Boston Dynamics Inc.)
VR Toolkits discussed in this chapter
Name
Application
Java3D
(Sun Microsystems)
General Purpose
Vizard and
General Purpose
PeoplePak (WorldViz) avatar extension
GHOST (SensAble
Technologies)
PeopleShop
(Boston Dynamics)
3DGame Studio
Proprietary Library size language
no
yes
Implemented in C
Programming in Java
19 packages, 275 classes
OpenGL-based
Python scripting
language
Haptics for
Phantom
yes
C++
Military/civilian
yes
C/C++
Game engine
yes
C++
3D Game Studio characteristics
 Provides an easy and fast way to program virtual worlds
using the A6 game engine;
 Is a a combination of task-level programming environment
combined with a menu-based GUI and script programming
for more flexibility;
 Well-suited for multi-user simulations over LANs and
WAN (TCP/IP and UDP);
 Initially designed for the games, now extended to VR
programming due to its functionality and price (various
versions with increasing number of features, up to
commercial license of about $500)
3D Game Studio characteristics
 the 3D Engine allows multiple views (multiple virtual
cameras) and is built around DirectX 9 graphics pipeline;
 light sources are point, spot or directional
 optimization is done through culling (Potential Visibility Set
and frustrum);
 further optimization through geometric LOD and texture
detail
 surface meshes are deformable, and objects have dynamics
 character animations are done through bones (skeletons)
and are blended.
3D Game Studio geometry creation
 we can import from a large library of models, or a file
created with another modeling tool like 3D Studio Max
 or objects can be created using the World Editor (WED) 3D
editor
3D Game Studio texturing
 bump maps
light maps and multi-texturing (up to 8)
3D Game Studio character animation
 animation can be imported
if created in Maya, or
characters can be created and
animated using the model
editor.
Frames are
declared in order
of action
Physics and Sound engines
 collision detection is done at the polygon level and objects
respect physical behavior like gravity, elasticity and friction
 Cscript – a simplified version of C++ is used to create physics
behavior through special functions, and to do I/O programming
(keyboard keys and mouse)
 static and dynamic 3D sound sources can be programmed
3D Game
Studio
Initiation
3D Game Studio Initiation
Example of games programmed in 3Dgame Studio
More at www.3dgamestudio.com

similar documents