Modding 3D graphics for Wonders, Buildings, Citystyles, etc

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,812
Location
London, UK
With the release of the Nexus Buddy 2 beta 8 it is now possible to modify or replace 3D graphics for Wonders and other entities that contain multiple models in their .gr2 file.

This is a brief walk-through of the process.

Tools Used
Blender 2.49b
Nexus Buddy 2 - beta 8
Deliverator Blender Scripts - version 7

Steps

1. Copy your vanilla .gr2 file to a working directory. You'll also want to copy the corresponding .fxsxml file too. For this tutorial I copied hagia_sophia.gr2.

2. Open your copied vanilla .gr2 file in Nexus Buddy 2. Here I've open hagia_sophia.gr2. In the Select Model tab select the Model you want to modify or replace. Some models will have models prefixed HB for half-built or PL for pillaged. In this case I am just going to select the complete Hagia Sophia model to demonstrate the method.



3. In the Advanced tab click Export to NB2 (Current Model). This will export the selected model to an NB2 file which should appear in your working directory.



4. In Blender in the File menu select Import > Nexus Buddy 2 (.nb2).



5. De-select the two options "Rotate Meshes 90 degrees" and "Delete Top Bone" and then click "Import NB2".



6. Select your .nb2 file from the file browser. In my case the file is called hagia_sophia_model2.nb2.



7. You should now be able to view the imported model in the Blender 3D Viewer.



8. Now you can modify or replace your model. For this tutorial I used Shift-D (Duplicate) to create a fifth and sixth minaret.



9. Next we need to rig our mesh to model's single bone. I always have the Outliner window open in the top-left of Blender as it allows you to see the internal structure of your model. Here we can see that our model's armature (which is the Blender terminology for skeleton) has a single bone called Hagia_Sophia. In order to rig our mesh to this bone, we need to perform the following steps:

i) Select the mesh, either using right-click in the 3D View or left-click in the Outliner.
ii) Switch to the Editing panel - by pressing F9 or clicking the black box with pink dots in the corners icon.
iii) Under Vertex Groups click New and give it exactly the same name as the bone, Hagia_Sophia.



iv) Make sure all vertices in the mesh are selected. Press TAB to enter Edit Mode and A to Select All.
v) Under Vertex Groups click Assign to assign every vertex in the mesh to the Hagia_Sophia. All vertices are now rigged to the model's single bone.



10. Now export your model to BR2. It is probably also a good idea to save your Blender session to a .blend file so that you can adjust or re-use you model in the future.



11. Now back in Nexus Buddy 2, make sure the model whose meshes you want to overwrite is selected and click Overwrite Meshes from BR2 under the Advanced tab. Select the .br2 file we just exported from Blender and the meshes will be completed replaced with the ones from Blender. Warning: Overwrite Meshes from B2 will amend and save the currently open file so you'll probably want to backup your target .gr2 file before-hand.



12. Once the overwrite is done, you can now use the View button to inspect your amended .gr2 file. The Hagia Sophia now has six minarets instead of four.



This is as far as I've got in testing out this process, but there should be no reason why graphics modified like this shouldn't work in game.
 
Also, is there anyway to actually add NEW citystyles to the game with custom graphics?
 
Also, is there anyway to actually add NEW citystyles to the game with custom graphics?

I think polynesia is the only civ that has unpacked code for this. Here's a look at Civ5ArtDefines_CityBuildings_Polynesia.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<BuildingArtInfos>

  <!-- Polynesian ************************************************************ -->
  <Culture name="Polynesian" lighting="Asia">
    <Era name="Ancient">
      <PopulationBuildings>
        <Granny>Poly_Anc_City.gr2</Granny>
      </PopulationBuildings>
    </Era>
    <Era name="Rennaisance">
      <PopulationBuildings>
        <Granny>Poly_Ren_City.gr2</Granny>
      </PopulationBuildings>
    </Era>
    <Era name="Industrial">
      <PopulationBuildings>
        <Granny>Poly_Ind_City.gr2</Granny>
      </PopulationBuildings>
    </Era>
    <Era name="Modern">
      <PopulationBuildings>
        <Granny>Poly_Mod_City.gr2</Granny>
      </PopulationBuildings>
    </Era>
  </Culture>
  
</BuildingArtInfos>

It looks like as long as your .gr2 file is good, the XML/SQL should be easy.
 
Oh my god... Igloos.... Igloos everywhere!
 
Quite sadly, I tried adding a city_style following Polynesia's scheme; (kind of reusing city-styles just to test) and it didn't work. So my bet is that one would have to go the Import to VFS=True way and replace either Poly's define or some other file ingame.

Good news is, that its actually possible to add; but we'd need to make it community project so no incompatibility issues exist :goodjob:
 
Oh my god... Igloos.... Igloos everywhere!

Did you get it to work?!?

Quite sadly, I tried adding a city_style following Polynesia's scheme; (kind of reusing city-styles just to test) and it didn't work. So my bet is that one would have to go the Import to VFS=True way and replace either Poly's define or some other file ingame.

Good news is, that its actually possible to add; but we'd need to make it community project so no incompatibility issues exist :goodjob:

Yeah, VFS=True is a given for any kind of art file, although I don't see why you couldn't add a new city set. Civ 4 was moddable this way, so I don't see why it would have changed in Civ 5...
 
No, I'm just saying. If it were possible, then I can imagine Igloo villages everywhere. Shame you can't add additional city styles as of yet.
 
Yeah, VFS=True is a given for any kind of art file, although I don't see why you couldn't add a new city set. Civ 4 was moddable this way, so I don't see why it would have changed in Civ 5...

I mean a VFS=True on the xml file. The Database doesn't load custom defines for city-styles (just like it doesn't load UnitFormations) by itself, so we need to replace the original file through the mod.

(At least the last time I tried, mind you, things could have changed after a patch without anybody noticing)
 
No, I'm just saying. If it were possible, then I can imagine Igloo villages everywhere. Shame you can't add additional city styles as of yet.

Bummer, you got my hopes up lol

I mean a VFS=True on the xml file. The Database doesn't load custom defines for city-styles (just like it doesn't load UnitFormations) by itself, so we need to replace the original file through the mod.

(At least the last time I tried, mind you, things could have changed after a patch without anybody noticing)

Huh, even with an UpdateDatabase action?

I guess I'll wait until someone trailblazes this, I've got a couple of other projects to work on first.
 
Has anyone tried swapping wonders for tiles? From the looks of blender the scale is way off. If I get time (I often don't sadly) I'll take a look.

If you mean using wonder models as improvement models, then yes I have tried this. It's quite simple but the issue is that the fxsxml always defaults to the half-built state.
 
If you mean using wonder models as improvement models, then yes I have tried this. It's quite simple but the issue is that the fxsxml always defaults to the half-built state.

What happens if you use NexusBuddy to swap the meshes for the fully and half built states? Does it show up correctly then?

Also, awesome work on all your new tools, Deliverator! You're making CiV modding so much better!
 
If you mean using wonder models as improvement models, then yes I have tried this. It's quite simple but the issue is that the fxsxml always defaults to the half-built state.

thanks, i meant swaping the models using nexus buddy to create new ones. i wonder if the scale is off. it seems that it is when I import.
 
Has anyone converted a Wonder to an Improvement graphic yet? It's something I've been trying to figure out for over 2 yrs now. (The issue is that if you use them as is, they stay stuck in the "under construction" state.) I thought I saw a post somewhere saying this would be easy, but nothing involving 3D graphics is easy for me.
 
Has anyone converted a Wonder to an Improvement graphic yet? It's something I've been trying to figure out for over 2 yrs now. (The issue is that if you use them as is, they stay stuck in the "under construction" state.) I thought I saw a post somewhere saying this would be easy, but nothing involving 3D graphics is easy for me.

I'm sorry, man I get half way through on that and then something comes up. I think I have some pyramid gr2s somewhere to test
 
Top Bottom