Part 2:  Humanoid animation (HAnim) motion data animation

6 HAnim motion data animation using Motion objects

--- HAnim separator bar ---

cube 6.1 General

6.1.1 Overview

This clause defines the Motion object and describes the manner in which motion data animation can be specified using Motion objects.

6.1.2 Topics

Table 6.1 lists the topics for this clause.

Table 6.1Topics

cube 6.2 Introduction to Motion objects

An HAnim figure includes geometric data that consists of hierarchical Joint objects. When motion data is used to animate an HAnim figure an abstract data structure is needed to contain all the parameter values needed to generate that animation. A Motion object is specified to fulfill that requirement.

This clause specifies the form of a Motion object for motion data animation. This clause also specifies additional fields in the Humanoid object defined in ISO/IEC 19774-1. These are required to link motion data to individual HAnim figures.

This clause also details how raw motion data can be used in Motion objects for animation of HAnim figures.

cube 6.3 Data structure of Motion object

The Motion object supports discrete frame-by-frame playback for HAnim motion data animation, specified by the following types of fields:

HAnim figure data specifies an HAnim figure with multiple Joint objects, including geometries and materials, built in accordance with the HAnim hierarchy defined in Part 1. The joints mapping definition specifies the mapping of the channels of the raw motion data to HAnim Joint objects, as detailed in 4.4 HAnim joint mapping for motion-capture animation. Animation-control fields permit synchronization and flexible playback. Raw motion data includes motion-capture data, the number of frames, the frame display time, and the parameter values for the motion from each channel at each frame.

The interface definition for the Motion object is specified below, using the presentation definition detailed in ISO/IEC 19774-1.

    interface Motion {
        string             description      ""
        string             channels         ""
        sequence<Boolean>  channelsEnabled  []
        double             cycleTime
        double             elapsedTime
        Boolean            enabled          false
        int                frameCount       0     [0, ∞)   
        float              frameDuration    0.1   (0, ∞)   
        int                frameIncrement   1     (-∞, ∞)
        int                frameIndex       0     [0, ∞)   
        string             joints           ""
        integer            loa              -1    [-1,4]
        Boolean            loop             false
        Boolean            next
        Boolean            previous
        sequence<float>    values           []   (-∞,∞)   
    }

The channels field consists of a list, for each joint, of the number of channels for transformation, followed by the transformation type of each channel of data for that joint. Each value shall be separated by a comma and/or one or more spaces. Channels within a given Motion object are enabled by default, unless otherwise indicated by the corresponding Boolean entry in the channelsEnabled field.

The description field describes the type of motion being controlled by the Motion object.

The enabled field determines whether the Motion object is allowed to run. Note that the corresponding boolean value in Humanoid object's motionsEnabled array shall also be true for Motion object animation to occur.

The frameCount field indicates the number of frames present in the animation, equaling the number of sets of channel data present in the values array.

The frameDuration field specifies the duration of each frame, in seconds. The value of frameDuration shall be greater than zero.

The frameIncrement field controls whether playback direction is forwards or backwards, and also whether frames are skipped (e.g. subsampled replay). For a single animation step, the next frameIndex value equals (frameIndex + frameIncrement) modulo frameCount. Note that setting frameIncrement to 0 prevents automatic advancement of frameIndex and pauses animation of the Motion object.

The frameIndex field indicates the index of the current frame. Note that frameIndex can be modified whether the Motion node is enabled or not, and becomes effective when the next animation cycle occurs. The frameIndex value indicates the frame currently (or next) being processed. It starts at 0 and is no greater than (frameCount - 1). Values less than 0 are reset as 0. Values greater or equal to frameCount are stored as (frameCount - 1). Thus the value of frameIndex shall be greater than or equal to zero, and less than frameCount.

The startFrame and endFrame fields indicate the index numbers for the initial and final frames that are animated by the Motion node. Note that startFrame can precede, equal or follow endFrame. The default endFrame value is reset to (frameCount - 1) whenever frameCount is changed. Similar to frameIndex, the values of startFrame and endFrame shall be greater than or equal to zero, and less than frameCount.

Receipt of a next event with value true triggers the next set of enabled channel animation values to be applied by the Motion object. Receipt of a previous event with value true triggers the previous set of enabled channel animation values to be applied by the Motion object. Sending a false event to the next or previous fields has no effect. These trigger events "wrap around" after reaching the boundary of startFrame and endFrame; i.e., next goes to startFrame after endFrame, and previous goes to endFrame after startFrame.

The loop field controls whether automatic repetitions occur. The Motion object executes in cycles, where a cycle is defined as a complete execution through endFrame. If, at the end of a cycle, the value of loop is false, execution is terminated. Conversely, if loop is true at the end of a cycle, the Motion object continues execution into the next cycle at startFrame. Thus, Motion object animation with loop true at the end of every cycle continues cycling indefinitely.

The cycleTime field sends a time event at initial starting time and at the beginning of each new cycle, which is useful for synchronization with other time-based animation objects.

The elapsedTime field delivers the current elapsed time since the Motion object was activated and running, cumulative in seconds.

The joints field lists the names of the joints in the HAnim figure that the raw motion data is to be applied to. The number and order of the names in the joints field shall match the number and order of the channels field information, and the number and order of the sets of values in the values field for each frame of the animation. Each value shall be separated by a comma and/or one or more spaces. The joint name "IGNORED" shall be used for a channel of the motion data that is to be ignored and not used for any joint.

The channels field supports the following transformation types: Xposition, Yposition, Zposition, Xrotation, Yrotation, and Zrotation. The "X", "Y" or "Z" in each transformation type refers to the axis that the transformation is to be applied to, the axes being in the local coordinate system of the object that that is being transformed. The "position" type is a simple linear translation. The "rotation" type is a rotation about the object centre, as represented by the center field. The three axis rotations together form a vector rotation, and ordering of the axes shall be carefully specified to match the ordering in the data values.

The channelsEnabled field contains a list of Boolean values which indicate whether the corresponding channel is active. The order of values in the channelsEnabled field shall correspond exactly to the the order of the channels listed in the channels field. Excess channelsEnabled values shall be ignored.

The loa field describes the Level Of Articulation to which the contained Motion object complies (the given LOA number, 0 through 4). A value of -1 indicates that no such correspondence occurs.

The values field contains all of the transformation values. The transformation values are ordered, first by frame, then by joint, and then by transformation, matching the order listed in the joints and channels fields.

EXAMPLE  An example of a Motion object is shown below.

    Motion {
        frameCount 392
        frameDuration  0.033333
        joints     "humanoid_root, l_hip, l_knee, l_talocrural ... "
        channels   "6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
                    3 Zrotation Xrotation Yrotation
                    3 Zrotation Xrotation Yrotation
                    3 Zrotation Xrotation Yrotation
                       ...                             "

        channelsEnabled   " true true true true true true true
                                 true true true
                                 true true true
                                    ...                "

        values    [ 10.3057    -1.63714 -234.161       -1.71934   31.9599   -6.4756
                                                        1.34194  -18.7015    4.15894
                                                        1.52962  -15.6516   -4.43325e-07
                                                        0.813316   1.35999   0.450168
                                                            ... 

                    10.3173    -1.5332 -234.137        -1.77099   32.1937   -6.36943
                                                        1.43282  -18.9194    4.06241
                                                        1.49589  -15.646    -4.43313e-07
                                                        0.993604   1.76838   0.542786
                                                           ... 

                      ... 
                  ]
    }

The first block of transformation values is for the first frame, frame 0. The next block is for the second frame, frame 1. Within each block, the first row of values are the six values for the first joint, "humanoid_root". The second row of three values is for the next joint, "l_hip". And so on.

NOTE  The order of the joints specified in the joints field is not required to match the order of joints in the HAnim figure hierarchy.

cube 6.4 Extended definition of Humanoid object

The definition of the Humanoid object presented in ISO/IEC 19774-1 is extended by the addition of two new fields, namely motions, and motionsEnabled. The extension to the interface definition of the Humanoid object is listed below.

    interface Humanoid {
        #-- Fields defined in  ISO/IEC 19774-1 --#

            ...

        #-- Fields defined in this document --#

        int                loa                   -1           [-1,4]
        sequence<Object>   motions               []           [Motion]
        sequence<Boolean>  motionsEnabled        []
    }

The motions field contains a list of references, one for each Motion object that is to be applied to the Humanoid object. The order in which the motions are listed does not affect animation behaviour since the names and corresponding channels of the target Joint objects are stored in the Motion objects themselves. Motion objects are enabled by default, unless otherwise indicated by the corresponding Boolean entry in the motionsEnabled field.

The motionsEnabled field contains a list of Boolean values which indicate whether the corresponding Motion object is active. The order of values in the motionsEnabled field shall correspond exactly to the the order of the Motion objects listed in the motions field. Excess motionsEnabled values shall be ignored. Note that the corresponding Motion object's enabled field shall also be true for object animation to occur.

All other fields are as specified in ISO/IEC 19774-1.

cube 6.5 Joint mapping

The joint mapping procedure detailed in 4.4 HAnim joint mapping for motion-capture animation shall be applied to the raw motion data. For those channels that are to be applied to a joint, the name of the joint shall be added to the joints field. For channels that are to be ignored, the reserved name "IGNORED" shall be added to the joints field, instead of a joint name. The details of the transformation types in the channels field shall be present, irrespective of whether the channel data is ignored or not.

EXAMPLE  The listing below is an excerpted example including channels that are to be ignored. The full listing of this example is in Annex D.

    <HAnimMotion frameCount="392" frameDuration = "0.033333"
                 joints="humanoid_root l_hip l_knee l_talocrural r_hip
                         r_knee r_talocrural vl5 IGNORED l_shoulder
                         l_elbow l_radiocarpal IGNORED r_shoulder r_elbow
                         r_radiocarpal IGNORED skullbase"
           channels="
                     6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation
                     3 Zrotation Xrotation Yrotation"

          values=" ... " />

cube 6.6 Example Usage of Motion object

An excerpted example of specifying motion data animation using Joint and Motion objects in an X3D context is shown below. The full listing of this example is reproduced in Annex D.


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd" >
    <X3D profile="Immersive" version="3.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
                                                                    xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.3.xsd" >  

      <Scene>
        <NavigationInfo speed="1.5" type='"EXAMINE" "ANY"' />
        <Viewpoint centerOfRotation="0 1 0" description="KoreanCharacter01Jin" position="0 1 3" />

        <HAnimMotion DEF="hanim_motion"
                     frames (field frameCount) ="392" frameDuration = "0.033333"
                     joints="humanoid_root, l_hip, l_knee, l_talocrural, ... "
                     channels = "6, Xposition, Yposition, Zposition, Zrotation, Xrotation, Yrotation, 3, Zrotation, Xrotation, Yrotation, 
                                 3, Zrotation, Xrotation, Yrotation, 3, Zrotation, Xrotation, Yrotation, ... "
                     values = " 216.2124 79.0651 -64.9335 25.9900 ...
                                213.6236 79.3328 -62.7254 26.2000 ...
                                211.0620 79.5786 -60.2245 26.1500 ...

                                                        ...

        " />
           

        <HAnimHumanoid DEF="hanim_HAnimExample6.4" info="humanoidVersion=2.2" name="HAnimExample6.4"
                       scale="0.0225 0.0225 0.0225" version="2.0" motionsEnabled="true" >
          <HAnimMotion USE="hanim_motion" />
          <HAnimJoint DEF="hanim_humanoid_root" center="0.000000 30.530001 -0.707600" name="humanoid_root" containerField="skeleton" >
            <HAnimSegment DEF="hanim_sacrum" name="sacrum" >
              <Transform translation="0.000000 30.530001 -0.707600" >
                <Shape>
                  <Appearance>
                    <Material diffuseColor="0.588000 0.588000 0.588000" />
                    <ImageTexture DEF="KoreanCharacter01JinTextureAtlas" url="Jin.png" />
                  </Appearance>
                  <IndexedFaceSet creaseAngle="3.14159" coordIndex="0, 1, 2, -1, ... "
                                                        texCoordIndex="0, 1, 2, -1, ... " >
                    <Coordinate point="0.0000 10.7900 0.1424, 0.0000 ... " />
                    <TextureCoordinate point="0.6211 0.5754,0.7851 0.5720, ... " />
                  </IndexedFaceSet>
                </Shape>
              </Transform>
            </HAnimSegment>

                ...
            
          </HAnimJoint>
          
        </HAnimHumanoid>
            
      </Scene>
   </X3D>

--- HAnim separator bar ---