Mesh completely distorted when assigning animation

Hey,
I’m a little desperate by now as I’m trying to figure this out for a couple of hours but I can’t get it to work…
What I did: I have a mesh in Blender and exported the UE4-Mannequin in order to import it in blender to use his skeleton. So I removed everything else, scaled/moved the bones according to my mesh, parented it and weight-painted it. If I export it as FBX and import it into the engine it looks fine so far. If I don’t import it using the already present UE4-Skeleton, let the engine generate a new one and retarget the UE4-Animation to my mesh, everything work’s fine and the retargeted animation works perfectly. However, if I specify to use the UE4-Skeleton on importing the skeletal mesh, drag it into the world and assign an animation it gets completely distorted and I can’t figure out why. Of course I could manually retarget all animation but this would be much more complicated (now and down the road). Especially because it should just work fine since I’m using the UE4-Skeleton… Also if I compare the generated skeleton with the UE4-Skeleton they are completely the same… Maybe I got somewhere something wrong, I hope you can help me.
Thanks in advance

On the left is how it looks like without animation assigned and on the right is the distorted mesh with an animation assigned. Some Vertices are wrong because their weight doesn’t fit as this was a test mesh but this also happens with the correctly painted mesh.

As you can see the bones’ rotation and translation are completely off in the animations and I have no idea why

The generated skeleton (on the left) and the UE4-Skeleton (on the right) are exactly the same

I probably just resolved it myself - On importing the standard UE4-SkeletalMesh into Blender I checked “Automatic Bone Orientation” since all the bones are orientated and translated pretty strangely when not checking that. However, if I don’t check it, adjust the bones and auto-weight them for a quick test everything seems to work fine upon importing it into the engine. I’ll try that out later with a “real setup” as it is now 5:30am here but I’m pretty sure (according to what I just tested) that that was the problem. I’ll edit this post as soon as I have tried it out.

That was not the root of the problem. It seems that as soon as I edit a bone in blender (rotation or translation) this will ultimately also be applied to the animation and therefore distort it. I just created a whole new skeleton from scratch that matches the UE4-Skeleton regarding the bone hierarchy but even with that the animations are completely distorted… However, if I import the standard UE4 Character and just take his armature, don’t edit it and apply that to my mesh (also it doesn’t fit) the animations play fine upon importing it in the editor (the weight’s of course don’t fit, but the bones aren’t off…).
Maybe I’m doing something fundamentaly wrong but I have now idea what that might be

Exporting from Blender into UE4 works well (static mesh, skeleton mesh with or without shape-keys/morph-targets). Exporting from UE4 into Blender does not work that well. It’s ok for a static mesh but everything with bones usually looks wrong. If you really need this direction (usually you don’t) then I would recommend Maya (LT) instead. Or probably just hide all those bones in Blender and replace the weird looking joint-shape with a custom shape. Don’t touch the rotations in Blender in Edit mode if you exported it from UE4. If you would create content in Blender for UE4 it’s easier to use a similar mesh (like from Makehuman or Manuel Bastioni Lab) and retargetting in UE4 (which works well) or the UE4 Blender addon from Lui - [ADDON BLENDER] UE Tools - Community Content, Tools and Tutorials - Unreal Engine Forums

That said - your first screenshot looks a bit …confusing to me. T-pose? If you would retarget to the UE4 mannequin animations your rest-pose in Blender should be (the UE4-mannequin) A-pose. The second disorted mesh looks like it got too less weight at some vertices (which usually could be fixed with normalizing the weights). Make sure there is no error and even no warning if you import your mesh from Blender into UE4. If you retarget something even take care that your bones are following the skelekton (except root, pelvis and the “IK”-bones that may stay animation). Like this: New project released by MakeHuman team leader - General Discussion - Unreal Engine Forums - Probably even take a look at the export settings: New project released by MakeHuman team leader - General Discussion - Unreal Engine Forums

First, thanks for your response!

Not touching the rotation of the imported bones in blender was also what I supposed (or do you mean, never touching the rotation of any bone in edit mode?), therefore I created a whole new armature from scratch that matches exactly the UE4-Skeleton and assigned it to my mesh in blender, however I had exacatly the same problem when importing it into the editor. It seems that as soon as I touch the rotation of any bone in blender it will somehow also get exported and applied to the animation or something like that. But I need to touch the rotation of the bones in order to match my mesh (don’t I?).

Yes, that is one of my test meshes, I have another version in A-Pose which works perfectly when I use retargeting, however I don’t want to use retargeting (to a different skeleton), as I had to retarget every animation for every mesh I create and also create a new Animation Blueprint for each one. That is the reason why I want to use exactly the UE4-Skeleton, because I can then simply import another mesh and all animations work out of the box. You are right with the second screenshot, that’s what I wrote below it ( ^^ ) but that is not the problem. When importing there is only the “standard” warning a la “No smoothing group information found”. I already set up the retargeting as in your screenshot but that doesn’t change anything - although if I set everything to “Animation relative” the bones orientation is fine but the animation itself plays with wrong rotations…

If you change something then it’s not really the UE4 mannequin armature/pose anymore.

I don’t see a real issue here. If all your meshes really got the exact same skeleton (I mean really the same - not scaled, rotated or whatever to fit another mesh shape) then just import your first mesh with the similar but different skeleton, create a anim-BP (and retarget those anims) once and if you import all your other meshes just choose the previous imported skeleton, instead of importing a further skeleton at each mesh (and your anim-BP works well). If your further meshes just get some similar skeleton then you have to retarget anyway. But you don’t have to retarget every animation manually. You could even just retarget a hole anim-BP and all anims below it - including blendspaces, … would be retargetted as well (and event-graph, … would be copied too).

But to my understanding it should still work with the same skeleton asset inside unreal?

That’s what I thought would work with the standard skeleton. All meshes certainly won’'t have the exact same skeleton but the same hierarchy and should therefore work with the standard one.
It’s not really an issue but as a programmer this seems way to redundant to me, my way of thinking here is “They have the same hierarchy, according to the docs it should just work that they can share animations out of the box without further work”.
Wow, I knew I could retarget multiple animations at once but not that I could recursively retarget whole anim blueprints… This doesn’t solve the base problem but it makes the alternative you are suggesting way more attractive, so I think I will just go with that. The “overhead” is probably smaller than if I will spend three more days trying to solve the problem without finding a solution.
So, thank you very much for your help! You probably saved me even more wasted hours…

Nope. The same hierarchy is too less. As you could see here (it’s not that much deformed like in your screenshots…so I guess those 3 guys was created without export/import/export) but still would not work with any of those characters in a usable way (without retargetting): Animation Retargeting in Unreal Engine | Unreal Engine 5.3 Documentation?

I think we are not always referring to the same when talking about retargeting, I mostly meant “retargeting with different skeleton” - It’s clear that it won’t work out of the box when the porportions are different but it should work when you set up the Translation Retargeting correctly. At least that is also what Epic is doing in your link: Same hierarchy but different proportions and when they set up the translation retargeting it just works and as I am in the same situation (same hierarchy but different skeletons) I thought it should also work for me to simply adjust the translation retargeting but it didn’t (and doesn’t) and that is what confused me.

It’s not just the same bone names and skeleton hierarchy that matters. Otherwise it should work already. The FBX importer of Blender is very weak. So I’m pretty sure there are some different rotations somewhere. Probably you would have more luck if you try with Maya. If you retarget via the “different skeleton” method (even if you have the same bone names and hierarchy) it does not matter that much if your head rotates if you use the “x” axis in Blender or the “y” axis as long as the pose looks similar enough to the A-pose of the UE4 mannequin. So you could workaround issues that way while it’s still pretty fast to port to other meshes (especially if you created them all in Blender yourself afterwards and share the skeleton).

Interestingly your last sentence is exactly what I just tested and wanted to “report” here - If I import only the mesh of the UE4 standard mannequin in blender, apply “my” armature to him and get both into the engine, using the same skeleton asset I created for my original character it works just fine to also use the same animation for him as I used for my much smaller and wider character. So it will probably work to once retarget all animations to “my” skeleton and then reuse those assets and a single Anim blueprint for all characters I create (who are similar enough so I can reuse the skeleton) which is exactly what I wanted in the beginning (except for the first retargetting step but the engine is so simple here that it doesn’t hurt in any way).
Once again, thank you very much, especially for the further info which helped me understand the problem a lot better.

So, I have this exact problem that I’m trying to solve right now.
@Neutronux, you’re not exactly accurate. Yes, bone names and hierarchy IS WHAT MATTERS for Unreal skeleton. The thing with the doc you showed only tells that if the skeleton is set to the retarget options “Skeleton” for all bones but “Animation” for root, pelvis and IK bones IT WILL just work automatically, even with different mesh proportions, and that’s because this process of setting the bones is already retargeting, as you can see in this video: Skeleton Assets: Importing, Sharing Skeletons & Anims | 02 | v4.8 Tutorial Series | Unreal Engine - YouTube.

And I also don’t know what the problem is because the skeleton has the correct options.
@Taces I’ll let you know if I find the solution for this. It sucks, should be a simple process if we took the time to make the skeleton the same as Unreal’s, right?

Ok if it’s the only thing that matters then create an armature with the same hierarchy, name the bones like the UE4 skeleton and try. Does it work?

It should! In the video it shows exactly that. If one skeleton is set to accomodate other meshes (being set up as “Skeleton” and “Animation” as we discussed) it does work. The problem is something else.

What do you mean by “works”? It won’t crash the engine or anything but if rotations are different between the rigs then the animation will look bad because rotations are not really retargeted. The video you linked showed rigs with very similar rotations. However if you’ve got something different it won’t look as good. You can try to match the poses by changing the base pose but if you don’t match them completely you’ll end up with different looking animations.

An easy example is a character with a T-pose and another one with an A-pose. Even if they have the exact same bone names and hierarchy if you try to retarget animations from one to the other without changing the base pose you’ll end up with something that looks… not great. I think this is what Neutronux was talking about.

Basically every character is supposed to be imported in T-Pose or A-Pose (humanoids especially). Either of them will likely result in usable animations. And you can very easily change the Bind Pose inside Persona. So… it works. Or it was supposed to work, but I don’t know what’s the case with me and Taces.

I don’t know either and I already spent way too much time searching for a solution without finding the “root cause” that it looks THAT bad. But as I wrote: When I once created my “own” skeleton that matches the UE4 one and retarget (to different skeleton) all animations to that one I can reuse that skeleton for all my characters (at least the two I tried and they were quite different in proportions), even with different proportions as shown in the docs. So there really only is that one step of retargeting all animations once and you are set. No idea why retargeting to same skeleton doesn’t work with Epics (probably the rotations as you guys mentioned) but it does with my own and that’s fine as the initial retargeting doesn’t take more than a few seconds.

Following example: Create a copy of an existing skeleton mesh (including the armature). Select the armature. Enter edit mode with TAB. Select all bones with A+A. Hit CTRL-R to change the bone roll. Enter 90 to rotate it 90° and hit Enter. You would see a quick bone roll around their own axis but the bones itself would look identical afterwards (even the names are the same of course). If you did not setup some IK poles in Blender and you ask somebody else afterwards if he could see some difference (either bonenames, bonesize, boneshape, pose, size, color, everything) he would not see any difference as long as you don’t enable the view to show him the bone axes.

If you export both meshes now (that look identical are named identical are posed identical, …) and import the first with the skeleton and the second one without the skeleton (but using the already imported one as shared from the first mesh) then … your animations would look terrible messed up. Even if you set all those bones to skeleton in retargetting manager. Even if you started with the same skeleton. Bone names and hierarchy did not change in that example. Even the mesh and the pose was the same. The only thing that get changed: Your first mesh would look left and right if you rotate the head gimbal x and the second one would look straight upwards and downwards using the same gimbal x axis (even if those bones look identical at a first look). Rotations always come from the animation. So if you would skip the step with the “retargetting for a different skeleton” then it seems UE4 is not able to guess how to translate it right. If you use both meshes again but don’t share the skeleton but import both ones and do the “retarget for a different skeleton” instead then the animations would look (almost) identical.

Still no solution to this?

My mesh is also completely distorted. On the left we can see the UE4 skeleton recognizes the mesh skeleton, that’s why some of the bones are white and some are grey (which means the current mesh is not using the bones). It is playing the animation, so in a sense the retargeting is successful, it seems it’s just not recognizing the placement for the bones. I’ve already tried messing up with the Retarget Options (AnimScaled, Skeleton etc) with no success.

Any more ideas? @Taces did you manage to solve this?