Animation XML tags for HSF
Proposed by:
This document describes how to encode behavioral information as XML tags. The syntax/naming-scheme and functional descriptions are still preliminary and should serve as a base for discussion.
General Concepts
It is our intention to separate model geometry definitions and behavioral information. This implies that the animation data is stored separately from the model data and in particular is NOT part of the segment tree structure. In a lot of cases the XML tags might still be embedded inside the HSF file (as user data) but they can also be stored in a separate file. As discussed below in some cases the animation data can also reference multiple HSF files.
One goal of the design is to keep the definition simple, functional and easy to grasp with a high degree of reusability for the individual elements to cut down on size. For the first iteration the functionality will also be somewhat limited to let the feature implementation keep up with the XML definition.
This paper does not discuss implementation related issues. It is up to the developer to find a solid class based representation of the various tags for his application. TSA however will provide a fully featured implementation as part of its MVO class library.
Below is a rough overview of the various Tags described in this document and their hierarchical relationship:
Quick Overview
A typical behavior definition will consist of the following components:
“Timeline” - tags that provide a list of time values expressed in ticks. These are used for key-framing.
“Interpolator” - tags that represent changing values over a time period. These could be positional values, rotation, color, etc. Some of these values will have additional “Modifiers” attached to them which control how the interpolation is performed (linear, bezier, etc).
“Animation” - tags which connect a timeline with one or more interpolators and applies various attributes to the animation (delay period, initial acceleration, on/off, etc…)
“Sensor” - tags which define simple (usually mouse based) user interaction with objects on the screen and can trigger/stop animations or other sensors and perform other tasks.
XML Tags
<Animdef>
Parameters:
Name = string (optional) Identifier of the animation dataVersion = string Version number of the format specification Vendor = string (optional, default = "") Vendor information TicksPerSecond = integer (optional, default = 4800) Number of individual "time-slices" per second that can be used to specify key frames (tps). All time related values are expressed in ticks. FramesPerSecond = float (optional, default = 30) Number of frames displayed for every second of real time. This value does not influence the overall playback speed of the animation which is defined by the TicksPerSecond Parameter (see above).Delay = int (optional, default = 0) Initial Execution delay for this animation block (in ticks)File = string (optional., default = "") Path/URL of file that serves as stage for this animation block
... ...
Modifiers = string Global Modifier list for this timeline Valid options are currently: (l)inear, (t)cb, (b)ezier (d)iscrete <> Array of time values (in ticks) along the timeline
**Example 2:** Timeline consisting of 4 elements. The default modifier is changed to bezier. Element 3 has a linear modifier attached which overrides the default one:0 10 20 30
0 10 [[l]20] 30
Using Interpolator Tags
The following tags provide the key-frame values for the various interpolation types. Additionally each element can have one or more "modifiers" attached to it, which further specifies the interpolation method and other parameters. Syntactically every key-frame value is enclosed into square brackets (which can be omitted only for singular components). Additional modifiers appear inside these brackets. Modifiers can be abbreviated usually by their first few letters (as indicated). Currently the following "Modifiers" are supported:-
**Linear (l):** Linear interpolation between keyframes
-
**Discrete (d): **"Abrupt" switching between this keyframe and the following with no interpolation between them.
-
** Bezier (b):** Bezier spline interpolation, if no tangent vectors are specified a smooth ease in/ease out between keyframes is assumed
-
**Cardinal Spline (ca):** Cardinal spline interpolation, if no curve tightness is specified catmull rom spline is asumed
-
**Tcb (t):** Interpolation based on tcb-splines. Tension, continuity, bias, ease-in and-ease-out parameters need to be specified
-
**Absolute (a): **Interpolation values are expressed in absolute terms in relation to the last keyframe (default)
-
**Relative (r):** Interpolation values are expressed in relative terms in relation to the last keyframe
-
**Constant Acceleration (co):** Keeps the interpolation speed constant between two keyframes (applicable to spline modifiers)
-
** Channels (c):** Specifies to which of the output channels the keyframe values correspond to. This allows for very compact definitions of 1 or 2-Dimensional Animation values as well as animating channels separately.
-
** Extra Rotation (er):** Take the "long" path instead of the shortest rotation between two quaternions.
-
** (*):** Hold the value from the last keyframe constant to the current keyframe value. This is NOT the same as simply repeating the last value especially for non-linear interpolation.
-
** Rotation Vector (v): **Rotation vector for use with AxisRotInterpolator type.
Name = string (optional) Identifier of the Interpolator objectFollowPath = (1 or 0), (optional, default = "0") Adjusts the rotation of the object to follow the path of the keyframe values PathVector = [x y z], (optional, default = [1 0 0]) Directional vector if FollowPath=1Modifiers = string, (optional, default = [l a]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, tcb, bezier, discrete, absolute, relative, channels, "*"<> Array of positional values
**Example:**[0 0 0] [0.2 0.6 0.8] [0.1 0.6 0.3] [0.0 0.1 0.2]
Name = string (optional) Identifier of the Interpolator object Color = string, (optional, default = "white") Color of the trail geometryWeight = x, (optional, default = 1) Thickness of the trail Style = string, (optional, default = "----" ) Style of trail (see HOOPS documentation for available line styles) Type = string ("forward", "backward", "full"), (optional, default = "forward" ) Path will either extend from target position to last keyframe (forward), from first keyframe to target position (backward) or from first keyframe to last keyframe (full)Modifiers = string, (optional, default = [l a]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, tcb, bezier, discrete, absolute, relative, channels, "*"<> Array of positional values
**Example:**[0 0 0] [0.2 0.6 0.8] [0.1 0.6 0.3] [0.0 0.1 0.2]
Name = string (optional) Identifier of the Interpolator objectModifiers = string, (optional, default = [l a]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, discrete, absolute, relative,channels, "*" <> Array of scaling values (1.0 = no scaling), only positive values are allowed
[1 1 1] [2.0 2.0 2.0]
Name = string (optional) Identifier of the Interpolator objectModifiers = string, (optional, default = [l r]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include linear, tcb, discrete, absolute, relative, "*", extra rotation<> Array of quaternions ([x y z w])
[0 0 -0.5070 0.823] [0 0 -0.3070 0.823] [0 0 -0.5070 0.223] [0 0 -0.5470 0.823]
Name = string (optional) Identifier of the Interpolator objectModifiers = string, (optional, default = [l a]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, discrete, absolute, relative,"*", rotation vector<> Array of rotation angles (in degree)
**Example:**0 45 [[v 1 0 0]90] 180
Name = string (optional) Identifier of the Interpolator objectType = string (optional, default = "diffuse") Further specifies the color component(diffuse, specular, transmission)GeomType = string (optional, default = "everything") Further specifies the geometry type that the color applies to (faces, edges, lines, etc...) Modifiers = string, (optional, default = [l a]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, tcb, bezier, discrete, absolute, relative,channels, "*"<> Array of color values (expressed as rgb-triplets)
**Example:**[0 0 0] [1.0 1.0 1.0]
Name = string (optional) Identifier of the Interpolator objectModifiers = string Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: discrete, "*" <> Array of segment identifiers
**Example:**"target1" "target2" "target3" "target4"
Name = string (optional) Identifier of the Interpolator objectModifiers = string Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: discrete, "*" <> Array of segment identifiers Can be of the following types (see Appendix A for more information): TOB, TID, HKEY
"target1" "target2" "target3" "target4"
Name = string (optional) Identifier of the Interpolator objectModifiers = string, (optional, default = [l]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, discrete, "*"<> Array of shell identifiers
**Example:**"object descriptor1" "object descriptor2" "object descriptor3" "object descriptor4" & lt;/VertexMorphInterpolator>
Name = string (optional) Identifier of the Interpolator objectModifiers = string, (optional, default = [l]) Default Modifiers that are implicitly applied to all keyframes Valid modifiers include: linear, discrete, "*"<> Array of color array identifiers
**Example:**"object descriptor1" "object descriptor2" "object descriptor3" "object descriptor4"
Name = string (optional) Identifier of the Animation object Target = string (optional) Identifier of target object for this animation (see below) The target can be of the following types (see Appendix A for more information): TOB, TID, HKEY, SPATH, FILEActive = 0/1 (optional, default = 1) Animation active 1=yes 0 = no Delay = int (optional, default = 0) Initial delay before animation starts (in ticks)Loop = integer (optional, default = 1) number of loops for the animation. -1 indicates infinite RLoop = 0/1 (optional, default = 0) go backwards after complete timeline, useful for swinging doors, etc... Accelerate = 0/1 (optional, default = 0) Accelerate on start of animationDecelerate = 0/1 (optional, default = 0) Decelerate on end of animation CurrentTick= int (optional, default = 0) currently elapsed tick for the animation. This can be used to start the animation at a particular stage (in ticks)InstanceOf = string (optional, default = "") The name of an animation or animation block that will be instanciated by this animation. (See below for more information)
0 10 20 [0 0 0] [10 10 10] [20 20 20]
**Example 2:** This example demonstrates the use of two nested animation blocks:[0 0 0] [1 1 1] [0 0 0]
0 10 20 30 ... ... ... ...
**Example 3:** This example demonstrates the use of two nested animation blocks which are instanciated by another animation:
0 10 20 30 ... ...... ... **Parameters: **
Name = string (optional, default = "") Identifier of target objectPath = string (required) Segment path to target object It can be of the following types (see Appendix A for more information): TOB, TID, HKEY, SPATH, FILEPivot = [x y z], (optional, default = [ 0 0 0 ]) Pivot pointRotation = [x y z x y z x y z] Rotational Components of modelling MatrixScale = [x y z] Scale Components along the three axis
0 10 [10 20 30] [40 50 60]
**Example 2:** Here the alias "object1" is simply defined and can later be used by an animation tag.
Name = string Identifier of the subtarget objectType = string String can be any one of the following : GEOMETRY, FACES, VERTICES, EDGES.<> Array of subtarget values List of faces, vertices etc. that this animation applies to (for changing individual face colors, move vertices, etc)
0 5 6 7 22 44
Name = string (required) Identifier of the sensor object.Active = (1 or 0) (optional, default = 1)Delay = int (optional, default = 0) Delay time (in ticks) before sensor is active
Target = string Identifier of target object for this sensor (see below). Could be either an object or an animation (for ONANIMFINISHED), if no target is provided sensor can still be executed by other sensorEvent = event associated with the target (optional, default = ONLCLICK). Valid options include: ONTICK, ONLCLICK, ONRCLICK, ONMOUSEOVER, ONCOLLISION, ONANIMFINISHED, ONSENSORIdle = (0,1) optional, default = "1") Event is only executed if target object is idle (not in any animation)
Target = string (optional, default = "") Animation Identifier, Object Identifier or Sensor identifierType = string Action associated with the target.Valid options include ACTIVATE, DEACTIVATE, RESET, RESTART, LOADFILE.Value = string Additional parameters for the defined action, (optional , default = "")Delay = int (optional, default = 0) Delay time (in ticks) before action is activated
ACTIVATE continues an animation from it's current position DEACTIVATE stops an animation at its current position INFOTEXT displays text information (e.g. tooltip) at mouse position RESET stops an animation at it's current position and rewinds it RESTART restarts an animation LOADFILE loads a new (hsf) file and places it in the directory defined by the value parameter LOADURL loads a specific URL by opening a separate browser window
In this example the sensor gets triggered if the animation a2 has been finished. It then activates animation a3
Complete Examples
Example1:
0 10 20 30 + [r 0.2 0.6 0.8] [r 0.1 0.6 0.3] [r 0.0 0.1 0.2]
0 1.0 [0 0 0] [1 1 1]
0 10 20 30 [0 0 -0.5070 0.823] [0 0 -0.3070 0.823] [0 0 -0.5070 0.223] [0 0 -0.5470 0.823] + [r 0.2 0.6 0.8] [r 0.1 0.6 0.3] [r 0.0 0.1 0.2]
**Example2:** A simple example with just one animation:
**Example3:** A simple example with one animation definition that is instanciated for two targets with the second reusing the timeline and interpolator from the first.0 10 20 30 [0 0 -0.5070 0.823] [0 0 -0.3070 0.823] [0 0 -0.5070 0.223] [0 0 -0.547 0.823]
0 10 20 30 [0 0 -0.5070 0.823] [0 0 -0.3070 0.823] [0 0 -0.5070 0.223] [0 0 -0.547 0.823]
**Example4:** In this "realworld" example an objects visibility is first turned on, it then rotates 360 degrees around it's center in 8 seconds. After that it fades to invisibility and back to fully opaque in ten seconds total. After that the animation can be triggered again by clicking on the object.
0 40 80 120 160
"MODEL/object1"
+ 90 180 270 360
0 100
This sensors condition is met afterAnimation A3 has finished for the first time. It then turns on the sensor S2 and disables itself[1.0 1.0 1.0] [0 0 0]
This sensor is initially inactive and gets activated by sensor s1 after the animation A3 executed for the first time. Once active it is triggered by a left mouseclick on the target object and restarts animation a2 and a3
Appendix A:
Object Type Identifiers:"TOB:" : The name of a previously declared "TargetObject" tag Example: Target = "TOB: object1" "TID:" : A tag identifier which can be obtained from the streaming toolkit while processing the hsf file. Example: Target = "TID: 123""HKEY: " : A unique key identifying the object Example: Target = "HKEY: 123""SPATH:" : A segment path corresponding to the HSF segment structure. SCENE and MODEL are reserved keywords (they refer to the model segment and scene segment as defined in MVO). Specifying SCENE as the segment name can be useful to make global color changes or to do camera movement. "CAMERAPOS" and "CAMERATARGET" are reserved keywords that refer to the camera of the scene. Translation and quaternion rotation will be applied to the camera position/orientation. Camera manipulation will usually require separate animations performed in conjunction. One for the camera movement (using the POS interpolator), one for the camera orientation (using QUAT or EULER) and one for zooming in/out (using the scale interpolator). For "orbit" types of camera animation it is usually preferable to animate the cameratarget, while for walkthroughs the camera position should be used. The camera keywords can appear at the end of a target statement. This is useful if multiple cameras in the scene need to be manipulated. Examples: Target = "SPATH: MODEL/car/wheel1" Target = "SPATH: SCENE/CAMERATARGET""FILE:" : The name of an HSF or file who's contents will be treated as the object. The object will be loaded into the current scene into a separate segment. Example: Target = "FILE: teapot.hsf" "ANIM:" The name of an animation tag Example: Target = "ANIM: a1""SSR:" The name of a Sensor tag Example: Target = "SSR: s1"