Page MenuHome

Trouble exporting animation to Unity, looking like Blender's baking problem
Open, NormalPublic

Description

Blender Version
Broken: 2.78

Short description of error
I'm having trouble with exporting a character animation from Blender to Unity.

Everything seems to export out fine except the eyelids animation.. it doesn't close correctly. I'm guessing this may be because of the shrinkwrap and/or action constraints I'm using, but I'm not entirely sure.

At first, when I saw the animation did not export correctly, I thought I could work around it by baking the animation in Blender first (Pose -> Animation -> Bake Action).. but the baked animation in Blender has the same problem.
Tried various methods of baking/exporting, but nothing works.

Strange thing to note though.. if I import in the .blend file itself into Unity, it seems to work.

Problem file is attached:


Layer 2 has the geometry being used for shrinkwrap.

Details

Type
Bug

Event Timeline

Have you tested this in 2.78c?

Yes, but neither exporting to .fbx to Unity nor baking the animation in Blender works corectly. Did it work for you in 2.78c?

Ah, actually, it looks like baking within Blender works if only "Only Selected" option is on. (While testing, I somehow came to the conclusion that all the options needed to be checked.)

..but when the baked animation is exported and brought into Unity, the problem comes back.
And it's not Unity's problem, because when this .fbx is brought into Blender, it has the same problem.

This is really strange because, again, when importing the .blend file directly to Unity, the animation seems to work just fine.

Yes, but neither exporting to .fbx to Unity nor baking the animation in Blender works corectly. Did it work for you in 2.78c?

I didn't test. It just a standard bug reporting to test with latest version first in case of the bug already have been fixed. A lot of bug has been fixed between 2.78a, 2.78b and 2.78c.

Right, but this doesn't look like one of them. Problem also replicated by co-worker. I'd appreciate it if somebody could look into this.

Bastien Montagne (mont29) triaged this task as Incomplete priority.May 19 2017, 12:42 PM
Bastien Montagne (mont29) edited projects, added Addons; removed BF Blender.

Blender FBX exporter does some simplification to exported animation (to reduce a bit huge size taken by animation when saving *all* frames as keyframe). While being OK most of the time, in some case it can be too aggressive, please try exporting while reducing Simplify value in Animation parameters of the exporter (you can put it to zero to completely disable simplification). Please report back if this does not solve your problem.

Note that baking in Blender won't change anything here, since FBX exporter already does that when exporting animation (precisely to take into account all possible combinations of fcurves/drivers/constraints/etc.).

Thanks for the suggestions, @Bastien Montagne (mont29). I tried changing the Simplify value to different values (including 0), as well as the Sampling Rate just in case, but nothing seems to help. =/

As far as I know, when importing the .blend directly to Unity, all it's doing is firing up Blender in the background and exporting a .fbx invisibly.. so I don't understand why that would work and exporting a .fbx out of Blender does not. Sadly, I don't think we can use the import-.blend-to-Unity method.

In case it helps, just wanted to add on that thing that seems apparent to me in my tests is that exporting .fbx out of Blender bakes the animation as if basically all the options for Bake Action are checked.
Whereas, when importing the .blend into Unity straight, the baked animation is as if only the "Only Selected" option is checked (which, in this case, seems to be the desired setting).

Bastien Montagne (mont29) raised the priority of this task from Incomplete to Normal.May 19 2017, 9:37 PM
Bastien Montagne (mont29) claimed this task.

Hrmmmmf… checked your file, there is indeed something weird going on here, some bones just do not get any animation for some reason… Note that Blender also complains about some dependency cycles, could be the cause (though quite unlikely).

Will check that deeper when I have time :/

Thanks, Bastien.

For when you get around to it:

I found there is a baking problem with the Stretch To constraint, which I think could be contributing to the issue, if not the root of it.

Here's a file that exemplifies the problem:

There are two Suzannes in the file (Suzanne, Suzanne.001). On the surface, they look identical, but if you turn the Stretch To constraints on and off, you'll see that they're constructed differently.
When you bake the animations with all the options checked, you'll find the animations are different (and, in fact, when exported to .fbx and sent to Unity, these are the animations that come in). Suzanne.001 will look right, but Suzanne will look off.

Furthermore, when importing the .blend into Unity, things are different still.. namely the result for Suzanne is different from how it looks baked in Blender, while the Suzanne.001 again looks right.