Hi guys. I’ve been searching the forums and internet in general for a solution to my problem, but keep coming up short. Here’s the problem:
I’m attempting to have Mecanim retarget animation information from my Source Avatar to my new one. Everything “seems” to be playing fine for the most part…All of the joints that I assigned manually are working correctly. I even have extra joints, such as a ponytail, that appears to be working correctly even though those joints weren’t manually configured in the avatars. The bones in the face, however, are causing strange mesh deformations.
Now, I’ve made sure to check the “Keep Additional Bones” box in both the Source Avatar the New Avatar, as well as the Animation file that is defined by the Source Avatar. I’ve made sure that the characters faces are skinned in Maya so that when I manipulate the bones (the side of the mouth, for example) of each character, they deform almost identically with the same amount of bone movement. In Unity, however, when the animation gets retargeted to the New Avatar, those same bones appear to be in different positions than expected, tearing the mesh. Now, I’ve also tried retargeting to a different Avatar with facial proportions that are a closer match to my Source Avatar and the results were better…almost correct.
This got me thinking that maybe the Translation Rotation information of those extra joints were being copied exactly from my Source Avatar to those corresponding extra joints in my New Avatar…And since those facial bones are not placed in the exact same position in both rigs from their parent Head joint, they were being repositioned in the retargeted Avatar to match the position relative to the Source Avatar’s Head joint. I tested this in Maya by copying animation for those specific joints and pasted them to the joints of the character being used as the receiving Avatar, and the Mesh deformed the same way, tearing the Mesh.
Is that what is happening? If the extra joints I have in the face of the Avatar receiving the information aren’t in the exact same position (relative to their parent Head joint) as the Avatar being used as the Source…will the receiving joints be forced into position based on the Source Avatar’s joint position relative to it’s parent? If so, is there a work around or something other than creating a rig with the bones in the exact same position for each head?
Thanks
1 Like
Ok, my bug was answered:
"Hi Kevin,
In Mecanim you have the human retargeter which uses the “muscle” space. This is the one that can retarget animations from one skeletong to another of different size and shape.
When you create a human animation clip all extra bones animation curves are also saved, so you can have your body animation play with the Mecanim muscle engine and also some other body part(s) like tails, wings or in your case facial bones still be animated with normal curves.
If you have another character that uses exactly the same naming convention for its transform, you could map extra bone animation from one character to another one, because extra animation curves are binded by name, like in the legacy animation system.
So in short, for extra bones Mecanim does nothing special. If the animation channel path in the clip match a transform path then the animation should be played on this transform. If both the skeleton used to generate the clip and the skeleton on which the animation is played match perfectly ( same skeleton hierarchy, and same bone length), then the animation is kind-of retargeted. It is because its basically playing in the same place.
But if the only the skeleton hierarchy match then you may end with weird results like mesh deformations. In this case the result is unexpected, it may work or may not work.
There isn’t really a workaround for your case other than having skeletons that match the hierarchy and bone length.
Regards,
Ricardo"
Thank you, Ricardo for the response! This is exactly as I suspected. Since Our bone length in the characters didn’t match, the mesh was being deformed due to the bones being forced into position rather than matching naturally.
We were able to “fix” the problem by adding Empty Game Objects to our prefab hierarchy and using those to offset the position of the bones, putting them back to a closer position (eyeballing it). For example, create an Empty Game Object and drop it in the hierarchy and zero it out…then drop the bone that needs offset onto it so it becomes a child of the Empty Game Object. Then move the Game Object to adjust its position. Your prefab character will look deformed, but when its playing animation from mecanim it will look correct.
This isn’t a very good solution, obviously, as any bones that need offset now require a Game Object above them, essentially acting as another bone…decreasing performance.
Anyway, I just thought this might be helpful to other Mecanim users. Again, thank you for the help. 