pixiv / three-vrm

Use VRM on Three.js
MIT License
1.31k stars 110 forks source link

Retargeted animation causing scaling issues on other Vroid VRMs #1387

Closed YulesRules closed 7 months ago

YulesRules commented 8 months ago

I'm dealing with VRM files and FBX animations for my characters here. The animation being used has been retargeted from mixamo to work with the first character you see loaded - however, I'm doing the retargeting in Blender (using the Rokoko plugin) rather than via the function provided in the package.

As, you can see, once I load the second character and apply the same animation, despite it animating well enough, there are now scaling and rotation issues to contend with. The second also seems to be resistant to changes in script to modify its scale and rotation.

The characters themselves have been imported into Blender as VRMs and exported again as VRMs, without making any additional changes to them (a step I've needed to take for animations to work at all).

I'd rather be able to re-use animations than retarget each one individually for every character variation on screen.

Any ideas? : ]

https://github.com/pixiv/three-vrm/assets/110333307/fdcdfb46-588e-4319-815d-c43c4fa59686

0b5vr commented 7 months ago

Would you provide a minimal reproducible example?

YulesRules commented 7 months ago

Having problems with rotation (unless I manipulate the parent object) but managed to address the scaling and positional issue via:

vrm.scene.traverse((child) => {

if (child.isObject3D) { if (child.name == "Root") { child.scale.set(1.8, 1.8, 1.8); //works child.position.set(0,0,1); //works child.rotation.set(Math.PI / 2, 0, Math.PI / 2); //doesn't work } } });

UPDATE: Fixed by childing to a new object then rotating the parent. - (still doing my scaling via VRM directly as I've read about issues with outline thickness when attempting through other means):

const root = vrm.scene.getObjectByName("Root"); root.scale.set(1.8, 1.8, 1.8);

let turnTable = new THREE.Object3D(); turnTable.add(vrm.scene); parent.add(turnTable); turnTable.rotation.set(0, 0, Math.PI/2); turnTable.position.set(0, 0, -0.15);

I have a lot of loading/unloading of objects and my logic for manipulating avatar meshes needed to be roughly the same between fbx models and vrm ones.