VRML 2.0 Tracking Viewpoint Widget
Archived from http://reality.sgi.com/tomk/demos/vrml2/TrackingViewpoint

Tom Kaye (tomk@sgi.com)
Silicon Graphics Inc.
April 1997

This document lives at:
ftp://ftp.sgi.com/sgi/vrml/TrackingViewpoint/readme.html"


Contents:

  1. What it is
  2. Where and When to use it
  3. Examples
  4. How it works (details)
  5. General Notes
  6. Browsers it works with

What it is:

  • Want to add an element of cinematography to your VRML 2.0 worlds?
  • Need an easy way for casual users to follow the action in your animated world?
  • Have a big world with lots of little elements racing all around?
  • Want to just try something different?
  • 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 :

  • a fixed or varying camera position (position);
  • a fixed or varying target position (toVector);
  • an optional upVector (y-axis is the default);
  • and it sends the necessary position and orientation values to an embedded Viewpoint Node for you.

    For instance, you could:

  • designate the top of a tower as a fixed camera position (position),
  • use a Car travelling along an animated path as a variable target position (toVector),
  • keep the vertical plane of the camera perpendicular to the ground plane by defining the y-axis as the upVector (the default),
  • 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:

  • magnification which provides a constant magnification factor (>1) over the default view
    (example)

    or

  • standoffDistance which provides an effective view from a point along the line-of-sight vector that is a fixed distance away from the target. (example)
  • For a complete description of the fields, eventIns and eventOuts see "how it works" section.

    Click here for more examples .

    Return to Contents


    Where and When to use it:

    The Tracking Viewpoint has numerous applications. Below is a brief list that comes to mind.

    1. Attached to an avatar.

  • Avatar can "track" any other avator or point of interest. Tracking feedback used to orient avatar's head. Now when you go for a virtual walk in the park with another personoid, your avatars can show interest in each other regardless of how you move, because your eyes and heads will be aligned!
  • 2. Walking down a shopping aisle or museum corridor or neighborhood street.

    Proximity sensors are place on objects of interest. When my position enters the prozimity zone of a product, exhibit, or house for sale, the coordinates of the item of interest are routed to my tracking viewpoint's toVector. Thus my gaze is automatically fixed on the point of interest until:
  • I remove it (switch to a non-tracking viewpoint)
  • I leave the proximity zone
  • A higher priority proximity zone is entered (or moves past me in the case of a car approaching from behind)
  • 3. Spectator at any virtual event.

  • If it is a play, then I can select the actor to watch and dial in a zoom factor.
  • If it is an Airshow, I can follow the fast moving aircraft quite easily from the ground
    or ride in the aircraft and track on another aircraft. ( A motor race would be similar). This is where the magnification and standoffDistance variables work great.
  • If it is a golf game, I can ride the ball and track the cup or sit by the green and track the ball.
  • 4. A 3D navigational map:

  • When moving from one point of view (say bird's eye view of a downtown area) to another point of interest, My camera can track the point of interest so I maintain my bearings.
  • 5. Theme Park Rides:

  • roller coaster riders can track straight ahead (zombie-view) or look ahead into the turns and loops (track on a point that is 1 second into the future along their prescribed path). This is a good place to use the upVector to align the camera with the bank of the vehicle.
  • Disney-type rides (smallworld, jungle cruise, haunted mansion) are classic examples where the viewpoint is either controlled or encouraged. Use of tracking viewpoints with proximity switches could recreate the same effect)
  • As a preview of the ride (terror) to come, one can track the path of a roller coaster from any point. With the StandoffDistance eventIn, the target of the tracking camera will always fill the appropriate amount of the browser window.
  • 6. Space Shuttle Tracking:

  • Given a surfers lat/long (to define the celestial upvector which will change with time) a website could put a tracking camera on the surface of the earth at prescribed lat/long and track the orbit of any satellite or position of any celestial body. Surfers might even begin to understand where the stars are during the daytime!
  • Return to Contents


    Examples:

    Add Parameters to anchor to launch a menuless browser or target a frame in this document

    Tracking Viewpoint
    Test Cases

    Camera Location

    Fixed

    Moving

    Target
    Location

    Fixed

    Standard VRML Viewpoint
    From Vehicle to Overhead Banner
    (Note: Camera mount is offset by
    [0, 0.2, 0] m from vehicle center)
  • Default Settings
  • UpVector = [1, 1, 0]
  • 2X Magnification
  • 1m Standoff Distance
  • Moving

    From Tower to Vehicle:

  • Default Settings
  • UpVector = [ 1, 1, 0]
  • 2X Magnificaton
  • 2m Standoff Distance
  • Test of Default TVP as Child of Moving Transform

    Roller Coaster

    Follow That Car

    Return to Contents


    How it Works:

    Standard VRML viewpoints are specified using :

  • a position and orientation (with respect to the current transformation hierarchy)
  • a fieldOfView viewing angle
  • 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 Specification (view source)

    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.

    Return to Contents


    General Notes:

    There are two ways to bind a tracking viewpoint. Either way is legitimate:

    1. First, one can send an explicit set_bind eventIn.
    2. Second, some browsers (like cosmoplayer) will provide a mechanism to jump between all available viewpoints in the scene. The Tracking Viewpoint is merely a wrapper around a standard viewpoint which the browser should be able to see. So if the browser's viewpoint jump control binds the standard viewpoint embedded within a Tracking Viewpoint, then the Tracking Viewpoint will detect this and proceed to act as if an explicit set_bind eventIn had been issued to it's PROTO interface.

    Return to Contents


    Browsers it works with:

    The Tracking Viewpoint has been tested and found to work on the following VRML 2.0 Browsers:

  • CosmoPlayer 1.0.2 for IRIX
  • CosmoPlayer 2.0 for Win95/NT
  • 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.

    Return to Contents


    Tracking Viewpoint page maintained by Tom Kaye tomk@sgi.com
    last updated 01-23-98