Exported animation is deformed, how to fix it?

Started by
5 comments, last by Heelp 7 years, 7 months ago

Guys, I exported an animation from blender to .dae and when I try to load it with assimp in my game, a small area around the hand seems distorted. I used assimp viewer and a bunch of other viewers to make sure that the problem is not in my code. It's always the same messed up animation. It works perfectly fine in blender, but when I export it, it's messed up. This is the most persistent problem I've ever encountered. Several days passed, I tried so many things, still no progress. Any ideas?

(click on pic )

[attachment=33102:lefthandmessedup1.gif]

EDIT: Someone said that it's because the animation is complicated ( inverse kinematics and stuff ) and assimp can't read some additional transformation tags in the collada file. And I can't use .fbx because assimp doesn't read any .fbx files.

Advertisement

Two reasons this would happen:

First, your bones have more weight groups on a single vertex than the importer checks for. This is rare and often only happens with self made importers.

Fix this by using a different exporter/importer DirectX(.x) should work. (.fbx) is the best, there should be importers for assimp some place on the internet.

Fix this by hand painting the weight in Blender, check that no vertex is assigned to more than two bones. This is the worst solution as it limits animations.

EDIT: Someone said that it's because the animation is complicated ( inverse kinematics and stuff )

This is the second problem.

Fix it by animating your model with the IK complex rig. Then in Blender, after your model is animated, go to the key frame and press the I-key to capture the frame. When Blender shows the list of capture options use "Visual LocRotScale".

It's important that it's one of the "Visual" options as it will capture the frame exactly as it looks in Blender.

After doing this for each key frame, delete the IK bones, drivers and all other unessential data.

What you should have now is just deforming bones and key bones, the animation should still act the same even with no IK bones.

Note: make a backup of the file before using Visual capture data, it interferes with other animation types. Backup your file again before deleting the IK bones and such.

If you want I could give a more detailed explanation using images.

Scouting Ninja,

First, I want to thank you for all the suggestions. I think I traced the problem.

Second,

I have 1 bone for the forearm, 1 bone for the hand, and the hand bone has 5 children bones, which are the fingers.

I made a handle for the forearm bone, that uses inverse kinematics. So actually when I move the forearm, it moves the whole arm.

But the hand is a child of the forearm and the finger bones are children of the hand bone, and they are too moved when I move the forearm handle bone, because they are children of the hand which is a child of the forearm.

And what happens is that when I load this into the game, the whole arm moves, but not the hand and fingers, they are totally stuck on the same position with the same rotation, the inverse kinematics stuff changes their position in blender, but I guess when I export it to collada, it adds some strange transformation tab into the fat xml file that assimp doesn't even parse. And that is why my hand is kind of distorted and cut off from the arm.

Sorry for the messed up explanation. But I guess most of the blender options don't work with assimp. I tried to use "copy rotation", "copy location", in order to copy the rotation of the forearm into the rotation of the hand, the animation works perfectly in Blender, because when I rotate the forearm, it rotates the hand bone too, but when I export it to collada and load it with assimp, it fails hard when using assimp. Wtf should I do, I tried a wide variety of different structures, but nothing works, what do you suggest?

Guys, after a century, I fixed it. I tried compiling different assimp lib versions. I tried changing file formats, I made parsers, I extended my loader to work with up to 7 bone weights per vertex, I tried to tweak the animation look-up table, I tried maybe 30+ different blender animation and export options. Nothing worked.

Then just before commiting suicide, I thought to myself: OK, the hand is cut from the arm when I move it. What is the simplest stupidest conclusion that a primitive mind like mine can come up with? Oh no, the bones were disconnected!!!

That's why I just started Blender, loaded the project, clicked the hand bone, then shift+click the forearm bone and I just pressed Ctrl+P and clicked CONNECT to connect the hand bone with the forearm bone and now everything works perfectly fine. <_< Can you believe this? I spent days on this, WHOLE DAYS :lol:

(gif)

[attachment=33105:lefthandfixed.gif]

But I guess most of the blender options don't work with assimp. I tried to use "copy rotation", "copy location", in order to copy the rotation of the forearm into the rotation of the hand, the animation works perfectly in Blender, because when I rotate the forearm, it rotates the hand bone too, but when I export it to collada and load it with assimp, it fails hard when using assimp.

Remember that IK, Drivers and constraints are often not supported when exporting and some times your engine won't have options like these. Most exporters will attempt to convert it into a animation if it can, check your exporters and game engine to see what is supported.

Even with .fbx files imported to Unreal, the IK needs to be rebuilt because it doesn't agree with Blender. It's often better to do these things in the game engine.

the hand is cut from the arm when I move it. What is the simplest stupidest conclusion that a primitive mind like mine can come up with? Oh no, the bones were disconnected!!! That's why I just started Blender, loaded the project, clicked the hand bone, then shift+click the forearm bone and I just pressed Ctrl+P and clicked CONNECT to connect the hand bone with the forearm bone and now everything works perfectly fine. Can you believe this? I spent days on this, WHOLE DAYS

Good to see that you fixed it, this should also be useful to other game developers with the same problem.

How are you building your rig that the bones are disconnected?

The way Blender expects you to work is that you use Shift-A to add a Armature, then go to edit mode. Now when you want to add a bone don't copy the first one, use the E-key to extrude a new bone, it will be connected. Ctrl+LeftClick will also extrude a new bone, using the pointer as the target.

The W-key will give you a specials menu where you can divide a bone, useful for spines.

Never scale a bone in edit mode and always turn off the "Inherit Scale" option(It's broken, It's been reported).

When I first started with Blender I found these rules hard to follow because I used other 3D software first, however once you start using it you will understand it. Because rigs also "break up" when working with them it's a good idea to do a stress test before exporting.

Guys, after a century, I fixed it. I tried compiling different assimp lib versions. I tried changing file formats, I made parsers, I extended my loader to work with up to 7 bone weights per vertex, I tried to tweak the animation look-up table, I tried maybe 30+ different blender animation and export options. Nothing worked.

Then just before commiting suicide, I thought to myself: OK, the hand is cut from the arm when I move it. What is the simplest stupidest conclusion that a primitive mind like mine can come up with? Oh no, the bones were disconnected!!!

That's why I just started Blender, loaded the project, clicked the hand bone, then shift+click the forearm bone and I just pressed Ctrl+P and clicked CONNECT to connect the hand bone with the forearm bone and now everything works perfectly fine. <_< Can you believe this? I spent days on this, WHOLE DAYS :lol:

(gif)

attachicon.giflefthandfixed.gif

That's aweseome! I've had those days where you're pulling your hair out and then out of nowhere the answer comes. Usually, the key is to step away from it for 24 hours. A good night's sleep solves most problems. I had a boss that used to say that you're useless after about 8 hours and go home so that you can solve the problem the next day. He was usually right about that. I don't know how many times I solved the problem the first thing the next day.

How are you building your rig that the bones are disconnected?

I downloaded the rig from here. It uses some MakeHuman addon, and I thought that if it is using an addon, then the rig should be fine, but it's wasn't...

http://xenosmashgames.com/wp-content/uploads/2014/08/rigNoPose.blend_.zip

the key is to step away from it for 24 hours

Normally I can't sleep when I'm having a problem, that's why I've never tried this. I'm such a no lifer :lol: .

Scouting Ninja and BBeck, thanks a lot for the great answers, guys. Really helped me very much. There's always a detail hiding and waiting to steal 20 hours from me. But nevermind.

Thanks again. ^_^

This topic is closed to new replies.

Advertisement