Manipulating the skeleton - eArmada8/ed8pkg2gltf GitHub Wiki
Manipulating the skeleton
Here is a basic tutorial on how to get the skeleton into and out of Blender for folks who want to preview how meshes change with animation, and for those need to modify the skeleton (adding, moving, deleting bones) or weight paint. This tutorial assumes you have properly setup the toolset. I also briefly discuss locators (used for weapons, hats, and other models that attach to the character model) at the bottom.
Skeletal rigging and weight painting
For weight painting, you will want to rig your meshes to the skeleton. We will not be using the actual meshes in the glTF file because they cannot be exported.
-
Obtain and decompile your model. I will be decompiling Juna's Thors Uniform (C_CHR011.pkg).
-
Open the glTF file (chr011.gltf). (File menu -> Import -> glTF (.glb + .gltf)) You can hide or delete the glTF meshes, they cannot be exported. I generally just delete them. I also hide the joints, so you can clearly see the bones and mesh.
-
Load your meshes into Blender. (File menu -> Import -> 3DMigoto raw buffers (.vb + .ib)) The meshes are in {Work Folder}/meshes/. These are the meshes you can make changes to.
-
Select all your meshes (in the list on the upper right, click the top one, then shift-click the bottom one). Then SHIFT-click on one of the bones (in the scene, NOT on the list). You should see the meshes outlined in red, and the skeleton outlined in orange. Press Ctrl-P to parent, and select "Armature Deform." Do NOT pick any of the "With..." options.
The model is rigged! You can now do what you need to do.
Modifying a skeleton in Blender
WARNING: Please note that modifying the skeletons necessitates making new animations for the model. 99% of modders should completely ignore this tutorial - for the 1% who need this: you know who you are.
- Obtain your model. Place your .pkg file in a folder with ed8pkg2gltf.py (and lib_fmtibvb.py). Run ed8pkg2gltf.py and it will decompile the model into a folder with the same name as the .pkg (C_CHR005_C00 in my case) with meshes, textures and metadata. It will also create a .glb file in that folder (chr005_c00.glb in my case).
- Import the .glb file into Blender. Set Bone Dir to "Blender (best for re-importing)", or Blender will modify the skeleton. (Ignore that I am importing Juna's animations in the screenshot, I am reusing a screenshot from a different tutorial because I am lazy.)
- The skeleton is now in Blender, ready to modify.
-
When you are done editing the skeleton, export as .glb/.gltf. Use default settings - although if you plan to use the meshes as well then make sure Mesh -> Tangents is checked. Also, if your original model was not +Y Up, then be sure Transform -> +Y Up is checked (this only applies to using models not originally from the game). For the screenshots below I will name the new file "untitledout.gltf" (a previous version of this tutorial used Noesis but this software is no longer needed).
-
Prep the directory for compile (add build_collada.py, extract_from_gltf.py, lib_fmtibvb.py, replace_shader_references.py and write_pkg.py in the folder with metadata.json, in my case D:\Emma\C_CHR005_C00 as you can see above). Add the compiler files from WorkFolder.zip.
-
Run extract_from_gltf.py. It will create a folder for each .gltf. Ignore the folder that was created for the original gltf, we want the folder with the modified skeleton. (In my case, the original glTF was chr005_c00.gltf so there is a chr005_c00 folder which I deleted, and the folder I want is the untitledout folder.)
- Inside the untitledout folder there is a metadata.json. You only want the hierarchy section. Copy that section. (In the screenshot I have collapsed the sections so you can see above and below)
- Paste that section into the true metadata.json (in my case D:\Emma\C_CHR005_C00\metadata.json), replacing the original hierarchy. Run build_collada.py, followed by RunMe.bat, as usual. If all went well, you should have a working model!
If you want to use the meshes from your .glb, delete the original meshes folder and replace with the meshes folder created by extract_from_gltf.py.
Note about weight-painting vs modifying the skeleton
If you only need to weight-paint and you do not need to export the skeleton, you can import into Blender with Bone Dir set to "Temperance (Average). This will allow Blender to properly orient the bone orientations. This will permanently destroy the skeleton internally however, as you can see:
Note that you do not need to use "Temperance (Average)" for weight-painting; this setting is mainly for comfort. If you need to weight paint AND modify the skeleton, use "Blender (best for re-importing)" instead.
About Locators
Models can be "attached" to other models (e.g. weapons, hats and ride-alongs). These are attached to character models at skeletal nodes known as locators.
For example Ash's badge is not part of his model (C_CHR012.pkg). It is a separate .pkg entirely.
It attaches to his model at a node called "Badge Point" - this is known as a locator.
You can see the connector here in chr012.inf:
Specific nodes are defined as locators for the models in the metadata.json:
And, you can see, when I delete the locator (by deleting the highlighted line from the metadata), the badge is gone.
To be clear, I have not deleted the node. I simply told the compiler not to use it as a locator.