Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Bwian's Guide to the Infinite Possibilities of Animations

  1. #1

    Default Bwian's Guide to the Infinite Possibilities of Animations

    Or, a tutorial on how to use and abuse the tools we have to do strange an wonderful things, coupled with the many ways I broke KnightErrants GOAT toolkit, the things he did to fix it and make it Bwian proof, and the things I discovered it could de that KE had not intended, but I went ahead and did anyway!

    This will be a series of posts building up a knowledge base, and outlining what we know, backed up nby some realtime development projects so you can see the steps in action.


    Part 1: The Known Universe of Animation.

    I want to open this with a look at the basic structure of the MESH / Animation relationship, and how things link together. This is an area that os often not well understood, and ends up with people confusing themselves horribly.

    What is where?

    First, you need to understand what the structure of the models and animations is and how they are linked. The game uses a skeletal structure that is animated to make the game models walk, fight, die etc. The animation files contain that skeleton, and the data that tells the game how it will move. The MESH file contains the actual model geometry. Each vertex of the model is ‘rigged’ to a bone so that when the bone moves, the surface of the 3D model moves. Each vertex can be influenced by more than one bone, and in varying degrees. This allows the model to move in more natural ways than was possible with RTW, where a vertex could only be moved by a single bone. Important note…

    THE MESH FILE DOES NOT CONTAIN THE SKELETON

    Don’t forget this. When you create a model in MS3D, you will have seen a skeleton in there, and rigged the vertices to it….so it must be there, I hear you say. No. That is provided by the model importer when the MESH is converted to MS3D format. It is there purely so you CAN rig the model. Bone data is only used to tell the game which bone affects which vertex.

    When we begin to modify things, it is important to understand this, since the links between the MESH and the animation CAS file must be right for all to work.

    Summary:

    MESH – model geometry, skin rigging

    CAS – animation file, containing skeletal data and rotation / position data for the bones.

    Move a bone in an animation, and the MESH will follow if rigged to it. Rig a vertex to 2 bones and it moves proportionally with either bone movements. Just like a real skin.

    A picture of the different parts of the mesh and cas files is shown here:



    We trace the way vertex <3> (that’s just an index for it) gets moved. It is paired with a primary bone assignment number of 6 (we’ll ignore its secondary bone assignment for this). Number 6 corresponds to the bone string “bone_head”. That’s the only skeleton information in a .mesh file. That bone string gets paired up with the information in the .cas file. In particular, there is offset to the quaternion rotation data
    1824, and another offset to its position data at offset 7448. This is the mechanism the game uses to know how to move a given vertex. The other information needed is shown in green, one has to construct the skeleton using the hierarchy tree and the bone offsets at the bottom of the .cas file. We’ll treat that in a moment when we discuss the .cas file format after it has been converted to a .txt representation.

    This is quite technical stuff in places, but it hopefully serves to clarify how the various parts fit together. We need to have a basic understanding of this before we look at the individual parts, or we risk confusion. I know....a sentance with words like Quaternions and Offsets in it is confusin enough...but I am talking about real confusion here!


    Part 2: Tools to open Pandora's Box of animations

    OK..to do the next bit, you will need to get some tools in your toolbox. You will need to obtain the latest version of KnightErrant’s GOAT toolbox. This contains the means to do all the things we will need to do. Also, you will require a recent version of Milkshape 3D (version 1.8 onwards) with the ‘zero rotations’ plugin present. We will cover what this is and does later on, but suffice to say, if you don’t have it…bad things will happen and frustration is the certain result!

    Also required are the stock animations supplied by Caliban and downloadable form TWCenter.net. These provide the building blocks from which we will work.

    Checklist:

    1) Latest version of GOAT – free download
    2) Python framework (pre version 3) – free download
    3) Milkshape 3D plus plugin - not free but worth it
    4) Notepad (or preferred equivalent) – free download
    5) Full set of animations – free download
    6) This guide!

    CAS Files

    In order to look at the data in a CAS file, you first need to convert it into a format that a human can read. More advanced beings like KnightErrant have made this possible, and should be suitably venerated for their skills. Using GOAT, you can turn any of the standard CAS files into a text file, and play around with the contents. These animation files also contain some useful hooks into other things, such as where riders are attached to mounts, and some of the hard coded behaviour for the mount classes. If the game thinks it’s an elephant, it will let it do elephant things. So, let us look at what an animation file is made up of:

    The first line should look something like this:

    3.210000 38 9 0 2.20000004768 1 0 104 104 104 1 0 104 104 104

    The 1st number (red) is the animation version number. Whilst playing about with some of the unused animations, I have found older versions lurking around, but these do not work well with the game. Changes have been made in formats. It is a guide.

    The 5th number, (blue) is the animation duration in seconds. The example animation takes 2.2 seconds to run. Standard animations run in 0.05 second frames, which is 20 frames per second. The animation in the example has 45 frames ( 44x0.05 plus start frame) The last part of interest here is the section in green. This is the header part which tells the game what sort of unit the animation is for. Human, Elephant, Horse etc. A matching footer is needed, but by changing this, you can do some quite interesting things!

    The next line should look something like this:

    30749 0
    The number is red is the chunk size of the animation. I am not sure how critical this number is when editing or converting. The number after it is always 0.

    The next line should look like this:

    24 0 0 1 2 3 4 2 6 7 1 9 10 11 12 9 14 9 16 1 18 19 1 21 22

    The number in red is the total number of bones in the model. This is made up of a Scene Root bone, plus, in this case, 23 actual model bones. The limit for model bones has been found to be 25. Problems occur in terms of display if more than 25 model bones are put in a model. The numbers that follow it are the hierarchy tree for the bones. Both the model and scene root bones are always zero. The numbers relate to the bone names below in order. If you cross-check, you will see that value 1 bones attach directly to root, and so on. This controls the order in which rotations are applied, and MUST be correct if your model is to move as intended. When making custom models, the extract skeleton function in GOAT will create a text extract that shows this structure for a custom model.

    Let’s do a quick example for the human skeleton just to make this more concrete. If you number all the bones in order with a zero-based index you obtain a list like this:

    Bone Bone Name
    Index Array
    0 Scene Root
    1 bone_pelvis
    2 bone_RThigh
    3 bone_Rlowerleg
    4 bone_Rfoot
    5 bone_abs
    6 bone_torso
    7 bone_head
    8 bone_jaw
    9 bone_eyebrow
    10 bone_Rclavical
    11 bone_Rupperarm
    12 bone_Relbow
    13 bone_Rhand
    14 bone_Lclavical
    15 bone_Lupperarm
    16 bone_Lelbow
    17 bone_Lhand
    18 bone_LThigh
    19 bone_Llowerleg
    20 bone_Lfoot


    Now put the hierarchy tree or array next to it and fill in the corresponding names. Then you get this list:


    Bone Bone Name Hierarchy Parent Bone
    Index Array Array Name Array

    0 Scene Root 0 No parent, by convention a 0 goes here
    1 bone_pelvis 0 Scene Root
    2 bone_RThigh 1 bone_pelvis
    3 bone_Rlowerleg 2 bone_RThigh
    4 bone_Rfoot 3 bone_Rlowerleg
    5 bone_abs 0 bone_pelvis
    6 bone_torso 5 bone_abs
    7 bone_head 6 bone_torso
    8 bone_jaw 7 bone_head
    9 bone_eyebrow 7 bone_head
    10 bone_Rclavical 6 bone_torso
    11 bone_Rupperarm 10 bone_Rclavical
    12 bone_Relbow 11 bone_Rupperarm
    13 bone_Rhand 12 bone_Relbow
    14 bone_Lclavical 6 bone_torso
    15 bone_Lupperarm 14 bone_Lclavical
    16 bone_Lelbow 15 bone_Lupperarm
    17 bone_Lhand 16 bone_Lelbow
    18 bone_LThigh 0 bone_pelvis
    19 bone_Llowerleg 18 bone_LThigh
    20 bone_Lfoot 19 bone_Llowerleg

    And now you can see the child to parent relationship that forms the skeleton. You can do the same exercise with the elephant hierarchy

    24 0 0 1 2 3 4 2 6 7 1 9 10 11 12 9 14 9 16 1 18 19 1 21 22

    using the elephant bones listed below and find out how they are wired together to form the elephant skeleton.


    The next line should look like this. It will be longer than shown, since I trimmed it to fit the page!

    45 0.00000 0.05000 0.10000 0.15000 0.20000 0.25000 0.30000 0.35000

    The line shows the total number of frames, followed by the ‘time ticks’ at which each frame of animation plays. As we established earlier, there are 45 frames. The start frame is at 0.0000 and they then go up in increments of 0.05 until they reach 2.2 (the total animation runtime) Unless you wish to change the duration of the animations, these do not need altering.. The 0.05 is fixed, but you can reduce the number of frames in an animation to speed it up.

    The next block is the part which defines the skeleton:

    Scene Root 0 0 0 16560 0 1 0
    bone_E_platform 45 45 0 16560 0 1 0
    bone_E_back 45 45 720 17100 0 1 0
    bone_E_right back thigh 45 45 1440 17640 0 1 0
    bone_E_right back lower leg 45 45 2160 18180 0 1 0
    bone_E_right back foot 45 45 2880 18720 0 1 0
    bone_E_left back thigh 45 45 3600 19260 0 1 0
    bone_E_left back lower leg 45 45 4320 19800 0 1 0

    This is only a portion of it, but it is enough to show what the thing is made up of. The first column os the actual bone name. If you are editing a model in MS3D and want to add a bone, or change bones name, you must make the corresponding changes in the text file to keep the animation data and model data the same. Though there are no bones in the mesh, it must have correct links to the animation. If I changed the bone_E-platform to bone_saddle in the text file, the game would not be able to make the link between MESH and animation. Be careful if you are changing things here!

    The next column is the number of rotation frames for that bone. If there are no rotations, the value is zero. Otherwise, it should equal the number of frames. Each animation should have the same number of frames, or else a zero value. In this case, each is 45 except the root which has 0.
    The column after is the positional frames. These are numbered either for the number of positional frames, or zero. In this example, there are positional frames for all the frames except root, so all are 45 except root which is zero. Again, the value should either be the total number of frames or zero.

    The next column is a little more complex. This points to where in the animation file the data for that bones rotations are held. The calculation is:

    Frames x 4 x 4

    In our example, it is 45x4x4 = 720

    When you look at the numbers, the root starts at 0, and then goes up by increments. The first increment is zero, since the root bone has a zero value for rotations. The next bone has rotations, so the number is 720, giving the correct offset to point to the Quaternion movements for the rotations of the bone. The last bone value in our elephant_walk example is 15840, which is the start point for the last rotations. The next column starts at 16560 … exactly 720 on from the last block’s start point.

    The 4th column is the offsets that tell the animation where the positional data is. It starts after the last chunk of rotations, as detailed above. The increments, however, are NOT the same. Where the 2nd column was zero, the number does not increase. There is no data, so the number does not alter. Where the frames have positional data, the number has gone up by 540, not 720. The value is:

    Frames x 4 x 3

    In our example, it is 45x4x3 = 540

    The positional data has only 3 elements, not 4…hence the reduction. If you are changing the number of frames, or reducing / increasing the number of bones, the offsets for the data have to be re-calculated. The maths isn’t complex, but an error here means that the CAS file will apply wrong rotations, or will fail to convert back to CAS when you have edited it.

    The bulk of the rest of the CAS file is made up of the actual rotational and positional data. For rotations, there are 4 columns for the quaternion values. These are the ones the game uses, but they are not logical x/y/z numbers. Thankfully, KnightErrant has also added in the x/y/z numbers that relate to the axes in the MS3D model, with similar orientation.. When the text file is converted back into a CAS file, GOAT ignores the quaternion values in the text files, and recalculates them from the other values. ONLY change the x/y/z euler values, or your changes will be ignored when you convert back to CAS.

    The positional values show proper values ONLY for the root bone for the model, bone_E_platform for the elephant. There are no values for scene root as noted earlier. All the other positional values are either zero or very small numbers which are, effectively, zero values. The game is moving the root bone only, and rotating the joints relative to that point to animate the model.

    The last piece of data in the animation file is the footer. These, as with the header portion, are specific to the type of unit the animation is for. I do not confess to know what the numbers do or mean, but they can be copied and pasted. Keep them paired with the correct header or problems occur which will prevent correct conversion back!

    This leads us on to the creation of whole new skeletons and custom animations to go with them. It’s slightly more involved, but it is easy enough to do once you understand what is going on. I have begun to do a lot of the animation using the basic text files, since you end up with neat absolute rotations. I still do key-framing in a modelling program for brand new stuff, but there is the opportunity to save a lot of time and effort with text editing…as I hope to show in this section!

    Edit due to slight change of plan .... Tutorial 1 is now : ADDING A NEW BONE
    and continues in my next post
    Last edited by Bwian; February 27, 2009 at 02:12 PM.

  2. #2

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Bravo m8!!
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  3. #3

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    nice one. finally someone has 'manned up' to explaining animations for the layman !

  4. #4

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Adding Bones:

    This is the easiest thing we can do with an existing skeleton! For our example, we are using one of the special mounts that will feature in the Warpstorm mod, namely the Mech-Horse. Part robotic horse, part wheeled vehicle. Clearly, we can use the bulk of the stock horse, but will use a wheel in place of the back legs. To make it a more useful excercise, we are adding two rotating axles to the skeleton, since we also want to make a unit with a motorcycle outfit setup as an outrider unit.

    Step 1:

    Convert a stock horse MESH file to MS3D format. This will form our starting point. The object once opened up in MS3D looks just an ordinary horse. So, we begin surgery! The picture below shows the initial stage. The horse mesh has been removed and replaced with the new design. This gives us the location point for the axle. Select bone_H_saddle, and add the first bone using hte JOINT tool. Click in the centre of the axle, and the bome is created parented off the root bone. The second 'front axle' is created in the same way. Make sure you select the bone you want your new bone to be a child of...otherwise you will get some unfortunate side effects!



    The object should be rigged so that all the 'wheel' vertices are assigned to the axle only. No shared vertices. They are going to rotate fully, so they have to be effectively a seperate thing. The rest will be rigged exactly as per the horse, so the front legs will walk, rear up etc. Just the effect I want! Don't forget to apply textures and comments etc. to make your model complete and ready for conversion.

    Next we ZERO ROTATIONS before saving the MS3D file. I have called this mount_robot_horse_lod0 ... GOAT requires horses etc. to be called 'mount_xxxx and lod0 tells us this is the high detail model.

    Step 2:

    Fire up GOAT and use the EXTRACT SKELETON function. This will drag out the hierarchy and create a small file which can then be applied using the EXPORT function to the stahdard horse animation set.

    Code:
    +0.00000000, +0.00000000, +0.00000000,   0, bone_H_Saddle
    -0.00014528, -0.01519670, +0.44460601,   1, bone_Spine
    -0.00065352, -0.02455010, +0.41982704,   2, bone_Spine1
    -0.00084674, +0.01397935, +0.54702592,   3, bone_Neck
    -0.00716516, +0.57772392, +0.47365093,   4, bone_Head
    +0.25372872, -0.27159521, +0.59311390,   3, bone_RightArm
    +0.00014734, -0.32052541, +0.01929700,   6, bone_RightForeArm
    +0.00003922, -0.49611592, +0.03031802,   7, bone_RightHand
    +0.00059372, -0.36607993, +0.02219498,   8, bone_RightFingerBase
    -0.25551268, -0.27159601, +0.59231591,   3, bone_LeftArm
    -0.00003007, -0.32051995, +0.01931012,  10, bone_LeftForeArm
    +0.00024915, -0.49612296, +0.03023636,  11, bone_LeftHand
    +0.00003684, -0.36608100, +0.02229321,  12, bone_LeftFingerBase
    +0.00026885, +0.01947440, -0.29318500,   1, bone_Tail1
    +0.00084117, -0.31957081, -0.36364758,  14, bone_Tail2
    +0.22479901, -0.23211400, -0.15847600,   1, bone_RightUpLeg
    -0.00010441, -0.37856197, +0.00399545,  16, bone_RightLeg
    +0.00007874, -0.44509798, -0.00006124,  17, bone_RightFoot
    -0.00047158, -0.60247231, +0.00007652,  18, bone_RightToeBase
    -0.23395200, -0.22297600, -0.15835699,   1, bone_LeftUpLeg
    +0.00000000, -0.38769999, +0.00315930,  20, bone_LeftLeg
    +0.00004357, -0.44509798, -0.00006589,  21, bone_LeftFoot
    -0.00044730, -0.60247231, +0.00008832,  22, bone_LeftToeBase
    +0.00000000, -1.24590778, -0.63358152,   1, bone_backwheel
    +0.00000000, -1.24590778, +1.86937714,   1, bone_frontwheel
    When you choose export skeleton, it will first ask for the skeleton file you extracted, then the folder containing the animations. It will apply your new skeleton to all the animation s in that folder and create a new sub-folder with your converted files in it.

    Congratulations...you have now created a new skeleton and animation set with a new bone in it. Easy....wasn't it.

    Step 3:

    Now we have to make it so the game can use our new animations. Create a new folder called fs_robhorse in data/animations and put all your new animations in it. Next, go to descr_skeleton and copy the entire entry for fs_horse. We have created a modified version using that as a base, so we should borrow the structure directly since this contains all the actions a horse should be doing as far as the game is concerned. Change all the file references so they point at fs_robhorse, not fs_horse, and save that. I find it easiest to copy the fs_horse function into a blank notepad instance, and use find/replace to change all the file references in one go. Then paste the chunk back into descr_skeleton. Re-create the animation packs and that makes your skeleton set exist.

    Put your model into the modeldb file with new fs_robhorse animation and a new entry and set up a new mount in descr_mounts. A quick modification to the EDU file, and you can have your mount in game. Not something an experienced modder should struggle with.

    But...hang on .... the new bits don't move!

    Step 4:

    Of course they don't move! The GOAT toolbox has added a new bone, but by default, it sets all the animations to 0. The image here shows the text version of the CAS file with the new bone structure clearly visible.

    Code:
    3.210000 38 9 0 1.0 1 0 0 0 0 1 0 102 102 102
     16343   0 
     26 0 0 1 2 3 4 3 6 7 8 3 10 11 12 1 14 1 16 17 18 1 20 21 22 1 1
     21  0.00000  0.05000  0.10000  0.15000  0.20000  0.25000  0.30000  0.35000  0.40000  0.45000  0.50000  0.55000  0.60000  0.65000  0.70000  0.75000  0.80000  0.85000  0.90000  0.95000  1.00000 
              Scene Root   0   0      0   8400   0   1   0 
           bone_H_Saddle  21  21      0   8400   0   1   0 
              bone_Spine  21  21    336   8652   0   1   0 
             bone_Spine1  21  21    672   8904   0   1   0 
               bone_Neck  21  21   1008   9156   0   1   0 
               bone_Head  21  21   1344   9408   0   1   0 
           bone_RightArm  21  21   1680   9660   0   1   0 
       bone_RightForeArm  21  21   2016   9912   0   1   0 
          bone_RightHand  21  21   2352  10164   0   1   0 
    bone_RightFingerBase  21  21   2688  10416   0   1   0 
            bone_LeftArm  21  21   3024  10668   0   1   0 
        bone_LeftForeArm  21  21   3360  10920   0   1   0 
           bone_LeftHand  21  21   3696  11172   0   1   0 
     bone_LeftFingerBase  21  21   4032  11424   0   1   0 
              bone_Tail1  21  21   4368  11676   0   1   0 
              bone_Tail2  21  21   4704  11928   0   1   0 
         bone_RightUpLeg  21  21   5040  12180   0   1   0 
           bone_RightLeg  21  21   5376  12432   0   1   0 
          bone_RightFoot  21  21   5712  12684   0   1   0 
       bone_RightToeBase  21  21   6048  12936   0   1   0 
          bone_LeftUpLeg  21  21   6384  13188   0   1   0 
            bone_LeftLeg  21  21   6720  13440   0   1   0 
           bone_LeftFoot  21  21   7056  13692   0   1   0 
        bone_LeftToeBase  21  21   7392  13944   0   1   0 
          bone_backwheel  21  21   7728  14196   0   1   0 
         bone_frontwheel  21  21   8064  14448   0   1   0
    and the corresponding animation movement text:

    Code:
    23 bone_backwheel  quaternion data and Milkshape euler angles
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    24 bone_frontwheel  quaternion data and Milkshape euler angles
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000      +0.0000000000  +0.0000000000  +0.0000000000
    You now have to tell it how to move the bone. There are two ways to do this

    a) Animerge: For each animation, run animerge from the GOAT tools and create an MS3D file that represents that movement. For each frame, add in the rotations you want for the new bone, and save the result. Extract the animation from the modified MS3D file to re-create the CAS file.

    b) Convert each frame into TXT using the cas2txt function, and manually add the rotations. Since this is a mathematical function for my rolling axis, I have opted for this approach. Use what fits best. I can also directly pinch the rotations I used in the chariot set that I did before. Saves a whole load of time!

    With all the CAS files modded, re-create the animation packs again, and now your wheels should turn! Thats all there is to it. Next job is to learn how to take bones away! This is a slightly more involved process that builds on what we have done here. We have discovered a 25 bone limit seems to exist, so there will be times when you want to remove the unwanted bones in a stock skeleton to give you more headroom to add ones you want. If you create a 'pegasus' skeleton, you would not need to worry about the hooves moving so much...so you could remove those to make the wings flap more realistically etc. So...next we will look at how you would actually do this!

    p.s. Check out the Curse of the Warpstorm thread in 'WIP Mods' to see how the robot horse has turned out

  5. #5
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Good job. This will help us compete with ETW! (Btw it would help other members if you had more screenshots or movie captures)


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  6. #6

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    I know what you mean SigniferOne, but I have 2 issues at the moment.
    1) I think my modem is dying and it took me over anhour just to get the next bit of the tutorial and 1 picture uploaded ...chronic unexplaind slowness
    2) I am not sure what level to pitch this at. Anyone who doesn't know the detail of modding meshes and running modded games will really get out of their depth quickly! I don't know whether to include those things or assume the reader will read the GOAT manual that tells them how to do the steps etc.

    It's a tricky call. The tutorial ends up huge that way too!

    IMPORTANT THING BEFORE I FORGET:

    CREDITS

    This tutorial would not have been possible without the tireless input of KnightErrant, designing tools, telling me how they worked and generally not getting fed up with a constant stream of dumb questions. He has provided me with customised versions of GOAT to explore new frontiers and do new things, and these changes are now being put into a new release version so you can have them too. This tutorial is my humble attempt at passing on what I have learnt so that others may take up the challenge of making the extraordinary work in M2TW. Grumpy Old Man lead the way to break the model format and open the modding door, and KnightErrant has done the same with animations. Long live the toolbuilders!

  7. #7

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    I think its pitched at just the right level for me (slightly too high ), it provides more of a challenge. It would be great if you could take us through some more examples...perhaps simpler task like resizing an entire skeleton. Or perhaps run a class at the TWC University ?

  8. #8

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Re-Sizing a skeleton is quite a simple task, and something I can add pretty much right now!

    Scaling Up a Skeleton

    If you want to make a unit that is a little larger than the ordinary, there are 2 ways this can actually be done. You can either enter a scaling factor ( you can see this done in stock form for the horse model) or you can physically make the bone positions and build a new skeleton. If you just want to scale up, then option 1) is the way to go. If you want to change the proportions, then option 2) is for you! You can, of course, mix the 2 things together and use a hybrid approach too.....just to make things sound confusing!!!!

    Scaling Factor:
    When you look at descr_skeleton entry for the horse, you will see a scale entered just after the actual bone description. This shows :

    scale 1.12

    This scale factor is applied to the skeleton and animations, scaling up the bones and pivots by the given factor. If you apply a scale to a human skeleton set...say MTW2_Maceman, then re-create the animation packs, you will see exactly what this does.

    Your unit now looks like a deformed stick insect for starters! This is because the scaling factor is applied to the bones and pivots only, not the mesh. As detailed earlier, the animations are linked to the mesh files through the bone names...and now the bones are stretched and moved into places that do not fit the mesh.

    Now, if you open up MS3D and choose the model you wish to use your scaled up animations you can change the model size. Scale up the MS3D file by the same factor in x,y,z that you entered in the animation. MAKE SURE YOU SELECT ORIGIN as teh scale option. The mesh must scale equally from the same point of reference that the animations will scale from, or you will get a very poor result! The mesh will not line up with the skeleton now in MS3D...but do not worry. If you have read teh first part of this theread, then you will know that there is no skeleton in the MESH file.

    Save the MS3D and convert to MESH using GOAT or GOM's convertor. They will both work.

    In the modeldb file, you will also notice in the horse model that the line before the mesh descriptions is shown as 1.12 not 1. I am not sure exactly how this influences the scale, but I enter teh value here as well for my new model. So...change the animations to your upscaled ones, the mesh to your scaled up ones and the value to your scaling faxtor ( the one you have used for the other tasks)

    When you run things together, you will now find your new unit has been scaled up.

    A word of caution here though. If you make a unit scaled up by a large amount, you will find there are unfortunate side effects. The unit will engage in combat with normal people on a one-one basis....it will react as if the opponent were in front of it at normal scale, not huge, and will generally behave as if it was a normal sized person. Not helpful if he is supposed to be 30' tall! There is a way round this.....but it involves more cunning Frankenmodding

    Option 2:
    Just make a whole new skeleton that fits your model! If the model is huge, then you can move the pivot points to wherever you choose and just export the skeleton. If you are not adding or removing bones, then this is a straighforward task.

    Position the joints where you want and ZERO ROTATIONS. This is an essential part and is detailed quite well in a tutorial that comes in the GOAT manual.

    Extract the enlarged skeleton from the MS3D and apply to your chosen animation set. Then just set up the new animations with no scale factor used anywhere and link up to the MESH through modeldb as you would for any new unit. It really is that simple!

    I tend to use a bit of a hybrid approach sometimes too. If you want a series of skeletons at various scales to represent juvenile, adult and BIG versions of a creature ( I am using this approach for my Beast Masters faction in Warpstorm) then you can create an animation set geared to the position of hte bones that fits the anatomy of the creature, and then make a couple of scaled versions of this. It saves on time and trouble and also avoids an error that can creep in with skeleons where the weapon bone loses it's alignment with the hand bone.....

    As a starting point for playing with skeletons, scaling up is a good place to start.

  9. #9
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Really excellent stuff Bwian. I still think that a few images would be nice to illustrate the opening post...


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  10. #10

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Thanks Bwian, thats exactly what I was looking for. Now I just have to try it myself ! You don't take requests do you ?

  11. #11

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Yelu Dashi, let me know if you get stuck..I am sure I can help

  12. #12

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Creating a Foot-Soldier pistolier

    Since the HR_Pistol animation has all the hand/arm movements that we want, we will endeavour to merge this with a musketeer to make a pistol animation set for foor troops.

    Step one is to create our unique set to start working from. We do this by copying the HR_Pistol folder and renaming it 'Pistol'. This
    gives us a set of animations we can modify without risk of messing up our stock game. Next, we take the descr_skeleton text file
    and create for ourselves a new entry by simply copying the HR_Pistol entry and re-naming it a bit:

    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    type			MTW2_Pistol
    reference_points						siege_engines/UnitModelsRefPoints/Arquebus_Ref_Point.modelReferencePoints
    parent			MTW2_Musket
    no_deltas
    in_awareness		135.0
    in_zone			135.0
    in_centre		45.0
    
    ;;; HR_Pistol_attacks
    
    anim		attack_missile_ready				data/animations/Pistol/HR_Pistol_attack_missile_ready.cas						-evt:data/animations/HR_Pistol/HR_Pistol_attack_missile_ready.evt
    anim		attack_missile_hold				data/animations/Pistol/HR_Pistol_attack_missile_hold.cas									
    anim		attack_missile_release				data/animations/Pistol/HR_Pistol_attack_missile_release.cas			-id:0.0, 1.5, 1.0	-evt:data/animations/HR_Pistol/HR_Pistol_attack_missile_release.evt
    
    anim		attack_missile_reload				data/animations/Pistol/HR_Pistol_attack_missile_reload.cas						-evt:data/animations/HR_Pistol/HR_Pistol_attack_missile_reload.evt
    
    ;;;	Weapon
    
    type		MTW2_Pistol_Primary
    suppress_refpoints_warning
    in_awareness		135.0
    in_zone			135.0
    in_centre		45.0
    
    anim		default						data/animations/Pistol/weapon/w_HR_Pistol_default.cas
    anim		stand_a_idle					data/animations/Pistol/weapon/w_HR_Pistol_fs_horse_stand_a_idle.cas
    
    anim		attack_missile_ready				data/animations/Pistol/weapon/w_HR_Pistol_attack_missile_ready.cas
    anim		attack_missile_hold				data/animations/Pistol/weapon/w_HR_Pistol_attack_missile_hold.cas
    anim		attack_missile_release				data/animations/Pistol/weapon/w_HR_Pistol_attack_missile_release.cas		-id:0.0, 1.5, 1.0	
    
    anim		attack_missile_reload				data/animations/Pistol/weapon/w_HR_Pistol_attack_missile_reload.cas
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    The set has been given unique names and the folder re-named so we know it will point to the new folder, not the old. Delete the
    old animation packs and re-run it. This will generate the animation packs with our new entry. I applied this to a unit and gave it a test.
    It doesn't work...for one VERY good reason! The horse anims are geared differently and the end result is the unit drops into the ground and we can't even see teh hands to know if it
    will work! I expected this....so I move swiftly on to stage 2:

    Stage 2: preparing the donor anims

    Since the unit is running with a parent of MTW2_Musket, I need to find the corresponding animations for attack_missile_ready etc.
    and the ones for the weapon from the crossbow set. Not too many to find! I Then copy them into a folder out of the way and turn each one to txt.
    It is important to know how many frames are in each one. Since wwe are going to paste animations in to these, we need to be sure that both the anims we are going to merge have the same number of frames or this
    just won't work!

    So..starting with the attack_missile_hold...

    The Musket anims have 19 frames, and the HR_Pistol version has 31 .... so we have to reduce the 31 to 19 using KnightErrants
    SLERP function in the GOAT toolkit. This will speed up the movement, so be prepared to slow down the finished product if it feels too fast!
    We then turn the 19 frame SLERP'd cersion of the HR_Pistol to text and prepare to copy and paste! We basically want all the rotations
    from the upper body. Arms, Torso, Abs .... basically everything above the pelvis! We do not want the rest....that will stay as the musket
    values.

    Repeat with the other animations. For the reload, I have used the reload from the Arquebus, not the musket...the musketeers change ranks to reload and I do not
    want that happening here! As luck would have it, the reload anims are both 131 frames...so no change needed there. The HR pistol ones were all 31 frames
    for the others and had to be pulled back to 21 frames.

    Now I can turn the SLERP'ed animations to text and copy over the relevant rotations for each of the upper body bones.

    Save the result and turn back into CAS.

    The results are then renamed to reflect the original names for hold, ready, release and reload.

    The game is run, and the unit tested again. This time, they are holding the weapons and firing like they should! The weapon flashes are not exactly where they should be...but I have noticed this is already
    a problem with the original units!

    So, there we have it. We have taken just the upper body rotations of one unit and pasted them into another, turning
    a mounted animation into a foot-soldier animation with no need to even touch 3D software or a key-framer. Magic.

  13. #13
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Ah, how very clever to just cut and paste portions of animations in the text! I will have to definitely try that with hoplites, it must be now extremely easy to create an overhand hoplite animation...


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  14. #14

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    wow that was fast pistollers must look cool

  15. #15
    =NF= Vasileios_the2nd's Avatar Semisalis
    Join Date
    Sep 2008
    Location
    Athens.Greece
    Posts
    404

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    I am having a headache on trying to give my archers a higher rate of fire. Please, tell me what I am doing wrong:


    I delete the 4 files in the animations folder. Then I use KE's Goat toolkit, and with this I change the number of frames of the original animation "MTW2_Bowman_ready.cas" from 21 to, say 7.
    But when I go in game, I get this "strange" behaviour:
    Instead of a shorter wait time between 2 sequential volleys, my archers wait the same time as originally. Instead, the animation of being "ready" plays many times faster (due to lower number of frames).

    What am I doing wrong?
    If you don't understand what Im talking about, I can try explain better.
    "Greeks dont mod like modders, modders mod like greeks." -PorkyJack
    10 new captain models (campaign map) to download

  16. #16
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    The 'ready' animation is intended to be a placeholder which plays while all the soldiers in the unit get into position.

    To increase your rate of fire you want to speed up the 'ready' but also speed up the 'stand_idle_to_ready' animation.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  17. #17

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    I got 2 questions:

    When I select a bone, it is a sphere thingy that is highlighted, not like the bones in your skeleton which are shown as lines. How do I get that? I cant see any bones like it is in your pictures.

    Where do I find this zero-rotations plugin?

  18. #18
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    No the bones ARE the spheres. Lines are things that connect the bones. Bones are also called "joints". There is no need and no way to select the lines themselves.

    Not sure where to find the zero-rotations plugin. Would LOVE to find out what makes it so magical in Bwian's view.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  19. #19
    Jaguar Paw's Avatar Senator
    Join Date
    Jan 2008
    Location
    Maryland, USA
    Posts
    1,303

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Hey all, sorry to break in here, but I had a general animation question. Does anyone know if some wonderful soul here has ever done an atl-atl animation? I realise this would take the addition of a bone probably to act as the actual atl-atl/ spear throwing device ( as being seperate from the actual dart portion). I guess when it comes down to it I'll have to actually get off my rear and learn all of the animations modding ins and outs. Just curious as I am in the very very most basic steps of working up a pre-Columbian Meso-American mod.
    Member: The Frontier. Researcher, Skinner, and Modeler.












    Member: The Frontier Researcher

  20. #20
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Bwian's Guide to the Infinite Possibilities of Animations

    Bump...


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •