wikid24 / ffxiv_mmd_tools_helper

A powerful blender addon to convert FFXIV Models to MMD models in a few simple clicks
Other
31 stars 1 forks source link

Request: Support thigh twist bones #13

Open mienaiKnife opened 2 weeks ago

mienaiKnife commented 2 weeks ago

Hi, I'm interested in using an addon to convert armatures to make them compatible with MMD motions, although I am not interested in FFXIV models specifically. I was trying to use this addon to convert a model ripped from Baldur's Gate 3, but the MMD conversion step 11 doesn't work on my model, and I'm guessing that the reason why is because I wanted to keep the model's thigh twist bones, which I named 左足捩 and 右足捩. I think that it should theoretically be easier to get thigh twist bones working with an MMD motion in Blender than in MMD, so would you consider adding such a functionality to your addon? Here is the exact error code that I got while trying to run step 11 on my model:

Python: Traceback (most recent call last): File "C:\Users[User]\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\ffxiv_mmd_tools_helper\bone_conversion.py", line 1100, in execute main(context) File "C:\Users[User]\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\ffxiv_mmd_tools_helper\bone_conversion.py", line 996, in main add_foot_leg_ik.clear_IK(context) File "C:\Users[User]\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\ffxiv_mmd_tools_helper\add_foot_leg_ik.py", line 46, in clear_IK bpy.context.view_layer.objects.active = get_armature() File "C:\Users[User]\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\ffxiv_mmd_tools_helper\add_foot_leg_ik.py", line 382, in get_armature if bpy.context.selected_objects[0].type == 'ARMATURE': IndexError: list index out of range

wikid24 commented 1 week ago

Hi @mienaiKnife , I created a google sheet for translating bone names between different model structures

Feel free to add the BG3 bones to column E, and I will add this in the next update: https://docs.google.com/spreadsheets/d/1voXtYp4DAQrmPL1uCVINrL0_jbnZCOIqf-oaumsd3UE/edit?usp=sharing

Cheers!

mienaiKnife commented 1 week ago

Unfortunately, the BG3 models have bones in the arms and legs that are holding weight in weird places, which would make it hard to make them fully compatible with your addon. It's hard to explain, but I could try to send you a .blend file with a ripped model to illustrate my point. I did previously write a script to rename bones according to what weight they hold, but then I had to move them around manually to make sure they were where they're supposed to be in an MMD armature.

wikid24 commented 1 week ago

sure, feel free attach it to the ticket and I'll check it out :thumbsup:

mienaiKnife commented 1 week ago

Alright, here's Astarion with minimal editing: Astarion default redux.zip Obviously there's quite a bit of editing that I would have to do by hand before I could use your addon to convert it to MMD.

wikid24 commented 1 week ago

looked at the file, yeah I think the leg's weight painting is on armature.004? Hard to tell since there is 7 armatures in the file.

Looking at the armature, a few things to keep in mind:

While in edit mode: image

parent/child relationship on the connected bones should be something like:

for the twist bone, it just needs to be a child of the correct bone it is twisting. Standard MMD animation files don't animate leg twist bones so it doesn't need to be included in the chain mentioned above. Best example I can give is using the FFXIV sample models (included in the plugin, renamed to MMD English), you can see an example of it on the arm twist bone: image

After all the bones are connected you should have a functioning armature you can see moving in pose mode... Then it would be a simple matter of renaming all the lower the leg bones to something MMD can recognize (such as the bone names on the google sheet I mentioned), and then the plugin should do its thing properly to create the IK leg stuff.

After you clean it up into one armature, if you're still having issues let me know

mienaiKnife commented 1 week ago

I want to make it so that, when the MMD motion data tells the 足 bones and maybe even the 足D bones to rotate along the Z axis, the thigh twist bone is the one that rotates instead of just rotating one bone that holds the weight of the entire leg. One thigh deformation bone will handle X and Y rotations, and its child the thigh twist bone will handle the Z rotation.

wikid24 commented 1 week ago

Ah then you should check out the D bones in MMD armatures. They don't have any weight paint associated with them, they're special bones with a bone constraint that MMD Tools creates when you add these settings to it,

Example of the leg_L_D bone which is an empty bone with no weight painting on it should do what you're looking for (also this plugin creates it when running the leg IK step) : image

mienaiKnife commented 1 week ago

Normally, when I take an MMD model that has 足D bones (i.e. the leg_L_D bone when translated) and I import it into Blender, I can see that the 足D bone is the one holding the weight of the thigh and it's copying the rotation of the respective 足 bone in the IK chain. I was assuming that the purpose of it was to provide a sort of parallel FK chain for MMD animators, and that D stands for deform. Seems like you're conflating D bones with bones that have the Rotation+ append (appends are basically the equivalent of bone constraints in the pmx file format).

Anyway, I'm not sure if anyone ever really figured out how to implement the kind of automatic thigh twist bones that I want with the pmx file format, and I was wondering if Blender's more sophisticated rigging toolset could make it happen instead. I wouldn't expect that the kind of armature that I'm trying to make could be exported to pmx.

wikid24 commented 1 week ago

do you have an example mmd model that you're using as a baseline?

mienaiKnife commented 1 week ago

Here's one: https://bowlroll.net/file/4576

wikid24 commented 1 week ago

looks like a standard TDA MMD model, the D bone is setup with the same rotation constraint applied to mirror the leg bone, so if weight paint is on either one it will work fine. D bones are really used for those additional animation tweaks after IK is applied

I'm sure you can definitely can do extra stuff within blender that you mentioned, but this plugin was designed around mimicking the TDA MMD armature structure since that is what is used by the VMD motion files. any additional IK/FK you're looking to do outside of those will probably mess with whatever the animator keyframed in the VMD files, so something to keep in mind

mienaiKnife commented 1 week ago

My goal is to make the deformation look good and accurate to how the model appears in the game without messing with whatever the animator keyframed in the VMD files.