Tutorial: Converting 3D Art from Civ 5/Civ BE to Civ 6

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,812
Location
London, UK
Tools Required
Nexus Buddy 2
CivNexus6
Blender 2.7+
Nexus Buddy 2/CivNexus6 Blender Scripts
Civ 6 Modbuddy & Asset Editor

Background

3D Art Assets in Civilization 6: A Modding Guide

There is now a slightly improved method available using the new .cn6 format and latest version of CivNexus6 and the scripts. I have colour-coded the different steps like so:

Steps that apply to both methods
Steps that apply to the improved .cn6 method
Steps that apply to original .br2 method

Steps

0) If not already done, unpack the Civ V models and textures from .fpk directories. You can use Dragon Unpacker for this.

1) Gather the model and animation .gr2 files for the specific unit as well as its .dds texture files into a working directory. e.g. Create a directory called "galleass" and copy the files galleass.gr2, all galleass*.gr2 files and galleass*.dds files into it.

2a) First use "Load String Database" first and load the *.gsd file that will have been unpacked with the models. This will be called something like unitmodels_stringdatabase.gsd.

2b) Start Nexus Buddy 2 and use the "Resave all GR2 Files in Directory" function under Additional Actions on your working directory. All .gr2 files will be resaved to a subdirectory named "resaveBatch".

3) Open your resaved model .gr2 and perform "Export Model" to export to .cn6.

4) Start Blender 2.7+ and import the .cn6 file using the Addon scripts.

5) In Blender create and name Material(s) and assign all vertices to them. (This saves having to create and name Materials in CivNexus6 later).

6) Export model to .cn6 format - use the same filename as the original .gr2 model apart from the extension.

7) Import your .cn6 model into CivNexus6. The materials you set up in Blender will automatically be created.


5) Export to .br2. The .br2 file will include not only the normals for each vertex, but also the binormals and tangents.

6) Make a copy of your model .gr2 and then open it in CivNexus6 - it will immediately be resaved as a .fgx file.

7) Now use "Ovwr. BR2" to overwrite the model's meshes with the data from the .br2 file. The reason for doing this is that the mesh format in Civ 6 is different from that in Civ 5/Civ BE.


8a) In Civ 5 units face forwards whereas in Civ 6 units face to the right as you look at them (to their left). This means we need to rotate them by 90 degrees. This can be simply achieved by using "Insert Adjustment Bone and Save" in CivNexus6 with Axis set to "Z (Up-Down)" and Rotation Angle set to 90. This will save your .fgx with the new bone inserted so you'll probably want to back up your .fgx beforehand.

8b) Add, Remove, Rename Materials and reassign Materials to meshs as required using CivNexus6 then save the .fgx.

9) Use the "Create GeometrySet .xml for .ast file" and "Create Geometry/Animation (.geo/.anm) File" buttons to create the GeometrySet XML and .geo file for the model.

10) Now bulk convert all the Civ 5/Civ BE .gr2 animation files to Civ 6 .fgx/.anm by using the "Convert all .gr2 Files in Directory to .fgx/.anm" button on your resaveBatch directory - the output will be saved in a subdirectory called "fgx_anm_output".

If using CivNexus6 1.2.3+ your Asset .ast file will be created automatically as part of the "Convert all .gr2 Files..." action. This works by assigning Civ V animations into the Civ VI animation slots. The mapping is editable if you need to tweak it - see the Civ6ToCiv5AninMap.txt in the CivNexus6 application directory. Another file containing just the Behavior data is generated within the fgx_anm_output folder called m_BehaviorData.xml in case you want to copy it into an .ast file manually.

The Asset file should allow the unit to work in the Asset Previewer and Civ VI once you have hooked up the Materials and Textures. There will be no Attachment Points, Sound FX or Visual FX included initially so you will have to edit these in yourself.

As with the CivNexus6-generated .geo file, the .ast file has no indentation formatting, but this is easily fixed in Modbuddy after you import it using Edit > Advanced > Format Document (shortcut Ctrl-K followed by Ctrl-F).


Now you can assemble everything in Modbuddy:

11) Open a new Modbuddy project and start the Asset Editor.

12) Add your animation .anm/fgx pairs to the Animations folder - probably better to do this via your file explorer locating your project's directory under \My Documents\Firaxis ModBuddy\Civilization VI - and then use Add Existing Item to import to your project.

12) Add the .geo and .fgx file pair for the model to your Geometries folder.

13) Use the Asset Editor to create a new Texture importing the Diffuse map as Generic Base Color type. Note: before importing it is best to re-save the .dds file as an uncompressed .dds using Photoshop, Gimp or Paint.NET (using the A8B8G8R8 format). This will create the .dds/.tex file which may be referenced from your Material .mtl. Initially it is quickest to stub out non-Base Color textures with black/white/flatNormal 4x4 squares - as discussed here.

14) You will then need to:
(i) Create a Material (.mtl) file (you can copy one from the pantry just make sure that the m_Name towards the bottom matches your new file name) and reference all your Textures. Add to your project's Materials folder.
(ii) Create an Asset (.ast) file (again you can copy one, but update m_Name), overwrite the GeometrySet entry with the XML created in step (9).
(iii) In your .ast file, update the m_ObjectName in the Material element to point to your newly create Material file:
<Element class="AssetObjects::ObjectValue">
<m_ObjectName text="My_New_Material"/>
<m_eObjectType>MATERIAL</m_eObjectType>
<m_ParamName text="Material"/>
</Element>

(iv) You will need to reference your individual Animations (.anm files) under the <m_animationBindings> section, either in the .ast file directly or in a Behaviour .bhv file referenced under <m_behaviorInstances>. As usual copying and editing a vanilla .ast file is a good place to start.

Once you're done add your .ast file to the Assets folder of your project.

At this stage you should be able to view your unit correctly and test the animations in the Asset Previewer. If not then something has gone wrong and you should identify and fix the issue before proceeding.

15) Create an .xlp file including your new Asset and add to your project's XLPs folder.

16) Create the Unit_Bins.artdef (or relevant .artdef for type of asset) to reference the Asset entry inside the .blp that will be generated from the .xlp package spec.

17) Create your Units.artdef to reference the Unit_Bins.artdef entry plus whatever gameplay XML/SQL needs to be set up to see your object in game.

18) Make sure your Mod.Art.xml references your .artdef files under <artConsumers> and the target .blp of your .xlp under <gameLibraries>.

19) Now you can build out your project and test in game. :D

Good luck!

Examples

A full working conversion can be found in the Even Moar Units: Macedon and Persia mod - the Ballista converted from Civ 5 or the main Moar Units mod contains the Trebuchet and Gatling Gun converted from Civ 5.

Mammoth Unit, previously ported from Wildlife Park 2 using vanilla Naresuan's Elephant (u_siamese_warelephant) animations.



Civ Beyond Earth CARVR Unit:

 
Last edited:
Those Beyond Earth mechs look so good. Someone has to make a mod with Future Units :D

Also thanks Deliverator, this is going to come in handy :)
 
Excellent work Deliverator! I have faith that you will eventually figure out the custom animation issue. I will monkey around with them a bit and see if I can find any patterns/anomalies that could help provide a solution. Time for me to start grinding out fantasy units! :lol:
 
Excellent work Deliverator! I have faith that you will eventually figure out the custom animation issue.

Yeah, it's a weird one. I have models animating perfectly in FGX Viewer but in game the animation's rotations are screwed up. I've tried playing spot-the-difference between the Civ 5 vanilla .gr2 animations and the FBX-sourced .gr2s but to no avail so far. I'll take a break and come back by trying will the simplest possible 1/2 bone animation to see if I can figure out what is happening.
 
Great work! So would it be possible to import all the units from civ5 to civ 6 and make the game less cartoonish?
 
Yeah, it's a weird one. I have models animating perfectly in FGX Viewer but in game the animation's rotations are screwed up. I've tried playing spot-the-difference between the Civ 5 vanilla .gr2 animations and the FBX-sourced .gr2s but to no avail so far. I'll take a break and come back by trying will the simplest possible 1/2 bone animation to see if I can figure out what is happening.

Not sure if this will assist with testing or not, but I have a single custom animation that I made by tweaking the existing CiV Scout anims, so all animations are vanilla CiV Scout animations except for one. Perhaps instead of using a simple custom set you can use a single custom derived from vanilla CiV anims if that helps troubleshoot the issue. It is here : Spellcaster Animation
 
Hero.PNG
Idle.PNG

Found something really weird when importing the Longswordsman. The combat, running etc. animations work fine. But idle animations turn it into a hunchback....
 
Found something really weird when importing the Longswordsman. The combat, running etc. animations work fine. But idle animations turn it into a hunchback....

This confirms that it is something different between the animation .gr2/.fgx files that is making the bone rotations get screwed up. The question is "what is the difference?".
 
@Wolfdog For the Longswordsman idle animation above I would try converting the .gr2 to .fgx via Blender and .fbx as described in this post to see if that resolves the rotation issue.
 
Thanks Deliverator I will give it a try.

Forgot to mention you should create the .nb2 and .na2 for the Civ 5 .gr2 using Nexus Buddy 2 and then CivNexus6 to import the .fbx animation.
 
Forgot to mention you should create the .nb2 and .na2 for the Civ 5 .gr2 using Nexus Buddy 2 and then CivNexus6 to import the .fbx animation.
Thanks Deliverator I finally got around to give this a try but it did not make any difference to the animations, they seemed to be the same as they were before.

So unfortunately we are not any closer to tracking down the difference between Civ5 & Civ6 animations.:(
 
Thanks Deliverator I finally got around to give this a try but it did not make any difference to the animations, they seemed to be the same as they were before.

So unfortunately we are not any closer to tracking down the difference between Civ5 & Civ6 animations.:(

I think I've identified the issue. Civ 6 uses additive animation for some states. for example there are Breathing animations that might be combined (added together) with an Idle or Run animation to create the end effect of breathing combined with standing, running or whatever.

I noticed this earlier when I was trying to fix the flying dragon conversion - the animation effects seemed to be doubled. Now I understand that this is because I was pointing the same animation to BREATHING_A and IDLE_A for example so when these two animation are combined by the DSG each bones animation effect was being doubled, thoroughly mangling the unit.

So Civ 5 animations do indeed work fine in Civ 6 - there is no difference! But what remains is to find a nice way to remove the breathing stuff from either the behaviour data sets or the .dsgxml or both to create a non-additive set-up where one animation state uses only one .fgx/.anm animation.

But anyway the news is good on the animation front - just need to find the cleanest way to remove the breathing stuff either by using a different vanilla .dsg or by creating a new one. Another option would be to create a unmoving animation and use that for the breathing animation entries so that there is no multiplication effect.

Edit: The simple way to get rid of the additive problem in the end was simply not to specify IDLE animations at all and use the BREATHING slots for the IDLE animations.

dragon_asset_viewer.jpg


Civ6Screen0033.jpg
 
Last edited:
I think I've identified the issue. Civ 6 uses additive animation for some states. for example there are Breathing animations that might be combined (added together) with an Idle or Run animation to create the end effect of breathing combined with standing, running or whatever.

I noticed this earlier when I was trying to fix the flying dragon conversion - the animation effects seemed to be doubled. Now I understand that this is because I was using the pointing the same animation to BREATHING_A and IDLE_A for example so when these two animation are combined by the DSG each bones animation effect was being doubled thoroughly mangling the unit.

So Civ 5 animations do indeed work fine in Civ 6 - there is no difference! But what remains is to find a nice way to remove the breathing stuff from either the behaviour data sets or the .dsgxml or both to create a non-additive set-up where one animation state uses only one .fgx/.anm animation.

But anyway the news is good on the animation front - just need to find the cleanest way to remove the breathing stuff either by using a different vanilla .dsg or by creating a new one. Another option would be to create a unmoving animation and use that for the breathing animation entries so that there is no multiplication effect.

View attachment 470082

View attachment 470083
Great news. My experience matches what you are saying in that the animations that have breathing associated with them are warped which is mostly but not limited to idle animations. I would imagine you would need Maya to edit DGS's?.

I was playing around with rotating Civ6 animations in Blender 2.78 and found that I can export animations to .fbx ascii and they import OK into CivNexus6. Do you see any implications from doing this as apposed to blender 2.49b .fbx export? They look OK in FGX viewer but I have not tried them in game yet.
 
Great news. My experience matches what you are saying in that the animations that have breathing associated with them are warped which is mostly but not limited to idle animations. I would imagine you would need Maya to edit DGS's?.

Well, both the .dsg and .dsgxml files are just XML so it may be possible to edit them by hand. The .dsg files are metadata files similar to .anm, .geo, .mtl, etc and the .dsgxml contains the actually animation state graphs.

It seems Firaxis went down the road of using the same dsg for most units (potential_any_graph.dsgxml) so that explains why even ModernArmor.fgx has a breathing animation (ModernArmor_BreathA.fgx) which is 0.3333 seconds of zero movement on all bones - I inspected the .na2 animation export to confirm that. It might turn out to be simpler to create a dummy breathing animation like this rather than figure out how to make an edit of potential_any_graph.dsgxml that doesn't include the breathing animations.

I was playing around with rotating Civ6 animations in Blender 2.78 and found that I can export animations to .fbx ascii and they import OK into CivNexus6. Do you see any implications from doing this as apposed to blender 2.49b .fbx export? They look OK in FGX viewer but I have not tried them in game yet.

Can't see any issue with using 2.78 ascii .fbx export if you say it works in FGX Viewer. Check it in the Asset Editor - Asset Preview. If it works there then it should work fine in game. :)
 
i got a question, something i do not understand by now even after hours of walkthrough the tutorial : at step 13 reference your individual animations.

in the vanilla bhv file it Looks like this :

<m_animationBindings>
<m_Bindings>
<Element>
<m_SlotName text="ATTACK_A"/>
<m_AnimationName text="Archer_FireArrowStraightA"/>
</Element>

Slot is Attack_A
and Animation Name is Archer_FireArrowStraightA

so here i try to use civ v's Composite_Bowman_attacka

because here in this first case ist simple , cause the Slot is called Attack_A so i use Composite_Bowman_attacka Animation.

but how can i know which Animation of civ v (civ 6 ready in fgx/anm. Format ) i have to use for.....for example for Slot Backward_A :

<Element>
<m_SlotName text="BACKWARD_A"/>
<m_AnimationName text="UnitMedium_StrafeBack_BowAndArrowA"/>
</Element>

for Composite bowman there isnt any backward called Animation.....very confused here please help if you could :)


oh and the model doesnt Show up in asset Editor...????? Image is attached.
 

Attachments

  • Unbenannt.png
    Unbenannt.png
    851.2 KB · Views: 532
Last edited:
but how can i know which Animation of civ v (civ 6 ready in fgx/anm. Format ) i have to use for.....for example for Slot Backward_A :

<Element>
<m_SlotName text="BACKWARD_A"/>
<m_AnimationName text="UnitMedium_StrafeBack_BowAndArrowA"/>
</Element>

for Composite bowman there isnt any backward called Animation.....very confused here please help if you could :)

Well done on following this so far. :goodjob:

Obviously Civ 5 and Civ 6 are different games so the animation types don't match up 1-to-1. Some Civ 5 animation states like Run, Attack, Idle are easy but for others such as Backward you are going to have to pick which Civ 5 animation you are going to use instead. This may involve a bit of trial and error and seeing how the model behaves in the Asset Editor and especially in game. The Backward animation is used when the unit shuffles backwards so the Civ 5 Shuffle animations could work well for this.

oh and the model doesnt Show up in asset Editor...?????

In my experience, you'll get the exclamation mark instead of your model until all the animation bindings are hooked to valid animations (.anm files) and there are no issues with your .ast files and all dependent files. What I do is set every animation to an idle animation so that I can get it appearing, and then go back and start set each animation to the more appropriate one Run to Run, Attack to Attack etc.

For simplicity you can remove the <m_timelineBindings> and <m_timelines> sections while doing this - just stub them out with <m_timelineBindings/> and <m_timelines/>. These section are only needed when you want to add in Sound and Visual FX.

Hope this helps! :)
 
I think I've identified the issue. Civ 6 uses additive animation for some states. for example there are Breathing animations that might be combined (added together) with an Idle or Run animation to create the end effect of breathing combined with standing, running or whatever.

I noticed this earlier when I was trying to fix the flying dragon conversion - the animation effects seemed to be doubled. Now I understand that this is because I was pointing the same animation to BREATHING_A and IDLE_A for example so when these two animation are combined by the DSG each bones animation effect was being doubled, thoroughly mangling the unit.

So Civ 5 animations do indeed work fine in Civ 6 - there is no difference! But what remains is to find a nice way to remove the breathing stuff from either the behaviour data sets or the .dsgxml or both to create a non-additive set-up where one animation state uses only one .fgx/.anm animation.

But anyway the news is good on the animation front - just need to find the cleanest way to remove the breathing stuff either by using a different vanilla .dsg or by creating a new one. Another option would be to create a unmoving animation and use that for the breathing animation entries so that there is no multiplication effect.

View attachment 470082

View attachment 470083

Brilliant discovery and very much appreciated, Deliverator! I am thoroughly enjoying the fact that I can continue to create CiV models for those that wish to continue modding with it and then with very minor manipulation have the same unit for Civ VI. I am beginning to appreciate Civ VI more and more. Now if I only had time to do some conversions.... :)
 
Top Bottom