yanchxx / MoPA

An Blender addon uses ROMP to extract human's 3D poses from image, video or webcam and drive your own 3D character.
MIT License
242 stars 49 forks source link

Hi, Looks like change another mixamo character not work #24

Closed lucasjinreal closed 1 year ago

lucasjinreal commented 1 year ago

I have ROMP driven SMPL model looks OK, but when using CDBA (I using script locally) driven mixamo model, result looks wrong:

image

I am using this bone mapper in your repo:

bones_mixamo_smpl_mapper = {
    "Hips": "Pelvis",
    "LeftUpLeg": "L_Hip",
    "RightUpLeg": "R_Hip",
    "Spine2": "Spine3",
    "Spine1": "Spine2",
    "Spine": "Spine1",
    "LeftLeg": "L_Knee",
    "RightLeg": "R_Knee",
    "LeftFoot": "L_Ankle",
    "RightFoot": "R_Ankle",
    "LeftToeBase": "L_Foot",
    "RightToeBase": "R_Foot",
    "Neck": "Neck",
    "LeftShoulder": "L_Collar",
    "RightShoulder": "R_Collar",
    "Head": "Head",
    "LeftArm": "L_Shoulder",
    "RightArm": "R_Shoulder",
    "LeftForeArm": "L_Elbow",
    "RightForeArm": "R_Elbow",
    "LeftHand": "L_Wrist",
    "RightHand": "R_Wrist",
    "LeftHandIndex1": "L_Hand",
    "LeftHandMiddle1": "L_Hand",
    "RightHandMiddle1": "R_Hand",
    "RightHandIndex1": "R_Hand",
}
bones_smpl_mixamo_mapper = {v: k for k, v in bones_mixamo_smpl_mapper.items()}
bone_name_from_index_character = {
    k: bones_smpl_mixamo_mapper[v] for k, v in bone_name_from_index.items()
}

Do u know why?

also the hand look not right.

image

yanchxx commented 1 year ago

Because the bones' initial orientation is not compatiable with the SMPL.

I have created a dev branch to fix the bones' rest pose. You can read the code in fixBones.py.

I will finish it this week.

lucasjinreal commented 1 year ago

@yanch2116 thanks. But how did u get your demo works? Your demo character also mixamo.

yanchxx commented 1 year ago

@jinfagang I found that the mixamo armature's topology is similar with SMPL, so I just transfer SMPL poses to it. It looks ok but not accurate.

lucasjinreal commented 1 year ago

@yanch2116 Have u tried other character? My above result its not accurate but totally wrong , some people said it was bacuese of init pose not right in this fbx model, what do u think?

yanchxx commented 1 year ago

The bones' initial orientation is not compatiable, so need to modify first.

https://user-images.githubusercontent.com/38496769/185066005-59bc1c27-1c13-48c4-8333-55a3dfe77332.mp4

I have tried a lot character using mixamo auto-rigger and my new script. You can see the 钟离 in the video.

lucasjinreal commented 1 year ago

@yanch2116 So most of mixamo model download direclty from mixamo website need proces first?

What does not compatible mainly means here? what initial orient do we need to compatible with smpl model? How should I download your zhongli model so that I can try on my side?

yanchxx commented 1 year ago

The bones' initial orientation in SMPL is the same with global coordinate.But when you import mixamo character into Blender, the Blender will set bone's Y-axis along with the bone,so the initial coordinate is not same with global coordinate.

英文不好。大概意思就是你mixamo的fbx导入blender,骨头初始的坐标系的y轴会自动设置为沿着骨头的方向,但是SMPL的骨头初始的坐标系y轴和全局坐标系保持一致,就是这个差别。

yanchxx commented 1 year ago

zhongli.fbx.zip

试试看能不能驱动,这周我会把东西都更新一下。

lucasjinreal commented 1 year ago

@yanch2116 但是我下载了YBot模型,似乎又是可以驱动的,不需要做任何额外处理。你说的fixbones 再上面那个脚本里面还有哪些工作没有完成吗

yanchxx commented 1 year ago

对,mixamo上有些是和SMPL一样的,我一开始的mixamo的女侠形象就是可以直接驱动的,在blender中看骨头朝向就知道了,如果骨头垂直于手臂,就是可以驱动,如果骨头沿着手臂,就不可以。如果用auto-rigger就全都是沿着手臂的骨架,就需要先处理一下。

fixBones脚本已经完成了,不过整个脚本还有一些东西要更新。

yanchxx commented 1 year ago

@jinfagang You can now try the Fix Bones in the addon to correct the bone orientation for some Mixamo characters.

lvZic commented 1 year ago

The bones' initial orientation in SMPL is the same with global coordinate.But when you import mixamo character into Blender, the Blender will set bone's Y-axis along with the bone,so the initial coordinate is not same with global coordinate.

英文不好。大概意思就是你mixamo的fbx导入blender,骨头初始的坐标系的y轴会自动设置为沿着骨头的方向,但是SMPL的骨头初始的坐标系y轴和全局坐标系保持一致,就是这个差别。

你好 请问下如果我不想用这种保存fbx的方式 想在代码里完成SMPL 到 mixamo的骨骼转换操作 要怎么做呢

yanchxx commented 1 year ago

The bones' initial orientation in SMPL is the same with global coordinate.But when you import mixamo character into Blender, the Blender will set bone's Y-axis along with the bone,so the initial coordinate is not same with global coordinate. 英文不好。大概意思就是你mixamo的fbx导入blender,骨头初始的坐标系的y轴会自动设置为沿着骨头的方向,但是SMPL的骨头初始的坐标系y轴和全局坐标系保持一致,就是这个差别。

你好 请问下如果我不想用这种保存fbx的方式 想在代码里完成SMPL 到 mixamo的骨骼转换操作 要怎么做呢

fixbone里面的代码就是转换的

lvZic commented 1 year ago

The bones' initial orientation in SMPL is the same with global coordinate.But when you import mixamo character into Blender, the Blender will set bone's Y-axis along with the bone,so the initial coordinate is not same with global coordinate. 英文不好。大概意思就是你mixamo的fbx导入blender,骨头初始的坐标系的y轴会自动设置为沿着骨头的方向,但是SMPL的骨头初始的坐标系y轴和全局坐标系保持一致,就是这个差别。

你好 请问下如果我不想用这种保存fbx的方式 想在代码里完成SMPL 到 mixamo的骨骼转换操作 要怎么做呢

fixbone里面的代码就是转换的

我理解你的意思是在代码里转换mixamo的骨骼轴向从沿着手臂到竖直向上 我的问题是 我在场景下用的人物模型 只能是沿着手臂的轴向 人物骨骼不可以改变 所以我需要调整每一段骨骼的轴角值来匹配沿着手臂的轴向的骨骼