1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Getting Civ4 Units Into Civ5 Using Blender 2.72

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Wolfdog, Nov 24, 2014.

  1. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    645
    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:

    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.
     

    Attached Files:

  2. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    645
    Location:
    Australia
    Reserved
     

    Attached Files:

  3. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,513
    Location:
    London, UK
    Bumping this as it the more up-to-date tutorial on converting units from Civ 4 to Civ 5.
     
  4. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,107
    Location:
    The Kingdom of New Zealand
    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.
     
  5. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    645
    Location:
    Australia
    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.
     
  6. DoctorMcGann

    DoctorMcGann Emperor

    Joined:
    Nov 19, 2014
    Messages:
    1,283
    Okay, so this is a really stupid question, but where are civ V units located? I can't find them, which makes getting a template unit...complicated.
     
  7. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
  8. DoctorMcGann

    DoctorMcGann Emperor

    Joined:
    Nov 19, 2014
    Messages:
    1,283
    Thanks!
     
  9. DoctorMcGann

    DoctorMcGann Emperor

    Joined:
    Nov 19, 2014
    Messages:
    1,283
    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?
     
  10. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
  11. Vicevirtuoso

    Vicevirtuoso The Modetta Man

    Joined:
    May 14, 2013
    Messages:
    775
    Location:
    The Wreckage, Brother
    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.
     

    Attached Files:

  12. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,513
    Location:
    London, UK
    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.
     
  13. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    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.
     
  14. DoctorMcGann

    DoctorMcGann Emperor

    Joined:
    Nov 19, 2014
    Messages:
    1,283
    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.
     
  15. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    645
    Location:
    Australia
    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.
     
  16. DoctorMcGann

    DoctorMcGann Emperor

    Joined:
    Nov 19, 2014
    Messages:
    1,283
    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...
     
  17. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
  18. Typhlomence

    Typhlomence Magical Tomomo

    Joined:
    Mar 19, 2014
    Messages:
    394
    Location:
    Brisbane, Australia
    Also you could try altering the mesh so that things like the arms and legs are the same length.
     
  19. Vicevirtuoso

    Vicevirtuoso The Modetta Man

    Joined:
    May 14, 2013
    Messages:
    775
    Location:
    The Wreckage, Brother
    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?
     

    Attached Files:

  20. DoctorMcGann

    DoctorMcGann Emperor

    Joined:
    Nov 19, 2014
    Messages:
    1,283
    Okay, so what about weapons? Do I need to line up my archer's bow with the vanilla archer's?
     

Share This Page