Where do I start when converting nifs to Civ4 from other games?

Merkava120

Oberleutnant
Joined
Feb 2, 2013
Messages
450
Location
Socially distant
I have a whole bunch of nifs from this Axis and Allies mod that I would like to use in Civ4. One example (M18 Hellcat) is attached.

From what I understand, I will need to either re-bone, rig, or nifswap to get these working in Civ4. All three are sort of explained in this thread. But I have no idea where to begin.
  • Do I need to use Blender as explained in TheMightyToad's pdf provided in this post to create a new skeleton for the model and redo animations? Can I skip this if I just want to use existing tank animations?
  • Can I just use NifSkope to copy models over to Civ4 nifs, as SaibotLieh explained in this post? So far copying the branch over to the Civ4 tank has just frozen up NifSkope, and I assume I need to mess with the bones somehow to get the whole thing working. Or can I just copy the meshes themselves without worrying about bones?
  • What did Walter do to get the buildings converted? It seems like the animations were a real challenge but there's no mention of how he did it...
As of right now, the nifs work fine in the game except for animations, if that means anything.

If I can figure this out, it opens the door to hundreds of units being added to the database, including from modern warfare and sci-fi mods for A&A. Some have been requested dozens of times already...so any help at all would be much appreciated!!
 

Attachments

  • M18_Hellcat.zip
    168.5 KB · Views: 30
You definitively need to completely rerig the entire skeleton for the unit. Honestly my advice is to just get a 3D modeling software you are familiar with that has a .NIF plugin compatible with CIV4. I use 3D Studio Max, others use Blender. From that point on the process is straightforward.
  1. Import the unit from the other game you want to use into your software.
  2. Delete ALL existing bones and animations. You won't need them.
  3. Scale the unit down by removing unnecessary details as needed.
  4. SAVE AND MAKE A BACKUP
  5. Import a unit from regular CIV on top of your work so that you get both the new unit and a base civ unit corresponding to it in the same scene. In case of your M18 example that base unit would be a regular tank.
  6. Look at the base unit and how it is rigged to its skeleton and than rig your new unit so that it roughly corresponds to the same layout.
  7. Export
 
Exactly the answer I needed, thank you!
 
To elaborate a bit on the A&A specifically.
1) The nif format used there is a very different version from the one Civ 4 uses. Basically, nifs have been used for years if not decades for all kinds of games from A&A to Skyrim, and it's more of a container than a format - different versions can have vastly different file formats. Nif plugins for Blender/3DS/Maya generally autodetect these versions, but Nifskope will crash and burn if you try combining two different ones in one instance. So for anything A&A related you'll first have to import your nifs somewhere and then re-export them in Civ 4 format.
2) If the animation is embedded into the file itself (such as the case with the buildings I converted), there is a chance it can survive the conversion process. Units and most buildings in Civ 4 use external animations in kf/kfm format, and those from any other game will likely be useless to you (at least without a lot of understanding and effort) - but embedded animations can work. So far I've seen them work with Civ 4 in buildings from A&A and Kohan specifically. This is just one embedded animation sequence (such as a rotating sign) that keeps playing on repeat. Anything fancier you'll have to animate from the ground up using Civ 4 animations. With units, that's definitely the case.
3) While I don't mean to discourage you, I've seen both stock and modded A&A units, and mostly IMO they are sub-par to what we already have. Would be glad to be proven wrong though.
 
Oh, and the Hellcat you've attached actually comes from here: https://forums.civfanatics.com/resources/civ5-wwii-unit-pack-12-usa-part1.17438/

Likely some A&A mod used converted Civ 5 units from CFC; if you want to have it in Civ 4, it's much easier to convert from Civ 5 original (all units in the WW2 packs include blender files).

Holy cow that is awesome, thank you for pointing me there!! Looks like danrell made a model of basically every WW2 unit I could think of. These will be way easier than from A&A.

3) While I don't mean to discourage you, I've seen both stock and modded A&A units, and mostly IMO they are sub-par to what we already have. Would be glad to be proven wrong though.

You're absolutely right. My whole goal is getting units that do not currently exist in the database somewhere. I have been scouring mods and compiling my own collection of unit art so I know where the gaps are, and the M18 Hellcat is one of the missing ones. M41 Bulldog and Jagdtiger are a couple others. It sounds like I should be checking civ5's database too, though.

... So for anything A&A related you'll first have to import your nifs somewhere and then re-export them in Civ 4 format.
...Anything fancier you'll have to animate from the ground up using Civ 4 animations. With units, that's definitely the case.

Edit - corrected now that I have done it successfully. Writing out the steps I did so I don't forget, and for anyone else who happens to need to do this.

Step 1. Get Blender and everything set up as per here
Step 2. Import the new nif into Blender, and delete everything that is not a mesh (right click mesh, hit H to hide it, then hit A to select everything else, delete, then Alt+H un-hides the stuff you hid)
Step 3. Mess with textures. All of the links in step 5 below talk about how to do that but mine seemed to work fine with its civ5 texture so I skipped this. It seems to involve unwrapping the unit onto a 2d rectangle, which you save as a dds.
Step 4. Import the old civ4 nif, which has bones you would like to use, into Blender.
Step 5. The goal is now to attach new nif mesh to old nif bones. TheMightyToad and this other random site (civ4 version by the coyote) demonstrate two different ways to do this. Ekmek's tutorial shows how to do it manually piece-by-piece too. How I got it working was to simply delete the vanilla nif's mesh, leaving its bones and your new mesh in the file. Then select new mesh >> shift + select vanilla bones >> press ctrl + p >> parent to armature. This makes a set of 'vertex groups' named after the vanilla bones. (You need to parent it no matter how you get the bones set up.)
Edit: TheMightyToad's way of joining the meshes and then deleting the vanilla mesh does not appear to work for me - the two meshes are similar enough that I can't just select the vanilla one.
Step 5. Check over the "vertex groups" in the 'editing' panel while you're in 'edit mode'. (Older tutorial.) Vertex groups = bones, make sure they line up and make sense. You can paint-select by pressing B twice and dragging the left mouse button over a bunch of stuff. Middle mouse button deselects stuff. Then right click to get out of B mode and you can mess with whatever you selected. I opened a second blender instance with the vanilla nif to compare and make sure the bones were pretty similar.
Edit: the way I ended up rigging the bones was by looking at the vanilla nif in blender to see which groups referred to what, then selecting similar vertex groups from the new nif (civ5 should actually set up pretty similar vertex groups, you just have to transfer them over to the vanilla nif's groups).
Edit: you may also need to make sure the bone weights match the way the vanilla one is sorted out. You can see that in 'weight paint mode'. If you use the bone weight copy option you may not need to do this.
Step 6. Export. Go File >> Export and make your options match the window shown in Ekmek's tutorial linked in step 4 above. Or TheMightyToad's tutorial. They use slightly different options. I used TheMightyToad's.
Step 7. Now open the exported nif and the old vanilla nif in Civ4, and follow SaibotLieh's post or Ekmek's tutorial or TheMightyToad's tutorial to nif swap. Basically, copy texture stuff from vanilla nif to exported nif, change it to point to the correct dds, copy nitrishape from exported nif to vanilla nif (make sure it is a nitrishape first), rename it to match the nitrishape in the vanilla nif, then delete the nitrishape in the vanilla nif. Follow Saibotlieh's post and delete the NiSkinPartition if the unit is not a shader. Then, follow notes in TheMightyToad's tutorial about the bounding sphere radius problem, which always happens for me.
Step 8. You should be done...a lot of tiny things in the nifs can go wrong and the thread linked to saibotlieh's post goes through many of them. Especially not having a texture show up at all (a black unit).
 
Last edited:
Would anyone be able to point out what is wrong with this nif/blend that makes it...explode all over the place in game? It looks fine in nifskope, I can even load animations fine, and the model looks okay-ish from certain angles in-game - but it's missing tons of triangles everywhere and moving the camera appears to explode these out all over the screen. But only sometimes. (Animations work fine though, on the parts that are not invisible.)

Nif/blend attached in a zip, with animations/textures if you would like to open it in game or nifskope. I am trying to convert danrell's civ5 hellcat to civ4 using snafusmith's centurion skeleton and animations (they are simpler than the vanilla tank, which also got me explodey hellcats...but much worse)
ingame.jpg
pedia.png
 

Attachments

  • tank2.zip
    277.5 KB · Views: 26
That fixed it completely, thank you so much for your help!!
 
Top Bottom