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

Anyone else getting a crash when you try to convert the marine.gr2?

I see what you mean now it crashes with both nexus buddy & material maker. Maybe you could use the paratrooper or infantry gr2's as your template.
 
Hey Guys,

I converted a bunch of gr2s to smd->milkshape txt but didnt do the blender part yet because my milkshape expires in 2 weeks. If you guys want to work on any templates for these have at it!

Code:
afri_anc_city_new.txt
antiaircraftgun_new.txt
antitankgun_new.txt
artillery_new.txt
atomicbomb_new.txt
barbarian_euro_alpha_new.txt
battleship_new.txt
cannon_new.txt
caravel_new.txt
carrier_new.txt
catapult_new.txt
eurofemale18_new.txt
gatling_gun_new.txt
greatartist_early_flagbearer_new.txt
greatmerchant_early_leader_new.txt
jetfighter_new.txt
mayan_atlalist_new.txt
mobilesam_new.txt
plantation_mid_banana2.txt
u_american_minuteman_new.txt
u_indian_warelephant_new.gr2.txt
u_japanese_samurai_new.txt
u_roman_ballista_new.gr2.txt
u_spanish_treasure_cart_new.txt
union_rifleman_new.txt
worker_euro_modern_new.txt
worker_euro_new.gr2.txt
xp_privateer_new.txt
 

Attachments

Anyone else getting a crash when you try to convert the marine.gr2?

Yep, I have the same. The Bismark leader gr2 is the same I think. It doesn't look like an exception that can be debugged unfortunately. Must be something slightly different with those gr2s.

Has anyone found a leaderhead other than Haile Selassie that extracts to SMD with the skeleton?
 
IGrannyModel has a RemoveMeshBinding method but does NOT have a AddMeshBinding method. So I can RemoveMeshBindings but I can't add new ones. :undecide:
...

But it would be awesome to overcome this final hurdle so that we can actually create modding tools that allow multi-mesh objects (which a lot of Civ4 models are) to be flawlessly imported to Civ 5 without merging meshes. But for now I'm stuck...

More breakthrough news! Though a combination of studying the decompiled code in dotPeek and then using such fun coding stuff as reflection, pointers and direct copying of memory blocks, I have successfully created C# code that can add new MeshBindings to a Model. I am now very close to having a fully working Append function that will add the mesh from another gr2 to your current one. This should allow to bypass the FBX->GR2 corruption issues with multi-mesh objects and get them into Civ 5. I'm aiming to have a new version Nexus Buddy including this Append function, Leader shader support and a few other changes this weekend. Watch this space. :)
 
Awesome news! :bowdown:
 
Spoiler :
attachment.php

I've tried to open fic files through windev. No result.
 
I wanted to say that the progress being made by the individuals in this thread is incredible. Thank you for doing so much intense work these past few weeks.

Can I make a request? Just answer a few questions for someone who knows very little about this. I see you've allowed access to skeletons for units and buildings now. I understand that complex units meshes are not being friendly and that you're figuring that out. I understand that skeletons are important for animating the unit and meshes are important for skinning the unit. What I don't get (besides alot of everything that was said here);

1. With this access to the full unit model, what can a modder do now that he couldn't do before? Does it allow the creation of custom animations?

2. Effects like smoke, muzzle flash, etc... These are not part of this progression, right? These are the things that depend on the skeletons being correct so they'll look right... right? If that's the case, has it been at all possible to access and edit these effects? If impossible, what will having access to the skeletons do for us? It just goes to assume that custom animations would need custom effects. If neither of these things are possible... how does skeleton access help?

3. With the inevitable success of this breakthrough, what major graphics hurdles still remain? I can think of the one that hurts me in my bad place, and that's not being able to create new terrain features, like cacti on desert tiles, or a vulture. A rock outcropping. Little stuff like that.

4. Is all of this going to break at launch of the next expansion?
 
Success! The five separate mesh War Chariot unit extracted into Blender, modified and re-imported into the game with all animations working and meshes intact. :D

attachment.php


attachment.php


attachment.php


attachment.php
 

Attachments

  • horned_success_blend.jpg
    horned_success_blend.jpg
    43.2 KB · Views: 651
  • horned_success1.jpg
    horned_success1.jpg
    78.2 KB · Views: 584
  • horned_success2.jpg
    horned_success2.jpg
    109.3 KB · Views: 636
  • horned_success3.jpg
    horned_success3.jpg
    77.8 KB · Views: 666
Well done, Deliverator! :hatsoff:


With this access to the full unit model, what can a modder do now that he couldn't do before?
I'm no expert, but the experts are apparently busy... (Let me know if I've got any of this wrong!)

Custom animations have always been possible, but they're difficult to do well, and there are a lot of different states for each unit. The easiest method to ensure good animations is to attach the new model to the skeleton of an existing model, and this will be much easier to do now.

Similar answer for effects.

The problem with terrain is that you can't add new terrain art defines. However, you can get around that with either editing files directly in the installation folder, or you could just make a new resource that provides no benefits (but then you'd probably have to hide the tooltip description) [and in the latter case you'll also need to replace the farm graphics to prevent the farm crash bug].

BNW is extremely unlikely to mess with any of the existing models, and it's safe to assume the new units will use the same format (and will therefore provide an additional set of animations).
 
Ekmek said:
Did it require nexusbuddy changes?

Yes, there's some pretty complex new code in my latest Nexus Buddy. I'm going to start a new Nexus Buddy thread soon to share beta versions while I continue refining and adding to it.

Can I make a request? Just answer a few questions for someone who knows very little about this.

No problem. I'm planning to do an intro to 3D art for complete beginners soon. There is a learning curve, but it's really not as complex as some people seem to think.

1. With this access to the full unit model, what can a modder do now that he couldn't do before? Does it allow the creation of custom animations?

To create an animated 3D model in Civ 5 there are a few choices:

1. Animate your model from scratch. This is quite an advanced skill, requiring you to manually plot out your models movements in 3D software such as Blender. You need to create a different gr2 file for each action - idle, running, attacking, etc so this takes time.

2. Convert Civ 4 animations to Civ 5. This is easier than the first option because you don't have to create the animations by hand - you are just converting the animations from the Gamebryo NIF/KF format used in Civ 4 to the Granny GR2 format used in Civ 5. However, you still need to convert each the animation for each individual action and there are other disadvantages: Civ 5 has some actions that Civ 4 didn't have, and the timings of the actions are different too.

3. Use Civ 5 animations. This is easier still because you can use the existing Civ 5 animation GR2s. All you need to do is rig your model to a skeleton that has the correct structure for the animation set you want to use. (Rigging means assigning each section of the mesh to a particular bone in the skeleton, so that, for example, when the hand bone moves the hand section of the model's mesh also moves - the technique is described here but I want to do a better tutorial for complete 3D beginners)

Until we had the technique described in the opening post of this thread, the only way to get a skeleton that would work with Civ 5 animations was to copy it by hand. I did a couple of these and then Danrell did a bunch more, but there we still a lot of units without a hand-made skeleton template. Making these templates by hand was very difficult and time consuming, and in the best case scenario the template is only going to be roughly similar to that of the model you are basing it on. Hand making skeletons for Chariots, Elephants, Triremes and Giant Death Robots would be extremely tedious and hard.

So, to answer your question, the Skeleton extraction breakthrough means that:

a) We can create precise templates including skeletons directly extracted from Civ 5 in less than 2 minutes, rather than approximate hand-made efforts that took a painfully long time.
b) This therefore means we can make 3D models (units, wonders, potentially leaders, improvements, etc) using almost the full range of available Civ 5 animations.
c) It means that as well as being able to re-texture Civ 5 models (which has been possible since the original IndieStone tools were created) we can also change the meshes and re-import into the game.

The breakthrough with multi-mesh models should mean that we can get around the instability of the FBX to GR2 conversion and import models that use multiple meshes and textures. One consequence of this is that it should make the process of converting Civ 4 models to use Civ 5 animations simpler as there should no longer be a need to combine meshes into one and textures into a single file.

DocBuchanan said:
2. Effects like smoke, muzzle flash, etc... These are not part of this progression, right? These are the things that depend on the skeletons being correct so they'll look right... right? If that's the case, has it been at all possible to access and edit these effects? If impossible, what will having access to the skeletons do for us? It just goes to assume that custom animations would need custom effects. If neither of these things are possible... how does skeleton access help?

I've not dug into Civ 5 effects very much - but see this post. If it works in roughly a similar way to Civ 4 then your custom unit just needs an extra bone in the skeleton for the effect to emit from. For Civ 4 I created custom breath effects for the Drake conversions from Kohan II. I'm hoping at some point to complete the flying dragon I started in 2010 and use the Dromon Greek Fire effect for the breath. Should be do-able. Actually, editing the effects themselves, how they look and behave, is something that could be done in Civ 4, but I haven't looked into for Civ 5.

DocBuchanan said:
3. With the inevitable success of this breakthrough, what major graphics hurdles still remain?

These are the ones that spring to mind:

1. Leader model textures have some additional protection and cannot be opened by any known program.

2. Most Leader model skeletons cannot be extracted with Haile Selassie the lone exception so far.

3. Ekmek has found problems with Wonders in that they use multiple skeletons as well as meshes. I haven't looked into this myself, but I'd be hopeful that we can get around this issue, if needs be by adding more features to Nexus Buddy to handle multiple skeletons.

4. A more minor issue is that at the moment the skeleton extraction seems to shift the rotation and position of the skeleton in relation to the mesh in some cases requiring manual adjustments as shown in the 2nd post. This is on my list to investigate, and hopefully fix.

On 2, it should now be possible to put the extract Haile Leader model back into the game - but someone would have to paint the textures by hand. On the upside Blender does have a Save UV Face Layout feature to make templates for the textures.

It might also be possible to use the Haile skeleton as a basis for rigging other Civ 5 Leader meshes if they use a similar structure.

DocBuchanan said:
I can think of the one that hurts me in my bad place, and that's not being able to create new terrain features, like cacti on desert tiles, or a vulture. A rock outcropping. Little stuff like that.

Terrain textures is one of the simplest things to mod requiring only a paint program and editing a CSV file. I'm surprised no-one seems to have done much of this given that its one of the things that hasn't changed since the beginning. See this post. Perhaps another tutorial is needed.

3D stuff like features ought to be possible, but I haven't dug into yet. See this thread.

DocBuchanan said:
4. Is all of this going to break at launch of the next expansion?

No. As Nutty says, Brave New World is not going to change the graphics engine so all this will still be applicable.
 
I'm speechless. This is awesome work - I'm sure everyone in the community would be posting here if they knew what kind of a breakthrough this was. Simply fantastic!!
 
Yes, there's some pretty complex new code in my latest Nexus Buddy. I'm going to start a new Nexus Buddy thread soon to share beta versions while I continue refining and adding to it.

Awesome! :D I'm excited to try it out.

It would be great if you could include a feature shader in Nexus Buddy which could deal with the existing feature art (and add new ones!). The building shader works, but the art 'floats' above the hex (noticeable that units stand 'in' it, instead of on it), and the old Nexus Buddies can't deal with the existing feature shaders at all.

Terrain textures is one of the simplest things to mod requiring only a paint program and editing a CSV file. I'm surprised no-one seems to have done much of this given that its one of the things that hasn't changed since the beginning. See this post. Perhaps another tutorial is needed.

3D stuff like features ought to be possible, but I haven't dug into yet. See this thread.

Woah, I wasn't aware of this at all! Amazing! I'll take a look at the relationship between the terrains csv and the Terrains table at some point and see if new terrain types with graphics can be added in that way. At a glance it looks like it might be related to the terrain art defines though, which I can't find in the game DB.
 
I'm speechless. This is awesome work - I'm sure everyone in the community would be posting here if they knew what kind of a breakthrough this was. Simply fantastic!!

Indeed
Very few people know what's going to happen to their art in Civ V soon :king:
Deliverator and all the other contributors: You guys are making an amazing job here!
 
It would be great if you could include a feature shader in Nexus Buddy which could deal with the existing feature art (and add new ones!). The building shader works, but the art 'floats' above the hex (noticeable that units stand 'in' it, instead of on it), and the old Nexus Buddies can't deal with the existing feature shaders at all.

It should be possible to add support for Simple Shader to the new Nexus Buddy. I now have code to access the names for the parameter sets - which is needed because there is no exposed method to do this and you can only set parameters if you know the name. Both Simple Shader and the Leader shaders have various Float numeric parameters as well as texture filenames.

Here's the Simple Shader spec from feature_jungle.gr2:

Spoiler :
Shader set: SimpleShader
Parameter set 0: LeaderDynamic
Param Name: BoneMatrices
Param Type: DT_FLOAT
Parameter set 1: CameraParameters
Param Name: mtxViewProj
Param Type: DT_FLOAT
Param Name: mtxViewInv
Param Type: DT_FLOAT
Parameter set 2: LeaderLights
Param Name: g_vLightColors
Param Type: DT_FLOAT
Param Name: g_vLightAttenuation
Param Type: DT_FLOAT
Param Name: g_vLightPositions
Param Type: DT_FLOAT
Parameter set 3: Civ5LeaderheadTextures
Param Name: DiffuseMap
Param Type: DT_2D_TEXTURE
Param Name: NormalMap
Param Type: DT_2D_TEXTURE
Param Name: SREFMap
Param Type: DT_2D_TEXTURE
Parameter set 4: Civ5LightingTextures
Param Name: IrriadanceMap
Param Type: DT_CUBE_TEXTURE
Param Name: EnvironmentMap
Param Type: DT_CUBE_TEXTURE
Param Name: SpecMap
Param Type: DT_CUBE_TEXTURE
Parameter set 5: SimpleGlobalConstants
Param Name: ViewProjMatrix
Param Type: DT_FLOAT
Param Name: ViewMatrix
Param Type: DT_FLOAT
Param Name: ViewInverseMatrix
Param Type: DT_FLOAT
Parameter set 6: SimpleDataDynamic
Param Name: WorldMatrix
Param Type: DT_FLOAT
Param Name: TeamColor
Param Type: DT_FLOAT
Parameter set 7: SimpleTextures
Param Name: BaseSampler
Param Type: DT_2D_TEXTURE
Param Name: EnvironmentMaskSampler
Param Type: DT_2D_TEXTURE
Param Name: TeamColorSampler
Param Type: DT_2D_TEXTURE
Param Name: LightCubeMapSampler
Param Type: DT_CUBE_TEXTURE
Param Name: EnvironmentMapSampler
Param Type: DT_CUBE_TEXTURE
 
Nexus Buddy 2.0 beta 2 is uploaded. Let me know if you have any feedback or suggestions.
 
Back
Top Bottom