Getting Civ4 Units Into Civ5 Using Blender 2.72

Wolfdog

Unit Butcher
Joined
Jun 29, 2012
Messages
660
Location
Australia
Quick guide on using the latest version of Blender and Deliverators new scripts to convert a unit. This tutorial assumes you have a basic understanding of Blender. Thanks to Deliverator and Ekmek from which a lot of this is copy and paste from their tutorials (I hope you don't mind).

Software Tools Used

Nifskope
Blender 2.72
Nexus Buddy 2 Scripts for Blender 2.7 made by Deliverator
Nexus Buddy 2.1 made by Deliverator
UV Copy Paste Script made by Nutti
You may need to enable the export to OBJ script and install the BR2 export and UV copy paste script for which there are plenty of tutorials that can be googled.

Step 1:
As there is still no NIF importer for Blender 2.7 (that I could find anyway, please correct me if I am wrong) so we will need to use the OBJ importer for our unit as per Ekmek's tutorial.

Export your Civ4 Mesh as an obj files using nifskope. Click OK on any warning messages you get.


Step 2:
Open your template unit in Blender and import the wave object. NOTE If your unit is a mess it may be easier to fix it first in a new Blender instance then copy and paste it into your template.


Step 3:
Select the mesh from the Outliner view (hold shift and left click to select if you have multiple meshes).

Resize and rotate if need be. For most cases in the 3D View press 3 then R then type 90 then hit Enter to get it the right way up. Press S to resize if necessary.



Line up your objects. LINING UP CLOSELY TO THE MESH HELPS MAKE THE RIGGING MATCH BETTER. See stage 2 of this tutorial for more detail on this.



Step 4:
BAKE your mesh only if required.
Note this should not be required with most units, it is really only needed with custom units that take bits and pieces of different units and combines them. In most cases unless your mesh has only one Vertex Group you should just make a multi-mesh unit. If you know how you could make a dummy vertex group and rig it to and unused bone in some cases as well.

A)
Right-click to select the mesh you want to join, hold down Shift and then right click the mesh you want to join it to, Ctrl-J to join the two. Now repeat this for any other meshes you need to join, pressing A in 3D View to deselect all after each join.


B)
Create a second UV map on your object in Properties > Object Data by clicking on the +.


C)
Make sure you have installed the uv copy paste plugin. With your new Object selected Tab into Edit mode on 3D view and press U, select Copy UV Map and select the original UV map. Now press U, select Paste UV Map and select the new UV map.


D)
Select the original Map for your Texture in Properties > Textures > Mapping > Map. Repeat for all textures you need to bake.


E)
You should see the mess in next screenshot in the UV/Image Editor View. This is the current UV mapping for the unit. It basically tells the graphics engine how to apply a 2D texture to a 3D mesh.


Because we are combining several textures into one, we have the problem that a lot of elements are overlapping. We need to fix this first this before we can bake our texture.

EDIT:I moved this stage here (it used to be after rearranging the materials) as it is easier to work on a black background than a image.
Create a new image in the UV/Image editor by pressing Alt + N or Image > New. Make the image size either 256 x 256 or at the most 512 x 512 and click OK.

We still have our separate materials which we can use to select the separate elements of the unit. Switch to the second material using highlighting as shown below, press A to make sure everything is deselected in the 3D View and then press the select button for that material. Now the UV window shows only the mappings for the second material:

Note: The hotkeys for the UV window are pretty much the same to the Edit Window you can use G to Move, R to Rotate, S to Scale, etc. The only difference is there is only an X and Y axis if your want to restrict your movement or scaling in one direction. R followed by 90 can be used to rotate stuff 90 degrees. Ctrl + LMB Drag to lasso select is a must for UV editing as well.

Now move rotate and/or scale to desired location within box, then press A to deselect, now select the first material and move rotate and/or scale and repeat for any other materials you may have. The UV view should now look something like the Picture in G) with no overlap. Your unit will look all wrong at this point but thats normal.

See the Bake Texture (Part C) of Blender 2.49b tutorial which goes into greater details of how to do this for Blender 2.49b but is still the same in 2.7.

F)
EDIT: This step has been moved to step E.

G)
Select the new UV map in Properties > Object Data and then select the new image in the UV/Image editor, so that the individual islands UV map is displayed over the new image.


H)
In Properties > Render > Bake select Textures from Bake Mode then press Bake.


I)
Save your new image, Image > Save As Image. In Properties > Material press + to make a new Material then press New. With new material still highlighted go to Properties > Texture and press New, now under Image press Open and select newly the baked pic we just saved. Back in Properties > Material delete old materials (highlight and press -) so just the new one remains.


J)
In Properties > Object Data make the NEW map the active map by clicking on the camera icon then highlight the OLD map and press - to delete it.


Step 5:
In Object mode in 3D view select the template object and new object with shift RIGHT CLICK. OLD rigged mesh first then the new one second. YOUR NEW MESH MUST HAVE NO VERTEX GROUPS FOR THIS TO WORK. Select Weight Paint mode in the 3D View then press Transfer Weights in he Tools side bar.
Click here if only one vertex group being copied over.


Step 6:
Check rigging. It may be trial an error as you test the animations and you may have to re-rig some parts but this should do 70-80% of the rigging work.


Step 7:
When you are happy with your vertex groupes in Outliner View left click to select new mesh then Shift left click the skeleton then press Ctrl P and select to Armature Deform.


Step 8:
Delete your old template mesh (select then X to delete in 3D view), select your new mesh and press Ctrl A and apply rotation and scale and save then export to br2. If you need help with exporting see this tutorial.
 

Attachments

  • Step2.png
    Step2.png
    118.1 KB · Views: 2,299
  • Step3a.png
    Step3a.png
    116.2 KB · Views: 2,331
  • Step3b.png
    Step3b.png
    73.7 KB · Views: 2,123
  • Step5.png
    Step5.png
    124.2 KB · Views: 2,122
  • Step6.png
    Step6.png
    93.3 KB · Views: 2,064
  • Step7.png
    Step7.png
    178.6 KB · Views: 2,375
  • BakeA.png
    BakeA.png
    319.4 KB · Views: 2,092
  • BakeB.png
    BakeB.png
    21.7 KB · Views: 2,141
  • BakeC.png
    BakeC.png
    296 KB · Views: 2,041
  • BakeD.png
    BakeD.png
    28.1 KB · Views: 2,115
Reserved
 

Attachments

  • BakeE1.png
    BakeE1.png
    79.1 KB · Views: 2,130
  • BakeE2.png
    BakeE2.png
    327.8 KB · Views: 1,947
  • BakeG.png
    BakeG.png
    57.3 KB · Views: 2,093
  • BakeH.png
    BakeH.png
    31.1 KB · Views: 1,967
  • BakeI.png
    BakeI.png
    34.8 KB · Views: 1,986
  • BakeJ.png
    BakeJ.png
    21.6 KB · Views: 2,003
Bumping this as it the more up-to-date tutorial on converting units from Civ 4 to Civ 5.
 
Step 7:
When you are happy with your vertex groupes in Outliner View left click to select new mesh then Shift left click the skeleton then press Ctrl P and select to Armature Deform.

I'm trying to convert a very, very simple model - no animations even, all one mesh - yet I'm still having trouble. Presumably, you're circling what I should be clicking, but then pressing Ctl+P doesn't yield any menus whatsoever. In fact, clicking the old mesh with anything else never yields any menus which contain the option "Armature Deform," with the exception of when I click both the new mesh and the mesh object for the old mesh - except that yields an error relating to not having selected any vertices. So, I'm basically very lost; seeing as this is the simplest model I could find (I've before attempted other conversions to no avail), I'll throw in a last ditch effort by asking.

Let me know if there is any more info I can provide.
 
All I can think of is are you sure noting else is selected as well and your mouse pointer is in the 3D view window when you press CTRL P. Blender is very fussy about the location of your mouse pointer. Are you in Object mode when you try this (it should also work in edit mode)?

Post your blender file if you like and I will take a look at it.
 
I don't quite understand how to align the unit to the mesh. I'm trying to convert the Javanese archer from here. To align the unit to the Archer mesh, I need to move the legs closer together. However, the legs are not separated from the rest of the mesh. Do I need to painstakingly select every vertice (very hard, since he's got a skirt) or is there a simpler way I'm missing?
 
What's wrong with this .blend? Attempting to export it gives me an error. Not retyping the whole thing, but the important parts are:

Code:
line 413, in execute do_export(context, filepath)
line 166, in do_export parentArmOb = objeect.modifiers[0].object
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

The meshes are properly parented to the armature (as far as I can tell, still new at this) and there are no stray objects.
 

Attachments

  • Nepgeardam.zip
    1 MB · Views: 249
I don't quite understand how to align the unit to the mesh. I'm trying to convert the Javanese archer from here. To align the unit to the Archer mesh, I need to move the legs closer together. However, the legs are not separated from the rest of the mesh. Do I need to painstakingly select every vertice (very hard, since he's got a skirt) or is there a simpler way I'm missing?

See this tutorial especially the Stage 2 part:
http://forums.civfanatics.com/showthread.php?t=511396

The key trick I use is to lasso select vertices and then rotate them around a point using the 3D cursor. This is explained in the tutorial.
 
I don't quite understand how to align the unit to the mesh. I'm trying to convert the Javanese archer from here. To align the unit to the Archer mesh, I need to move the legs closer together. However, the legs are not separated from the rest of the mesh. Do I need to painstakingly select every vertice (very hard, since he's got a skirt) or is there a simpler way I'm missing?

Check the tutoials. My leaderhead one guide in my sig covers it. Basically you go to edit mode and highlight just the leg you want to move then move it. the mesh "joint" will move so you may have to smooth that out manually. then do the next leg.
 
I'll try again tonight guys, thanks for all the help! I think I should maybe try to move the skirt with the leg in retrospect, so selection may not be as hard as expected.
 
What's wrong with this .blend? Attempting to export it gives me an error. Not retyping the whole thing, but the important parts are:

Code:
line 413, in execute do_export(context, filepath)
line 166, in do_export parentArmOb = objeect.modifiers[0].object
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

The meshes are properly parented to the armature (as far as I can tell, still new at this) and there are no stray objects.

I had a look at the blend file and it looks like your vertex groups are not assigned properly. Also you have doubled up on your vertex groups between your 2 meshes. You need to use 2 vertex groups Base HumanNeck1 and Base HumanNeck2 for the head mesh and the remaining for the body mesh. Then delete the vertex groups from each mesh that are used in the other mesh if that makes sense.
 
Again possibly a stupid question, but I'm going to ask it anyway. What happens if the unit I'm converting has longer arms than the template unit? Is that a problem, or am I okay?

Not to mention a longer skirt...
 
I had a look at the blend file and it looks like your vertex groups are not assigned properly. Also you have doubled up on your vertex groups between your 2 meshes. You need to use 2 vertex groups Base HumanNeck1 and Base HumanNeck2 for the head mesh and the remaining for the body mesh. Then delete the vertex groups from each mesh that are used in the other mesh if that makes sense.

Thanks for taking a look!

I went through and made sure that all of my vertices were assigned to a vertex group by selecting every vertex in each vertex group manually, then Ctrl-I to invert the selection. There weren't any unassigned vertices I could see -- just to check, I deleted selection and saw no difference. Are they perhaps misnamed? The base unit I used was the Danish Berserker, for reference. I used Bone Weight Copy to get the vertex group names and (most of the) vertex assignments for them. I also deleted everything but Base HumanNeck1 and Base HumanNeck2 for the head, and deleted those two for the body. Unfortunately, still no dice.

What would I need to do to correctly assign the groups from this point?
 

Attachments

  • Nepgeardam1.zip
    1 MB · Views: 164
Top Bottom