Extract GR2 to Blender with mesh AND skeleton and re-export to GR2

Hi everyone!

I'm new to modding civ, so for my first mod I'm just using other people's mods and messing around with them just for learning purposes, I'm not going to plagiarize and release someone else's work :P

But I'm having some trouble with the models for improvements. I have the code for an improvement model to show up, but I'm also trying to see if I can use a .gr2 model from Age of Empires (since pretty much the whole game uses .gr2 models :D) but their models have a texture path to a .ddt file, which I converted to a .dds file.

So I tried importing the file into the game (I have VFS set to true and the reloads all checked), here is the code for the improvement (NOTE: This is from CL's Inuit mod, I'm only using it to test out if I can put AoE models into the game) fxsxml:
<Asset>
<Mesh file="china_waracademy_age2.gr2" source="Max" />
<Texture file="china_waracademy_age2.dds" source="Max" />
</Asset>

And here's the SQL file:

INSERT INTO ArtDefine_LandmarkTypes(Type, LandmarkType, FriendlyName)
SELECT 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'Improvement', 'INUUIT_INUKSHUK';

INSERT INTO ArtDefine_Landmarks(Era, State, Scale, ImprovementType, LayoutHandler, ResourceType, Model, TerrainContour)
SELECT 'Any', 'UnderConstruction', 0.22, 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'SNAPSHOT', 'ART_DEF_RESOURCE_ALL', 'inukshuk_hb.fxsxml', 1 UNION ALL
SELECT 'Any', 'Constructed', 1.0, 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'RANDOM', 'ART_DEF_RESOURCE_ALL', 'inukshuk01.fxsxml', 1 UNION ALL
SELECT 'Any', 'Constructed', 1.0, 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'RANDOM', 'ART_DEF_RESOURCE_ALL', 'inukshuk01.fxsxml', 1 UNION ALL
SELECT 'Any', 'Constructed', 1.0, 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'RANDOM', 'ART_DEF_RESOURCE_ALL', 'inukshuk01.fxsxml', 1 UNION ALL
SELECT 'Any', 'Pillaged', 0.22, 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'SNAPSHOT', 'ART_DEF_RESOURCE_ALL', 'inukshuk_pl.fxsxml', 1;


INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset)
SELECT 'ART_DEF_IMPROVEMENT_INUUIT_INUKSHUK', 'Improvement', 'sv_inukshuk.dds';

But when I'm playing the game, the model doesn't appear at all! :( What am I doing wrong?

Also, when I try to import the model into nexus buddy, this error occurs:
Unhandled exception has occured in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately. Specified cast is not valid.

But granny viewer can view the model just fine.
 

Attachments

TomatoesYay said:
But I'm having some trouble with the models for improvements. I have the code for an improvement model to show up, but I'm also trying to see if I can use a .gr2 model from Age of Empires (since pretty much the whole game uses .gr2 models ) but their models have a texture path to a .ddt file, which I converted to a .dds file.

The .gr2 Granny format is proprietary and encoded differently for each game. Presumably this is deliberately designed to stop 3D assets being reused in different games. Unfortunately this means the mod tools that have been developed for Civ V won't work with .gr2s from other games, and I'm fairly sure .gr2s from other games won't work in Civ V. If the Firaxis Civ V SDK hadn't included libraries that can used to remove the encoding and get at the data then we wouldn't be able to modify/add new Civ V 3D graphics at all - and we still had to develop our own tools to do it!
 
Age of Empires 3. Certainly a really good source for models.

Edit: I've got a good tutorial that explians how to export thing from AoE3 to Blender... but it's in spanish, dunno if it could be of help to you.
 
Age of Empires 3. Certainly a really good source for models.

Edit: I've got a good tutorial that explians how to export thing from AoE3 to Blender... but it's in spanish, dunno if it could be of help to you.

Its worth a look. Being in San Diego spanish shouldn't be too hard!
 
Thanks everyone! Sorry I haven't replied, my computer had a virus and took me ages to remove, and had to reinstall everything.

Man modeling is so hard. I'm not sure if I'll ever be able to do it. Just seeing all those vertices and lines make my brain explode.

Does anyone know the existence of a converted Civ 4 model to Civ 5 of an Atakebune? I found a Civ 4 model but I'm just so stuck on the tutorials that I'm just trying to search for any current conversions lol. The model is over here: http://forums.civfanatics.com/showthread.php?t=283261

EDIT: I'm attempting to try something else, but whenever I try to export a .br2 file from Blender, it has 0 bytes and nexus buddy gets an error trying to open it. Am I doing something wrong?

EDIT2: I exported using FBX instead, and it worked! Kinda..

So I just saved the NIF file as an OBJ, imported the OBJ onto a Korean Turtle Ship, shrunk the turtle ship and enlarged the Atakebune, and tried to see if that worked. It didnt xD figures. It just showed up as invisible. I also tried editing the turtle ship, but even though I can delete vertices and faces and edges, the model is still there for some reason. I figured it might just be easier if I modify parts of the turtle ship. Seems like it's so much harder than I anticipated. Argh why is modeling soooo harrrrdddd and confussinngg -crycrycry-
 
Hi there. Well, i try to convert MAGES model to .br2 format. But i always got this problem:

Code:
"Error: Mesh has unweighted vertices!"
TypeError: Exceptions must be classes or instances, not str

You can check my files on the attachment below.
For those who know how to fix this problem, please reply me A.S.A.P. Thanks.
 

Attachments

You need to check all your meshes to make sure that all vertices are assigned to a vertex group before BR2 export will work.

I did do that. But, i try to select a vertex group, instead it covered all of the model vertices. How to fix that?
 
The entire model is assigned to one vertex group? That should still allow you to export, but if you want the vertex group to be assigned to smaller areas you need to remove vertices outside the area want to be rigged to that group from the group. Be careful if you do that so that you don't end up with unassigned vertices.
 
The entire model is assigned to one vertex group? That should still allow you to export, but if you want the vertex group to be assigned to smaller areas you need to remove vertices outside the area want to be rigged to that group from the group. Be careful if you do that so that you don't end up with unassigned vertices.

Still didn't work
 
Hello, I'm trying to get a "custom" GR2 to show up in-game but I'm having no luck.

Let me explain my situation:
At this stage, I have a functional conversion of an FBX into a GR2. The model shows up in Granny Viewer just fine. I am trying to re-export someone else's Blend file (in this case a WW1 Soldier Blend by Bernie14.) The end goal here for me is to modify his WW1 models, but I am not doing that YET, my FIRST step is just to get exporting and converting properly into the game. So this means I can compare my GR2 to his GR2 etc etc. I am doing this so I know that when I have export / convert set up properly, I can begin doing the actual modification.

Basically, I have everything (presumably) installed properly, and am exporting the file to FBX; no errors, everything seems fine, converting to GR2 works well... it shows up in Granny Viewer 2.2.2 and looks exactly the same as the older GR2 by Bernie14.

However in-game there are serious graphical artifacts when the unit is on screen, and the unit model does not show up. I know everything is set up properly in the mod side of things (including VFS=true) because if I replace my 'new' GR2 with the 'old' one it works fine. So the mod is not the issue.

So something is obviously not working right either when exporting to FBX or converting to GR2. I'd really like some help here.
 
Hello, I'm trying to get a "custom" GR2 to show up in-game but I'm having no luck.
...
So something is obviously not working right either when exporting to FBX or converting to GR2. I'd really like some help here.

The short explanation is that FBX to GR2 conversion is not reliable for mesh data. The only reliable way to import mesh data to GR2 is via the BR2 format using the Overwrite Meshes from BR2 function in Nexus Buddy. This is explained in more detail in the opening post under From Blender to Civ 5 GR2. If you export both FBX and BR2 from Blender you can open the FBX first to get the skeleton data and then use Overwrite Meshes from BR2 to get the mesh data. Happy to help if you have further questions.
 
The short explanation is that FBX to GR2 conversion is not reliable for mesh data. The only reliable way to import mesh data to GR2 is via the BR2 format using the Overwrite Meshes from BR2 function in Nexus Buddy. This is explained in more detail in the opening post under From Blender to Civ 5 GR2. If you export both FBX and BR2 from Blender you can open the FBX first to get the skeleton data and then use Overwrite Meshes from BR2 to get the mesh data. Happy to help if you have further questions.

Hmm, then I think something is going wrong with the BR2 export or the overwrite. Whenever I overwrite mesh, the 'new' mesh is rotated at an odd angle (maybe 45 degrees) away from the Skeleton... This is not the case in Blender or in the exported FBX format however.

I'm attaching the .blend file I'm working with. I'm currently using your updated Blender scripts on 2.49b. Thanks for the help!
 

Attachments

Hmm, then I think something is going wrong with the BR2 export or the overwrite. Whenever I overwrite mesh, the 'new' mesh is rotated at an odd angle (maybe 45 degrees) away from the Skeleton... This is not the case in Blender or in the exported FBX format however.

I'm attaching the .blend file I'm working with. I'm currently using your updated Blender scripts on 2.49b. Thanks for the help!

Select your mesh using right click then do Ctrl-A -> Scale and Rotation to ObData. This is a common gotcha - the visual position of mesh on screen hasn't actually been written to the mesh data. I just try out this out and it fixes the problem as far as I can see.
 
Select your mesh using right click then do Ctrl-A -> Scale and Rotation to ObData. This is a common gotcha - the visual position of mesh on screen hasn't actually been written to the mesh data. I just try out this out and it fixes the problem as far as I can see.

Yes!! Success. This definitely helped me resolve it - once I had done this, and it's rotation was now 'correct' in GR2 format, I immediately noticed that it was also backwards and sideways (so I followed your tutorial on rotating objects from page 1.)

All the best! Now I can begin my work.. :goodjob:
 
@Deliverator
Could you please take a look of why this .blender file can not export to .br2?
I import the pathfinder nb2 to blender, and do nothing, it just can't export.
 

Attachments

Back
Top Bottom