|
|
Viewpoints
ViewpointsThe user sees the world through a virtual camera, moving it around using some method of navigation. To make navigation easier, it is desirable to control the viewpoint camera. In most virtual reality systems it is possible to define a set of viewpoints (sometimes called landmarks or cameras) to enable the user to quickly move between locations and/or see objects from different angles. In VRML, the Viewpoint node is the user's camera view of the virtual world. The first viewpoint defined in a VRML file is used to define the user's starting position, and the user can move to subsequent viewpoints using a menu in the VRML browser. However, viewpoints are not just a neat way of adding 'bookmarks' to a virtual world. If a viewpoint is placed inside a Transform node then it's position and orientation move if the node is transformed, so animating a Transform with a viewpoint in it moves the viewpoint. Viewpoint syntax:
Viewpoint {
position 0.0 0.0 1.0 # exposedField SFVec3f
orientation 0.0 1.0 0.0 0.0 # exposedField SFRotation
fieldOfView 0.785398 # exposedField SFFloat
description "" # field SFString
jump TRUE # exposedField SFBool
set_bind # eventIn SFBool
isBound # eventOut SFBool
boundTime # eventOut SFTime
}
The first three fields define the virtual camera's position, orientation and field of view. The field of view of the camera defines the breadth of the virtual environment when seen from the viewpoint. The description field allows authors to describe viewpoints so that they can be listed with useful labels in a VRML browsers viewpoint menu. Note that it is a field and not an exposed field. This means that the value cannot be changed using a script. There are two different ways of moving between viewpoints when a viewpoint is bound. If jump is set to TRUE then the viewer's position, orientation, and field of view are set to those defined in the Viewpoint, and the user moves to the new location. This is useful for moving to important locations in a virtual world. A more subtle way of changing viewpoints can be achieved when jump is set to FALSE. In that case, the viewer's position, location, and field of view are not altered, so the transition between viewpoints is completely smooth. Most VRML browsers, animate the movement between viewpoints when selected from the browser's viewpoint menu. In general this is less disorientating than if such animation is turned off as it gives the user a sense of where he/she is being taken (even if the user is moved very quickly). Binding ViewpointsViewpoints can be bound in the same way as NavigationInfo nodes. If TRUE is passed to a Viewpoint node's set_bind eventIn, then that node will be bound. If FALSE is sent then the next viewpoint on the stack will be bound. This mechanism enables scripts to move user's to new viewpoints, to assist in navigation (e.g. a guided tour). This makes it possible, for example, for a user to go over to a car. Click on it, and then be moved to a viewpoint in the car which moves with the car to a new location, at which the user is 'ejected' to a new viewpoint at the destination. Using ViewpointsIn general, it is a good idea to add viewpoints, with appropriate descriptions, to your virtual environments as viewpoints do make navigation easier for users. This VRML97 Viewpoint Example demonstrates a scene with four viewpoints: This is the code:
#VRML V2.0 utf8
NavigationInfo {
type "EXAMINE"
headlight FALSE
}
Inline {
url "scene.wrl"
}
Viewpoint {
description "Front"
position 0 1.6 10
orientation 0 1.0 0 0
jump FALSE
}
Viewpoint {
description "Right Side"
position 10 1.6 0
orientation 0 1.0 0 1.571
jump FALSE
}
Viewpoint {
description "Left Side"
position -10 1.6 0
orientation 0 1.0 0 4.712
jump FALSE
}
Viewpoint {
description "Back"
position 0 1.6 -10
orientation 0 1.0 0 3.142
jump FALSE
}
This VRML97 Rotating Viewpoint Example demonstrates a scene with one fixed viewpoint and one rotating viewpoint. In the next section we will look at how viewpoints can be used to create guided tours (and where binding will be demonstrated). |
|
|
Michael Louka, October 10, 2001 |