1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Import gr2 skeleton

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Nefliqus, Dec 18, 2011.

  1. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Yeah I'm pretty much out of ideas myself, no matter what I do I get the same deformed helo as your getting.
     
  2. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
    well I went through some old threads. I compared the ascii txt file and looked at the bones and then compared them to the bones in a materialhacker copy of the real game gunship. I think "somewhere" the bones are getting rotated and transformed. That would be my next step. I'd take coordinates in the grannyviewer (go to model list right click for details then go the skeleton structure) then compare them to an exported one to find whats wrong. then change them in blender by going t armature->transform properties.

    not sure I can work on it more this week. Maybe you can check it out?
     
  3. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    OK I will have a look into it after work see what I can see anything.
     
  4. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Having a look at the exported FBX file it looks like the extra bones are being added by the pose.

    Pose: "Pose::BIND_POSES", "BindPose" {
    Type: "BindPose"
    Version: 100
    Properties60: {
    }
    NbPoseNodes: 38
    PoseNode: {
    Node: "Model::WORLD_center"
    Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
    }
    PoseNode: {
    Node: "Model::WORLD_center"
    Matrix: -1.000000000000000,0.000000000000000,0.000000087422777,0.000000000000000,0.000000087422777,-0.000000043711388,1.000000000000000,0.000000000000000,0.000000000000004,1.000000000000000,0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
    }
    PoseNode: {
    Node: "Model::MilkShape3D Object"
    Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,-0.000000043711388,1.000000000000000,0.000000000000000,0.000000000000000,-1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
    }
    PoseNode: {
    Node: "Model::Cabin door01"
    Matrix: 1.000000000000000,-0.000000079546602,0.000000026051277,0.000000000000000,-0.000000080342978,-0.819814205169678,0.572629690170288,0.000000000000000,-0.000000025136902,-0.572629630565643,-0.819814264774323,0.000000000000000,29.966440200805664,-21.186544418334961,19.161058425903320,1.000000000000000
    }
    PoseNode: {
    Node: "Model::Cabin door02"
    Matrix: 1.000000000000000,-0.000000080821508,-0.000000022329665,0.000000000000000,-0.000000079649460,-0.848980665206909,-0.528423905372620,0.000000000000000,0.000000022742583,0.528423905372620,-0.848980665206909,0.000000000000000,29.954044342041016,21.722658157348633,18.635986328125000,1.000000000000000
    }
    PoseNode: {
    Node: "Model::WORLD_center_0"
    Matrix: -0.000000043711388,1.000000000000000,0.000000000000000,0.000000000000000,-1.000000000000000,-0.000000043711388,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
    }
    PoseNode: {
    Node: "Model::Airplane tail"
    Matrix: -0.000000044659320,0.000000313913773,-1.000000000000000,0.000000000000000,-1.000000000000000,0.000000476839887,0.000000044659330,0.000000000000000,0.000000476839887,1.000000000000000,0.000000313913745,0.000000000000000,115.996002197265620,-0.000005137659173,-7.459563255310059,1.000000000000000
    }

    As you can see WORLD_center is there 3 times plus the old milkshape one.

    You can see this when you compare gr2 files.
     

    Attached Files:

  5. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
    not sure how that impacts things. danrell's template uses the fbx exporter too and has no problem. I'm still suspect its the rotation of the bones or something. because it looks like parts are rotated on themselves.
     
  6. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    That reminds me I compared the SMD to the milkshape3d txt file and the coordinates were different like you suspected. So I copied and pasted them into the text file and imported into blender and looked ok but still had the same problems when exporting to FBX (extra bones). But there were animations (propellers spinning) on the helo in game but it was half underground s I could not check for deformations.
     
  7. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
  8. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
    I'm thinking about deleting world center in the txt file and them import it
     
  9. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    I'm going to try and copy just the skeleton and paste it into a blank blender.
     
  10. snafusmith

    snafusmith Unit Maker

    Joined:
    Nov 1, 2005
    Messages:
    1,549
    Location:
    I've been everywhere, man
    I'm hoping you guys can get this to work. I animated a helicopter (my Mi8 model) in 3ds max, got it into Blender (w/ animations) and exported to fbx/gr2. Can't seem to get it to work though. Strange as I'm able to use the same procedure for other units, and it works fine. I'm going to keep at it but it's driving me nuts. Helicopters are may favorite units to make, but there's no way for me to get them into civ5. REALLY hoping you guys can crack the code!!
     
  11. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    We are still trying but I think like Ekmek said we need Darnell and Bernie to get involved.
     
  12. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
    In the meantime you can rig it toa jet fighter - just 2 bones- and find a way to add the prop animation. I think danrell did a prop fix for the fighter.
     
  13. bernie14

    bernie14 Filter Manipulator

    Joined:
    Feb 2, 2007
    Messages:
    3,112
    Gender:
    Male
    Location:
    coastal flood plain
    This is incredible work!!! Hat’s off :hatsoff: to ekmek, snafu and wolfdog!!!! RL has been VERY busy....this is literally the first time I have actually logged on in months (although I have occasionally peeked in)

    OK....did I mention how amazing you guys are??? :goodjob: :goodjob:

    Here’s the progress so far.....I was able to make an smd--> blend as per wolfdog.....i failed miserably at being able to make a successful fbx from that blend, BUT using ekmek’s gunship_wWC blend (and 56 blends -> fbxs -> gr2s later)...I THINK we may have something workable.....

    It is tested in [old] asset viewer but not in game (I think it will work, but my xml and sql skills SUCK)

    So, if someone can test it ingame....we can go from there!!!
     

    Attached Files:

  14. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Thank you bernie I will be more than happy to test it tonight when I get off work. So good to hear from you we were running out of things to try. I would like to no in more detail how you did. Our export to .fbx failed too until we renamed the skeleton to WORLD_center.
     
  15. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,657
    Location:
    France
    For a quick test I've linked your gr2 file to a (renamed) copy of the gunship fxsxml, set it to replace the English AT-Gun in R.E.D., and here is the result:

    Spoiler :


    Seems good ! :goodjob:
     
  16. snafusmith

    snafusmith Unit Maker

    Joined:
    Nov 1, 2005
    Messages:
    1,549
    Location:
    I've been everywhere, man
    Great work all! I ended up fixing my animation problem, so I can make my own animations now too. This whole process was a great learning experience! I'm very excited for all the new helicopters that need to be made (I've got the AH-64, Huey, Mi-8, and Eurocopter very close to done).

    Got the Mi-8 in game with the template! IT WORKS!!!!

     
  17. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
    Whoa great job bernie. you gotta tell me what you did to my blend so i can make an smd conversion tutorial.
     
  18. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    I think I worked out what bernie did from the description on the file. I added all the propeller vertex groups to First Propeller 01 and removed the assignments to the other propellers. I exported it to fbx and converted to gr2 and it looked the same as bernies in granny viewer and nexus viewer (have not been able to test in game yet).
     

    Attached Files:

  19. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,711
    Location:
    London, UK
    Exciting news! I've built on the work you guys started here and I've successfully developed a complete round trip process for exporting Civ 5 GR2 Mesh AND Skeleton into blender and back to Civ 5 gr2.

    So far the process has worked flawlessly for the Longswordsman and Helicopter Gunship gr2s. I tested the Lancer gr2 to see if mounted units can be exported/reimported and its nearly there but there are a few issues which I think I can iron out. I'm hopeful we'll now be able to generate Blender files for all Civ 5 units so that lots of lovely new units can be rigged to Civ 5 animations. :)

    I'll write another post imminently to outline the process and attached the amended Blender scripts I've developed to fix the bone twisting problem. After that I'll make an updated complete export and reimport tutorial,

    For now here are my Longswordsman and Helicopter blend files (Blender 2.49b), my amended Milkshape ASCII txt import script and FBX export script, and a screenshot of the blender exported Helicopter in game.

    Back soon. :)

    Spoiler :
     

    Attached Files:

    • heli.jpg
      heli.jpg
      File size:
      238.9 KB
      Views:
      313
  20. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,058
    Location:
    San Diego, California
    :woohoo: I seriously think my eyes teared up. This is awesome! I'll all for doing the work to build up our template library.

    One bummer is that the grnreader program that converts our gr2s to smd files works for units and it looks like it works for wonders and tiles but it won't do the skeletons for leaders. I think its because of old code but I have no idea how to improve the grnreader so it can convert leader files.
     

Share This Page