MBX

Mount&Blade Expansion => Mod Graveyard => Tutorials => Topic started by: Yoshiboy on January 09, 2007, 10:53:48 AM

Title: Extension Tutorial - Rigging And Animation
Post by: Yoshiboy on January 09, 2007, 10:53:48 AM
Extension tutorial – Rigging

Chapter one – What is rigging? And why does it have to be done.

When you animate something in a game you use these things called “bones”. They are quite similar to their human counterpart in that you move the bones as part of the animation and then the rest of the mesh follows. These bones are used because it makes animation much, much easier than if you were to just move every vertex of face individually.

There is only one downside to the use of bones in animation. It means that anything that is animated has to be “rigged” to the skeleton (collection of bones) so that the computer knows how the model reacts when the bones move.

The process of Rigging is in theory very simple. You tell the computer how much each vertex is affected by each bone in the model when the bone moves. When the vertexes are attached they will move with the bones allowing the model to be positioned and animated simply by moving a handful of bones.

In mount and blade there are only two types of models that are animated: Humans and horses. This means that overall the amount of rigging we have to do for mount and blade is very little. We only need to rig body armour and any new horses that we make.

For this tutorial I will be using 3d studio max 7 although it can be applied both to any version of 3d studio max or to Gmax.

3d Studio max is extremely expensive, but you can download the free trail from their website:

Click here (http://usa.autodesk.com/adsk/servlet/index?id=5659302&siteID=123112) and look for the button on the right that says about a 30 day free trail.

Alternately you can download Gmax, which is very similar to 3d studio max but without as many tools.

download it here (http://www.turbosquid.com/gmax).

Now, normally in mount and blade we would be importing and exporting .obj files when we are making meshes but because .obj files don’t support vertex weighting (or rigging to you and me) we have to use a new file type. Don’t get too hung up about this, it’s still very simple. All it means is that we have to download the appropriate plug-ins for Gmax or 3d studio max. Here is a list of all the tools you will need. Obviously you only need the ones for your chosen program.

SMD plugins for max (http://www.chaosincarnate.net/cannonfodder/cftools.php?program=3dsmax)

SMD importer for max/gmax (http://members.iinet.net.au/~dstent/mnb/SMDImporter1-0.zip)

SMD exporter – gmax (http://members.iinet.net.au/~dstent/mnb/G-max_SMD_Exporter.zip)



 So, once you have your program and your appropriate tools – we can get going.

Chapter 2 – preparing a model.


Before we get rigging, we need to export one of M&B’s skeletons to work from. This is easy enough. Simply open up thorgrim’s BRFedit (found here (http://forums.taleworlds.net/index.php/topic,8771.0.html)) and open up a BRF with a horse or armor in (whichever you want to make). Once you have done this simply click on the model to export and press “export” near the top. Find an appropriate save location and save it there. When it asks you for the skeleton type pick the one that fits. Usually this will be already picked for you.

So, we have our SMD file exported and ready. Now all we have to do is import it into max – so open up Gmax or max or whatever you are using. If you are using Gmax you better read Thorgrim’s tutorial on how to use the scripts. That can be found here (http://forums.taleworlds.net/index.php/topic,13615.0.html). If you are using the HL2 SMD plugins for 3dsmax it is very simple. Just go “File > Import…” then select .SMD from the file type to open and browse to your SMD you just exported. The scene should look something like this.

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene.jpg)

You should have a selection of bones there with the mesh you exported on top of it. Your next step is to delete the existing mesh and import your new armor that you want to rig. Once you have imported your new armor and lined it up over the bones so that it fits nicely you can get about to rigging it!

First of all select the mesh and go click the little icon called “modify” on the right hand side bar. Its picture is something like a quarter of a grey tire or something. Once this is pressed you will want to click on the drop down menu called “Modifier list” and select from this the modifier called “Skin”. To get to this quickly you can keep pressing “S” until you get there.

This is your rigging modifier. The term “Skinning” is also a term used for rigging a model, I prefer to use the term rigging because “Skinning” is also commonly used meaning the same as “Texturing”.

Before you want to do anything you want to tell max which bones you want to rig the model to. To do this press the “Add” button on the right menu and then “All” in the new box that appears. This will select all the other objects in the scene to use as bones. This should be fine as long as you don’t have any other objects in the scene, if so just deselect them by holding ctrl and clicking on their names. Once you have all your bones selected press the “Select button” and it will add them to the modifier.

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene2.jpg)

Now you have your bones ready there are two ways of rigging your model, either you can use “envelopes” or you can simply assign weights manually to each bone. Assigning them manually is probably the easier option to pick up and understand but using envelopes is by far quicker and most efficient. They are my favourite.

Chapter 3 – Rigging.

Using envelopes

There is an envelope for each bone on your model. An envelope is like a volume assigned to a bone, any verts within the volume of the envelope will be given a weight assignment depending on how near it is to the bone. An envelope is made up of two parts. The wide affect area and the close affect area. The wider area affects the verts within it, but the close area affects then with a much higher priority.

To start adjusting your envelopes press down the “edit envelopes” button and make sure the “envelopes” and “cross sections” buttons are ticked. Once this is done select the bone which you want to edit the envelope of and find the little tabs on the end of the envelope (highlighted in green below) which you want to adjust and pull them around to make it cover the area you would like.

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene3.jpg)

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene4.jpg)

As you can see in this image the model changes colour depending on how much the verts are rigged to a bone. A vert which is 100% rigged to the current bone will turn Red. One that is around 50% should be orange, 25% should be a yellow and any less will be a shade of blue. This will make sure that you get a nice balance when the join moves and stops stretching.

Adjust the envelopes for half the bone in the model as well as all the center bones. Max has a feature to mirror the rigging from one side of the model to the other so we will use that. That will be covered later.

Rigging by verts

Rigging by verts has a slightly different setup to the envelopes. First, at the top of the modifier options you need to tell it you are rigging by verts instead. To do this, tick the boxes as follows:

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene5.jpg)

there are also some display options I like to use to make rigging via verts more easy. So scroll down the modifier to where you have the display options and change them to the following:

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene6.jpg)

Now, rigging by verts is very simple. Select the bone which you want to rig the selected verts to, select the verts to rig and then adjust the amount in the box called “Abs. Effect”. (remember that to add to a selection hold ctrl and to subtract from one hold shift) This is the amount the verts are affected by that bone; it is colour coded the same as if you were using envelopes. (A vert which is 100% rigged to the current bone will turn Red. One that is around 50% should be orange, 25% should be a yellow and any less will be a shade of blue.) You very simply repeat this process of setting that verts for half the bones on the model and then you can use the mirror mode to reflect this over.

Chapter 4 – Extras.

Using the Mirror Tool

First of all scroll the modifier to where you can see the options for the mirror tool and select the button that says “mirror mode”. This will colour half of the verts/bones on the model blue and the other half green. This is as long as you have the mirror plane in the right place. By default it should be over the X axis, which is correct. If not you can change it to go over the Y axis. If it is on the wrong axis most of the verts will be coloured red.

(http://www.theorangeduck.co.uk/modding_stuff/tut_pics/rigging/scene7.jpg)

Anyway, mirroring the assignment is as simple as the click of a button. If you have rigged by envelopes you will want to press the relevant “paste bones” button. Pasting the colour you have rigged to the side with the colour you haven’t. If you rigged by assigning verts you will want to do the same but use the “paste verts” buttons instead. Once this is done turn mirror mode off again by clicking the “mirror mode” button and select your bones that were on the un-rigged side to see if it worked.

Checking all verts are rigged

If you haven’t assigned all the verts to a bone with a model then you will probably get some nasty effects once you import into M&B. Verts which are un-rigged will appear at the origin on a model, meaning they will be stretched all the way to the bottom of a person’s feet, or between a horses.

Making sure all the verts are assigned to a bone in max is relatively easy. Simply select all the bone objects without the main mesh and move it all up or along, it will become pretty clear which verts are not rigged, as they will not move with the rest of the model.

(An easy way to select all the bones is to drag a box over the whole scene then hold ctrl and de-select the main mesh.)

Exporting

Exporting is done largely in the same way importing is. If you are using the max tools then simply select the mesh and export as a .SMD file. When you are given the option of how to export always select “reference” instead of skeletal animation.

If you are using Gmax then follow thorgrim’s tutorial found here (http://forums.taleworlds.net/index.php/topic,13615.0.html).


Importing into BRFedit

This is just the same as you would any other mesh. Go “file > import” and on the option box that it gives you just use whatever the default option is.

A few notes

When you are rigging a humanoid model the hardest part to rig will be the shoulders. Usually it is best to give them a very small but strong area of affect. These bones will stay horizontal when the rest of the arm moves down, they keep the side of the model steady when the arms flail about. It is best to keep the arm bones from having too much of an influence on the shoulder area verts.

When you are rigging armor and you have parts of the armor that you don't want to bend, like a shoulder pad - what you want to do is rig it all with 100% to one bone, usually doing it via vertex rigging. This will mean that it wont bend and look funny when you put it in game and it starts to move.

Sometimes you can really mess up your rig, and you might well do that the first time you try. Don’t worry, with practice you will get better and spend less time on it as well.

If you have any more questions or any parts of rigging you think need covered or any problems with the tutorial please post them here.

Yoshiboy.
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Apollon-04 on September 22, 2007, 05:09:45 PM
Sorry to necro this thread, but since its a tutorial, I think its ok. First of all, thanks for this tutorial. I'm trying to earn to rig, and its been very helpful. Here's some things I have questions/commnets on.

1. The site that you host images on is down, and your images don't show up. Since part of the rigging by vertex part is images, this should be fixed.

2. A question relating to the rigging/animating process. This tutorial says rigging/animating, but theres nothing on animating. Could you maybe link to a bow animation tutorial? (i have been unable to find one myself.)
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Yoshiboy on September 23, 2007, 03:04:57 AM
Ok, I'll get the pics up again -

animation wasn't really possible when I made this tut but if it is in the newest version then I'll maybe write something on it (it would be new to me though)
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Apollon-04 on October 07, 2007, 07:03:12 PM
I meant like animating a bow, with vertex animations and stuff. I really need to learn how to do this.
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Yoshiboy on October 08, 2007, 02:17:10 AM
I meant like animating a bow, with vertex animations and stuff. I really need to learn how to do this.

Oh, that. Well its possible I can go through that at some time but its rather simple. Just export each frame as .obj file and import it onto an existing mesh in BRFedit. There was some stuff about it in the BRFedit thread.
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Apollon-04 on October 08, 2007, 02:42:53 PM
Is it similiar to making a sheat? One frame is the bow, on is slightly drawn back, one is all the way drawn back?

Ill go look at the Brfedit thread for more info too.
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Yoshiboy on October 09, 2007, 10:54:05 AM
Is it similiar to making a sheat? One frame is the bow, on is slightly drawn back, one is all the way drawn back?

Ill go look at the Brfedit thread for more info too.

Exactly the same.
Title: Re: Extension Tutorial - Rigging And Animation
Post by: Kabalon on July 28, 2008, 08:14:18 AM
hey dude...

I just made that .smd with the imported .smd from a M&B armor...

I didn't changed anything in the rigging...because I thought it's just ok like it is O_o ? because at the arms...the arms were affected n stuff...

But as I imported it into the game...the whole mesh exploded (artefact) :D

What can be the problem in this?

Charlie