Tom Kaye
(tomk@sgi.com)
Silicon Graphics Inc.
April 1997
This document lives at:
ftp://ftp.sgi.com/sgi/vrml/TrackingViewpoint/readme.html"
If so then the Tracking Viewpoint may be just what you're looking for. By specifying a few basic parameters, you can easily create intelligently-controlled, dynamically-changing camera views that are both practical and asthetically pleasing to the eye. Best of all, you greatly reduce the user's navigational workload resulting in more satisfying visits to your virtual domains.
To specify a Tracking Viewpoint you supply :
and it sends the necessary position and orientation values to an embedded Viewpoint Node for you.
and voila...you have a viewpoint that will Follow that Car.
In addition, you can modify the magnification of the view along the
line-of-sight vector (toVector - position) by using the
additional variables:
For a complete description of the fields, eventIns and eventOuts see "how it works" section.
Click here for more examples .
The Tracking Viewpoint has numerous applications. Below is a brief list that comes to mind.
1. Attached to an avatar.
2. Walking down a shopping aisle or museum corridor or neighborhood street.
3. Spectator at any virtual event.
4. A 3D navigational map:
5. Theme Park Rides:
6. Space Shuttle Tracking:
Add Parameters to anchor to launch a menuless browser or target a frame in this document
Tracking Viewpoint |
Camera Location | ||
---|---|---|---|
Fixed |
Moving |
||
Target Location |
Fixed |
Standard VRML Viewpoint |
|
Moving |
From Tower to Vehicle: |
Test of Default TVP as Child of Moving Transform
Standard VRML viewpoints are specified using :
Unless you animate the viewpoint (either directly by ROUTEing position and orientation updates to the viewpoint itself or indirectly by authoring your viewpoint as a child of an animated parent transform) then all you get is a static view of your world. Some browsers will animate the transition between viewpoints but you have no control over the intermediary position and orientation during the process.
The Tracking Viewpoint is a VRML 2.0 PROTOTYPE node (click here to view the source) that acts as wrapper around a standard viewpoint. All fields (and their defaults), eventIns and eventOuts (marked with an * below) of the standard Viewpoint node are supported by the Tracking Viewpoint with one exception.
The orientation exposedField is not supported for direct input ( set_orientation eventIn and orientation field for initialization) because it is dependent on position, toVector, and upVector. However, the orientation_changed eventOut is supported.
NOTE: All functions are currently implemented only as vrmlscript (javascript) and have been tested with the SGI CosmoPlayer browser (CosmoPlayer 2.0 for Win95/NT and CosmoPlayer 1.0.2 for IRIX).
PROTO TrackingViewpoint [
*field SFFloat fieldOfView 0.785398 *field SFBool jump TRUE *field SFVec3f position 0 0 10 field SFVec3f toVector 0 0 0 field SFVec3f upVector 0 1 0 *field SFString description "" field SFBool active FALSE field SFFloat magnification 1 field SFFloat standoffDistance -1 *eventIn SFBool set_bind *eventIn SFFloat set_fieldOfView *eventIn SFBool set_jump *eventIn SFVec3f set_position eventIn SFVec3f set_toVector eventIn SFVec3f set_upVector eventIn SFBool set_active eventIn SFFloat set_magnification eventIn SFFloat set_standoffDistance *eventOut SFFloat fieldOfView_changed *eventOut SFBool jump_changed *eventOut SFRotation orientation_changed *eventOut SFVec3f position_changed eventOut SFVec3f effective_position_changed eventOut SFVec3f toVector_changed eventOut SFVec3f upVector_changed *eventOut SFTime bindTime *eventOut SFBool isBound eventOut SFFloat magnification_changed eventOut SFFloat targetRange_changed ]
All fields marked with an asterisk behave the same way as per the standard Viewpoint node described in the VRML 2.0 Spec.
Additional fields, eventIns and eventOuts provided by the Tracking Viewpoint and descriptions of how they work are as follows:
field SFVec3f toVector 0 0 0 eventIn SFVec3f set_toVector eventOut SFVec3f toVector_changed
The toVector is used to specify the location of the target point.
The viewpoint's line of sight is along the line drawn from the camera position to the target point.
field SFVec3f upVector 0 1 0 eventIn SFVec3f set_upVector eventOut SFVec3f upVector_changed
The upVector is used to specify a direction vector originating at the camera position that will always be contained by the vertical plane of the camera. In other words, the top edge of the VRML browser will be perpendicular to the upVector. The upVector has no bearing on the line-of-sight of the viewpoint, only on the roll angle around that line-of-sight axis. The default value of the upVector is the Y-axis. Thus the default behavior of a Tracking Viewpoint updated only with toVector inputs will be as a TV camera mounted on a fixed tripod having only azimuth and elevation pivots.
field SFFloat magnification 1 eventIn SFFloat set_magnification eventOut SFFloat magnification_changed
Magnification (must be greater than 1) is handled by sliding the effective viewpoint position along the line of sight between the specified camera position (magnification = 1) and the target positon or toVector (magnification = infinity). A magnification of 2 will place the effective viewpoint halfway between the specified camera position and the target.
Magnification is only in effect if the standoffDistance is less than or equal to zero. The default magnification is 1.
field SFFloat standoffDistance -1 eventIn SFFloat set_standoffDistance
When an object tends to travel a good distance toward and away from the camera position, having a constant magnification factor can cause the object to sometimes appear too large and sometimes too small. So the standoffDistance field was created to allow tracking an object from what appears to be a fixed distance. This allows the author to fill the browser window with mostly the object regardless of how close or far it gets. Like magnification above, standoffDistance is implemented by sliding the effective viewpoint along the line of sight backward from the target by a fixed distance.
When standoffDistance is set to a value greater than zero, magnification is computed according to standoffDistance and the result is passed out as magnification_changed.
When standoff distance is set to a value less than or equal to zero, the last computed value for magnification is used. So REMEMBER if you want to switch back to a default magnification of 1 after using a standoffDistance greater than zero, you MUST set_standoffDistance = -1 AND set_maginification = 1;
eventOut SFFloat targetRange_changed
TargetRange_changed is simply the length of the line of sight vector or the distance between the camera position and the target.
eventOut SFVec3f effective_position_changed
The effective_position_changed is used to convey back to the VRML application exactly where the embedded viewpoint was told to go. Under default conditions of magnification = 1 and standoffDistance = -1, effective_position_changed will be equivalent to position_changed.
field SFBool active FALSE eventIn SFBool set_active
Under default conditions, a tracking viewpoint will only compute and generate the following eventOuts if it is the currently bound viewpoint (isBound = TRUE):
*eventOut SFRotation orientation_changed *eventOut SFVec3f position_changed eventOut SFVec3f effective_position_changed eventOut SFVec3f toVector_changed eventOut SFVec3f upVector_changed eventOut SFFloat magnification_changed eventOut SFFloat targetRange_changed
This conserves scarce compute cycles and allows more tracking viewpoints to be used in a vrml world.
There are however, conditions under which you may want to perform tracking computations and generate the above eventOuts whether the viewpoint is bound or not. (look again at the Follow That Car example and notice that both cameras are shown to track the car even though the bound viewpoint is non-tracking.) This behaviour is controlled by the active field of the Tracking Viewpoint. If set to TRUE, tracking computations are always performed. If FALSE, then computations are only performed if the Tracking Viewpoint is bound. Computions will also be performed ONCE and only ONCE upton initialization of the world.
There are two ways to bind a tracking viewpoint. Either way is legitimate:
The Tracking Viewpoint has been tested and found to work on the following VRML 2.0 Browsers:
If your browser supports VRMLScript or JavaScript this proto should work for you.
If you try it and find it works, please send me email with the name and version of your browser so I can pass the news along to others. Thanks.
Tracking Viewpoint page maintained by
Tom Kaye tomk@sgi.com
last updated 01-23-98