Making units that use Civ 5 animations

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,806
Location
London, UK
Update 6th May 2013: I'm going to do a better version of this that goes into a higher level detail on rigging Civ 4 meshes to Civ 5 skeletons. Watch this space!

This is a tutorial on how to rig a Civ 4 unit mesh to a Civ 5 unit skeleton and animations.

The Civ 5 Skeleton Template Library

Here is a collaborative Google spreadsheet for tracking which units have been extracted to .blend files by the community to use as unit templates in Blender. You'll need to select an appropriate Civ 5 unit to rig your Civ 4 unit mesh to.

To see how more templates can be created see this thread.

Making your Civ 4 unit use Civ 5 animations in Civ 5

1) First load the unified NIF you have made in Stage 2 of the other tutorial. Using Nifskope rename the bones so that they have the Civ 5 equivalent names. The purpose of this is that we don't have to do as much work with Vertex Groups when we merge this unit with our Civ 5 template in Blender. To rename a bone just double click on the name then you can either type or (easier) paste in the new name.



Rename as follows:
Code:
BIP Pelvis -> Base HumanPelvis
BIP L Thigh -> Base HumanLThigh
BIP L Calf -> Base HumanLCalf
BIP L Foot -> Base HumanLFoot
BIP R Thigh -> Base HumanRThigh
BIP R Calf -> Base HumanRCalf
BIP R Foot -> Base HumanRFoot
BIP Spine -> Base HumanSpine1 (Note!)
BIP Spine1 -> Base HumanSpine2 (Note!)
BIP Neck -> Base HumanNeck1
BIP Head -> Base HumanNeck2
BIP L Clavicle -> Base HumanLCollarbone
BIP L UpperArm -> Base HumanLUpperarm
BIP L Forearm -> Base HumanLForearm
BIP L Hand -> Base HumanLPalm
BIP R Clavicle -> Base HumanRCollarbone
BIP R UpperArm -> Base HumanRUpperarm
BIP R Forearm -> Base HumanRForearm
BIP R Hand -> Base HumanRPalm

i) Some Civ 4 bones names begin with Bip01 instead of BIP - it should be easy to figure out the equivalents.
ii) Don't worry if your model doesn't have some of these bones like Clavicles or Neck - it doesn't really matter - just rename the ones out this list you do have.
iii) Any bones names not in this list (like BIP and BIP Footsteps) don't need to be renamed.

Here's the list of target names on its own for easy copy-and-pasting into Nifskope:
Spoiler :
Base HumanPelvis
Base HumanLThigh
Base HumanLCalf
Base HumanLFoot
Base HumanRThigh
Base HumanRCalf
Base HumanRFoot
Base HumanSpine1
Base HumanSpine2
Base HumanNeck1
Base HumanNeck2
Base HumanLCollarbone
Base HumanLUpperarm
Base HumanLForearm
Base HumanLPalm
Base HumanRCollarbone
Base HumanRUpperarm
Base HumanRForearm
Base HumanRPalm

After you've finished the renaming in Nifskope save your NIF as a new file.
2) Start up two separate instances of Blender. In the first, open civ5_minuteman_template.blend from the Skeleton Template Library. In the second, import the NIF that you were just working with in Nifskope.

3) In the blender instance that has your imported NIF, right click on the mesh in the 3D window so that only it is selected and not the skeleton. Now we are going to use the Copy and Paste script to copy the mesh into the other Blender instance.

For the Copy and Paste script to work you need to save your file as a .blend first - so press Ctrl-S or use the File menu to save it. Once you've done that in Scripts window go to Scripts -> Objects -> Copy and Paste Objects then select Copy object(s) to buffer. (If the option to Copy and Paste Objects isn't there then either you have installed the attached scripts or you need to restart Blender)



4) Now in the other Blender instance where we loaded civ5_minuteman_template.blend, in the Scripts window go to Scripts -> Objects -> Copy and Paste Objects then select Paste object(s) from buffer. A small copy of your Civ 4 unit should appear.

Now before you do anything else, join the newly pasted mesh with the larger mesh - you may have to use Shift-click to multi-selected in the Outliner window. Ctrl-J will join the two meshes together. This is to fix the paste mesh in place in terms of position and rotate - if you try and do anything to it without doing this the rotation and position usually jumps. You can then go into Edit Mode use the Material selector to select only the parts of the mesh you pasted in and press P to separate them again. Now you have two separate objects again which is easier to work with for the next step.



5) Now we need to match our pasted mesh to the position of the one that came with the template. First, to scale the model to the correct proportion it is useful do the following, (i) Snap the Cursor to the origin using Shift-S and Snap Cursor to Grid. (ii) Switch the Pivot to 3D Cursor as shown below. Now you can use S to scale and the model with scale from the floor up rather than from its centre point.





(In the screenshots I didn't split the mesh into two again as described in Step 4 - I thought of that idea later)

Now it is a question of trying to match the mesh accurately to the pose of the template. Some tips for doing this.

i) Use Numpad 1, 3 and 7 keys to check things from all angles. Often the alignment will look fine from one angle but needs fixing in another. Remember you can use G,X or G,Y or G,Z to move all or parts of a mesh along a particular axis.



ii) You can use 3D Cursor pivot to rotate parts of the mesh around a specific point - this is useful to rotate of arms around shoulder sockets, legs around hips or to fix the rotation of ankles as shown:



iii) Positioning hands really accurately is important if there are going to be holding weapons or something else:



6) Once you've matched the position of the mesh, you can delete the templete mesh leaving just you new one. Ctrl-J join the mesh back with weapons if needs be. Then go through the Vertex Group names and make sure there are no names that refer to Civ 4 bones. For the Minuteman the list should be this - it should be the same as when you first loaded it - if merging your new mesh has added to this list then just delete the surplus nodes. If you don't then your FBX export will probably be scrambled.



7) Export your FBX. My updated script adds two changes, the ability to set the name of the root bone and the ability to enter any rotation values you like for X, Y and Z. If you are rigging to the Minuteman template you won't need to change anything.



If you want to try out your model with different Civ 5 animation set you'll need to get the Root Bone name from the Model List tab in Granny Viewer for the unit you want to use the animations of. (This is how we can expand the template library but more on that later).



8) Convert your FBX into a GR2 using Indiestone NexusBuddy - I use the older v0.1 version as I find it quicker for this - set your textures and material and use Save not Export - you shouldn't need the Smart Exporter tab at all.

(I recommend you give your FBX a short name like a1.fbx as you'll likely need to repeat this step several times to get things looking right with the Civ 5 animations. When you press Save in NexusBuddy the name of the GR2 will be the same as the FBX.)

9) Make a new fxsxml using the Minuteman one as a base - you only need to change the second line to, for example:
Code:
	<Mesh file="a1.gr2" source="Tool"/>
Everything else can stay the same.

10) Load up your fxsxml in Asset Viewer in Nexus you can use the 3D Viewer and Animation Triggers to test your converted model with the Civ 5 animations.

11) By making adjustments to the skeleton, mesh and vertex groups in Blender then repeating steps 7 to 10, you should eventually be able to make new unit using Civ 5 animations like this one.




Old Irrelevant Info:
Spoiler :
This tutorial assumes you have some followed or understood Stage 2 from the Getting Civ 4 Units into Civ 5 tutorial or have a reasonable degree of Blender know-how to start off with.

In this thread, I am going to go through things in general terms rather than describing particular examples in detail - hopefully this is enough for people to be able to follow, but I'll try and answer any questions that arise.

You will need to add the scripts in the attached zip to your Blender scripts repository. (The bundled export_fbx.py script will be overwritten so you may want to back it up somewhere outside the scripts folder first.)
 

Attachments

  • blender_scripts.zip
    26.2 KB · Views: 606
  • tt1.jpg
    tt1.jpg
    57.4 KB · Views: 7,410
  • tt2.jpg
    tt2.jpg
    81.9 KB · Views: 9,356
  • tt3.jpg
    tt3.jpg
    59 KB · Views: 9,182
  • tt4.jpg
    tt4.jpg
    16.2 KB · Views: 9,097
  • tt5.jpg
    tt5.jpg
    97.1 KB · Views: 9,236
  • tt6.jpg
    tt6.jpg
    16.3 KB · Views: 8,999
  • tt7.jpg
    tt7.jpg
    38.9 KB · Views: 9,099
  • tt9.jpg
    tt9.jpg
    44.2 KB · Views: 9,048
Reserving for more 1
 

Attachments

  • tt11.jpg
    tt11.jpg
    27.5 KB · Views: 6,903
  • tt10.jpg
    tt10.jpg
    24.6 KB · Views: 6,957
  • tt12.jpg
    tt12.jpg
    34.1 KB · Views: 6,918
Great work.

If you want to try out your model with different Civ 5 animation set you'll need to get the Root Bone name from the Model List tab in Granny Viewer for the unit you want to use the animations of. (This is how we can expand the template library but more on that later).

Sweet deal.
A favor. Could you upload your nexus buddy version1. I deleted mine when I updated it and can't seem to find the older version here.

Cheers.
 
EDIT: was it difficult to do the template?/ are some particular tools needed (except granny viewer)?

A bit tricky seeing as I was matching a skeleton in Blender by looking at it Nexus 3D Viewer and Granny Viewer. Now it should possible to use the one I've done as a base for the other human units.

I've attached the older version of NexusBuddy.
 

Attachments

  • IndieStoneNexusBuddy_old.zip
    47.4 KB · Views: 1,209
A bit tricky seeing as I was matching a skeleton in Blender by looking at it Nexus 3D Viewer and Granny Viewer. Now it should possible to use the one I've done as a base for the other human units.

If i understand well,we can use this skeleton to create templates using others animations

Then, how to create those templates?
 
Then, how to create those templates?

I'll make that my next write up. I want to get a bit more practice at doing it myself first. I've successfully rigged the Zulu Impi I was working on to the Civ 5 Aztec Jaguar animations - see here - so that's another template done. My next priorities are Archer, Swordsman and Paratrooper - if I can do those then I should have enough experience to describe the process in a bit more depth.
 
Thanks for the tutorial and templates, I follow your tutorial and conversion the unit, it worked, but I need modify some rotation of bones axes.

That's great, danrell. I'm glad that you could follow this (even without a lot of detail) and it's good to have one of the greats of Civ 4 unit modding around!

Yes, to get the best result it is necessary to tweak the rotation of bones, the position of bones relative to the mesh or mesh relative to the bones and adjust vertex groups until the animations look right in Nexus 3D View. It's trial and error to get the best result, but it's worth the effort to get a fully animated unit with sounds and effects.
 
New version of the template library attached to the opening post. Now includes the Aztec Jaguar template.
 
I was able to add my own custom texture using the civ 5 minuteman animations.



Now, Im trying to see if I can reuse that template and get the infantry animations working by simply changing the names of the gun_bone and the root bone. The problem is that when I export to fbx using your script, I get both the WORLD_center and Dummy_WORLD bones. Im not sure if it actually adds both but it would be nice if it would actually replace it instead of adding a new one.

I dont see the original WORLD_center dummy bone in the heirarchy in blender so I cannot delete it.
Other than that, the new template helped me produce alot of new units so many thanks for doing so =].
 
I dont see the original WORLD_center dummy bone in the heirarchy in blender so I cannot delete it.
Other than that, the new template helped me produce alot of new units so many thanks for doing so =].

Did you change the name of the root bone in the options when using my new FBX export script?



All you should need to do is rename the gun bone and then see the Root Name to Dummy_WORLD in the export options, In any case having extra bones not referred to by the animations doesn't matter too much. I have deliberately added the Adj and Adj2 bones so that I can tweak the position of weapons,etc and know that the animation won't affect my adjustments.

Also, I would like to suggest that people posting units should include their final .blend in their uploaded files. Since conversion into GR2 is a one-way street, doing this would allow other modders to make variations or adaptations of your unit. I'm going to start doing this myself with units I post to the database. I see danrell already did this with his Samurai conversion.
 
Yea, I changed the name of the gun bone and the WORLD_center to Dummy_WORLD like i mentioned. But when I view it through nexus, I can still see both. The animation also doesnt move, it stays in the t pose.

I also tried to use the paratrooper animations since the dummy origin has the same name. The animations work, but simply changing the name of the gun bone didnt work because the gun stays laying on the floor. I assigned the gun verticies to the "gun" bone. Or should it be assigned to the Adj2 bone?
 
Hello Deliverator ,
I making the tank unit, then I added the bone correctly, and play it in the Animation Triggers, looks pretty good, but it didn't work in the game.
I upload the blend file, can you see what wrong? sorry my bad english...:blush:



 

Attachments

  • 001.jpg
    001.jpg
    103.2 KB · Views: 6,611
  • 002.jpg
    002.jpg
    134.9 KB · Views: 6,648
  • 003.jpg
    003.jpg
    163.1 KB · Views: 6,664
Hello Deliverator ,
I making the tank unit, then I added the bone correctly, and play it in the Animation Triggers, looks pretty good, but it didn't work in the game.
I upload the blend file, can you see what wrong? sorry my bad english...:blush:

It's strange that it works in Nexus but not in game. You could try creating another dummy bone above tank_bone_main. The human units that we have working so far all have an "Adj" bone above the main Civ 5 skeleton - see below - I'm pretty sure I added this for a reason, but I can't remember what exactly.



blazekid87 said:
I also tried to use the paratrooper animations since the dummy origin has the same name. The animations work, but simply changing the name of the gun bone didnt work because the gun stays laying on the floor. I assigned the gun verticies to the "gun" bone. Or should it be assigned to the Adj2 bone?

The gun should definitely be assigned to the gun bone. The Civ 5 animation keys into bones by name so it doesn't know anything about the Adj bones - that is why they are useful to making adjustments to positions and rotations.

I do want to work on some more templates soon - but I've been really busy with RL this week. Might get the swordsman done later today.
 

Attachments

  • Adj_bones.jpg
    Adj_bones.jpg
    15.8 KB · Views: 6,524
ok good new and bad news.....i am working on a rifleman .blend template based on the minuteman....the bones r similar enough where i think i am pretty close to acheiving success (see pic) i think i only need to rotate a couple of bones and i will be there (i also what to clean up the art files so we get a really pretty unit).....MY PROBLEM is that i SUCK at XML stuff....im sure that once i get the hang of it, it will be no prob, but i would really appreciate some help/guidance in which xmls i need to work on, and what exactly i need to do to these files....my goal is just to create flavor units at this time, no new unit classes or abilities (yet), just start getting some ethnic flavor units. in an ideal world, i would like to be able to make these with mod buddy but it seems like chinese to me right now.....




ps....GREAT thanks to the masters whom have proivided excellent TUTS, Kael, Deliverator, Lemmy and colonel Blinky (i am promoting you several ranks) as well as danrell and others whom i have been able to get some file structure knowledge....


pss...is there ANY possibility that the NexusBuddy be able to convert gre ---->>fbx...that would be just AWESOME since we could mod civ 5 files directly in blender via fbx
 

Attachments

  • Image1.jpg
    Image1.jpg
    50.8 KB · Views: 6,429
ok....just a tease, i am working on the longswordsman "template"....i think i got him down with the templar, but also plan to do the old maceman, as well as changing some weapons and heads.....



@deliverator....how's taht swordsman coming along....got some nice shields i'd like to use :D
 

Attachments

  • WIP.jpg
    WIP.jpg
    33.8 KB · Views: 6,266
@deliverator....how's taht swordsman coming along....got some nice shields i'd like to use :D

I got back into working on Dune Wars, so he's been half-done for a while. I'll see if I can finish him today.

Edit: It won't be today - but sometime this week...
 
Top Bottom