#3-3 : Rigging a basic model : HatIntroI'm not going to go into much detail here. The rigging of such a hat is very straightforward, so initially I'm pretty much going to give you a quick step-by-step of "click this and that" and get the model in-game. The next part(s) of this tutorial will more clearly show how to use Fragmotion, how to rig more complex armours and test animations. However, the process is essentially the same, so the more adventurous may wish to play around with some of the other files and work it out for themselves.
If you haven't already, this would be a good time to read Lizard's Tutorial on
Rigging in Blender as you should find this very useful in understanding how the skeleton structure works, and he has gone into infinitely more detail than I am going to.
Disclaimer : I can not say for certain that this method is perfect. Karpov has been rigging the "official models" so far using a biped system in Max, and this is quite different. However, as said - I have tested this and it is working in game. All the "extra files" in the earleir SDK tutorials have been done using these methods.
General skeleton and bone infoA bit of basic info to begin with, is a few diagrams of how the rigging and skeleton are put together :
Strenth of connectionsAll the little yellow dots are the vertices of the model, the blue circles are the bones and the coloured lines are the connections between those. The colours represent the strength of the connection between these. Each vertex is connected to either one bone at 100%, or several bones at fractions of 100%. The bone display in other programs works differently - in this one we have little circles with sticks connecting them, which is not quite as informative as the "connected triangles", but ultimately it's displaying the same information. To briefly look at the general pattern of things, if you consider the model to "begin" in its centre and grow outwards to the limbs, most of the model is 100% connected to the bone preceding it as we move away from this centre. Some areas with complex joint movement (i.e. shoulders, pelvis) have several looser connections instead. Generally speaking, armours will follow the same pattern.
Names of bonesHere's a map of the bone layout. The animations are connected to the names of these bones. They should mostly be self explanatory. Some sections (especially the ponytail) aren't immediately clear from this angle, but still hopefully you can get a rough idea of the structure. When importing an .x file from those already in game, Fragmotion seems to duplicate all the bones with a "no_name" copy. As far as I've found from testing, all the no_name bones can (or should?) be deleted.
It's also worth noting that through my or Fragmotion's error, the model is effectively flipped left to right - notice that the "right leg" is from our perspective, not from the model's own right. This is the other way round in game, so if you have a non-symmetrical model, you will need to flip this as well. We will need to do this with our beret.
Bone tree structureHopefully this is fairly self-explanatory. These are the parent/child bone relationships (covered well in Lizard's tutorial), forming the entire "tree" of the skeleton. You can also see the ponytail bone segments a little more clearly from this angle. Looking at those connection strengths again, by looking from this angle, hopefully you also get a flavour of how the vertices and bones are connected i.e. on the left leg, everything from toes until the ankle connects to L_Foot, then everything until the knee connects to L_Calf, then everything on the rest of the leg connects to L_Thigh. When it reaches the pelvis, because of the motion of the legs at this point, it becomes quite complicated.
I'm a little unsure regarding the handles (L_Handle and l_handle_1 etc) - two are disconnected from the main tree, and two are included in the hands, though this is what's displayed from an imported .x model, and appears to work in game.
With this in mind, we should again have a quick look at these examples of other armours :
If you compare what we see here with the human model above, it should be fairly clear how the structure works. Basically, you want to study the existing models. As mentioned, you can import existing .x files into Fragmotion. Import them and have a look at a few. Try and find one which is similar to what you're rigging, then you can pretty much just rig yours in the same manner.
For more complex ones we'll need to test the rig against a full set of animations, but we'll cover that later. For now, we're doing a hat - so it's simply a matter of connecting the entire hat model to the head bone at 100%. We don't need to test this against running and walking etc, because of its simplicity.
Getting startedDownload these (you may have the beret already) :
human_skeleton_only.ugh (Karpov's male hero skeleton)
(New link 22/01/2012)Beret export selected.zip (contains obj, mtl and same texture file)
(New link 22/01/2012)So, start Fragmotion. It is a trial-based "nag-ware", though it will let you run the program in a fully functional manner if you have "typed a prayer" to run it for one week. As said previously, it's made by a small independent developer, so if you're able, I'd suggest you try and support that by purchasing the full version.
Otherwise, type in the "code" as suggested :
Very quickly, you should have a screen roughly as follows
Brief controls / layout overviewNote that it has one of those "drag bits about and reposition them" interfaces, so may be slighly different. Each window / panel can be enabled from the Window menu at the top. All the buttons have tooltips on mouseover, if you feel like exploring. Otherwise, we'll just look at these :
Viewing optionsShow backfacesShow the back of faces from "hollow" shapes.
Show bone assignments with lines / verticesThe coloured lines from the pictures previously, showing connection strengths. On or off / same but with the colour of the dots themselves
Show vertices / skeletonVertices or skeleton visible
Show axis / show gridXYX axes and grid visible
Side panelThe top half of the side panel will contain things like objects, skeletons, animations etc. We will briefly use the "models" tab to select the hat, but otherwise won't need to use it in this example. Beneath should be a section labelled "Tools", including things such as select, transform, skeletal animation etc. Have a look through for future reference, but again we're only going to need "select" and "mesh" in this example.
Very brief control overviewRMB : Rotate
Scroll wheel : Zoom
LMB : select (dependent on select menu in tools section)
MMB : (scroll wheel press down) drag camera panning
Importing and rigging the hatSo, firstly we need to bring the skeleton in.
File > open > human_skeleton_only.ugh
Assuming "view skeleton" is switched on, you should see this :
You should recognise this guy's shape from the earlier diagrams. If you click on the "Skeleton" tab on the upper-right panel, you'll see the skeleton tree, as shown in images earlier
Adding the hatWe add extra things to this "project" by using "Merge", rather than using "open" (which would replace our current skeleton). Note that "merge animation" can be used when testing animations.
File > merge > 3-4 beret export selected.obj
If you exported one of these yourself, then search for that file name.
It will ask which things to import. In future, you may wish to be selective about this, but for now, just take the default.
Hopefully the hat appears now. If you've got "vertices" view button switched on, you'll see the hat covered in the little yellow dots.
At this stage, we must remember that the model is flipped. if we want it to be the other way round, we can change this now. We will select the beret "group" and flip it. Of course we could have done this in the earlier alignment stage if I was better at remembering what I was doing whilst writing tutorials
FlippingGo to the models tab in the upper right and double click on "group > beret_beret". This should highlight the hat in a bright shade of red.
Change Tools (bottom right) to Mesh, and click "Mirror".
In the panel below, click :
Origin 0,0,0
Direction Across X plane
Mirror all is off
Click Invoke
This should flip the model round like so :
Rigging the hatNow, the actual rigging bit. In this example, you will be pleasantly surprised by its simplicity.
Again, go to this panel in the bottom right and go to :
Tools>Select>Select Bone
Click on the "Head" bone, like so :
Your vertices should already be selected (pink dots instead of yellow). If not go to :
Edit>Select all>Vertices
Now go to the top menu, and select
Bone>Assign selected vertices to bone (or simply press CTRL+B)
A little window should come up. Drag the slider into red until it's as above (Head, 1.000)
Now click "set"
You can close this subwindow now. If you've got the "Show bone assignments with lines" button switched on, you should see this.
This is now rigged. Well done.
ExportingGo to the top menu, then File> Export > Direct X
Use these settings (other settings may work)
A nice filename might be "armor_male_beret.x"
Testing the model in gameIf you've already read the previous SDK ones, you can probably work this out for yourselves, but we'll go through it quickly anyway.
Files and foldersIn your 3d testing folder (you do have one, right?), copy these as follows :
armor_male_beret.x to \Client\data\art\critters
armor_all_beret.png to \Client\data\textures
Now we need to edit the fo3d file. Go to
\Client\data\art\critters\_FOHuman.fo3d and open it in notepad or similar.
Scroll down until we get to layer 4 (param 154)
# Head --------------------------
Layer 4
Value 5 Root DisableLayer 7 Attach armor_%anim%_combatarmorhelmet.x
Value 6 Root Root Attach ATR_PowerArmorhelmet.x
[...]
At the end of this, we add :
Value 35 Root Attach armor_%anim%_beret.x Texture 0 armor_all_beret.png
Of course, you may use a different value instead of 35, depending on how much other stuff you've got in there. As explained in previous tutorials, this will attach our model to value 35 on layer 154. The %anim% line will refer to armor_male_beret.x and armor_female_beret.x as necessary (we've only made the male model in this case, but it would be the same for the female).
Codes in gameStart your singleplayer 3d test and follow as indicated in the earlier tutorials.
These lines should give you the hat
~getaccess admin password
~ param 0 154 35
He has a hat on.
Obviously, you can also do a
~param 0 153 13
~param 0 155 13
Then you get
So, that's a very simple rig - it's difficult to do wrong. At some point in the near future, I'll try and finish writing up and preparing a few extra bits, possibly including :
- Rigging various armours
- More thorough description of how Fragmotion works
- Testing armours against multiple animations
- Reimporting rigs to correct errors
and later on, possibly even :
- Adjusting the existing animations to create your own
- Rigging new base humans
- Rigging new unique critters with animations
Hopefully the more adventurous amongst you can look at what we've gone through so far and learn a little more yourself - it'll be quicker than waiting for me to prep all the files, screenshots etc
Of course, as with previous tutorials, please feel free to ask questions, offer recommendations or corrections.