jsantell / THREE.IK

inverse kinematics for three.js
https://jsantell.github.io/THREE.IK
MIT License
455 stars 54 forks source link

SkinnedMesh gltf character distorted mesh #10

Closed arpu closed 5 years ago

arpu commented 5 years ago

trying to get a gltf avatar model with this greate THREE.IK

the bones looks like correct for me only the mesh is bind wrong

THREE.IK master and aframe 0.9 with THREE 101

https://efficient-tote.glitch.me/

jsantell commented 5 years ago

@arpu thanks for reporting! Possibly related to #9 and handling the correct orientations of the bones -- do you know what software generated this model, or it's expected joint orientation?

arpu commented 5 years ago

i have created this model with mixamo and blender like described in this blog post https://www.donmccurdy.com/2017/11/06/creating-animated-gltf-characters-with-mixamo-and-blender/

arpu commented 5 years ago

ok i have done some more testing with new blender 2.80 beta ( importing the fbx from mixamo and export it with gltf exporter) result looks similar https://truthful-web.glitch.me

arpu commented 5 years ago

on the fbx importing i use this fbx settings like described in the blog post

https://www.donmccurdy.com/assets/images/2017/11/manual_orientation.png https://www.donmccurdy.com/assets/images/2017/11/bone_orientation.png

jsantell commented 5 years ago

THREE.IK expects +Z to be facing the children joint; this is a potential solution to not requiring a specific orientation of skeleton, as all tools handle it differently

arpu commented 5 years ago

i have to less knowledge on this, for what is the best solution for this

sneha-belkhale commented 5 years ago

@arpu

After doing the axis conversion to +Z Forward on your mesh, the bind matrices are fixed :)

https://dashing-floor.glitch.me/

There is now a utility in the AxisUtils.js file called setZForward. Using this function on the root bone will reset the bone quaternions / positions to follow a +Z Forward coordinate system. @jsantell I'd like your feedback on where you think this utility should go :)

This is the code I added to your project. I had to rebind two meshes because both of them are using the same skeleton.

setZForward(rootBone);
rigMesh.bind(rigMesh.skeleton)
rigMesh2.bind(rigMesh2.skeleton)
arpu commented 5 years ago

@sneha-belkhale this is awesome! thank you so much!

would be cool if you want to join my little discord server, for my freetime side project https://discord.gg/cNfG834

jsantell commented 5 years ago

Thanks to @sneha-belkhale, I think with https://github.com/jsantell/THREE.IK/pull/9, this should be solved, how does it look @arpu?

arpu commented 5 years ago

yeahh this works now fine