Bake Action inaccurate for Spline IK
Open, NormalPublic


System Information
Windows 8.1 64 bit; EVGA GTX 970

Blender Version
Broken: (2.78c e92f235283)
Worked: Unknown

Short description of error

Hi Blender developer team,

I just wanted to report an issue I've discovered regarding baking actions on a rig that uses a Spline IK chain. Firstly, the rig is setup correctly: I have a Control Rig that uses 2 bones as Hooks to control a Bezier Curve; then I have a separate Deform Rig that contains the Spline IK chain which has the Bezier Curve set as its target. All other bones in the Deform Rig have copy transform constraints which point back to their duplicate bones in the Control Rig. This avoids cyclic dependency issues.

However, the deform rig is the one that needs to be exported with all the animation applied for use in another program. This requires baking each action into the deform rig, since the deform rig actually has no animation data of its own. So, for each action in the Control Rig, I would duplicate the Deform Rig, and name it Export Rig. I would then Bake the Action using the following settings:

After the bake, I began to notice a discrepancy in the bone positions of those which had been Spline IK bones. Interestingly, sometimes I could get it to work perfectly, usually by adding a visual keying LocRotScale keyframe first. But sometimes, that didn't work, and Blender had to be closed and re-opened. And sometimes THAT didn't work either, resulting in the final workaround which was manually adding a Visual LocRotScale keyframe for all bones in the Export Rig for EACH frame, and then baking the action (except with the "Overwrite" checkbox selected in the Bake Actions options). Essentially, that last step of baking was probably unneeded, but I did it as a quick way to remove all constraints. You can see the difference below, the selected (blue) rig is the baked one, and in the 2nd picture, you can see the baked and unbaked rigs line up perfectly:

Thanks so much for looking into this.

Adam Janz



I can confirm there is still a very slight discrepancy (basically negligible) at times even when manually setting visual LocRotScale keyframes and then clearing all constraints manually using Ctrl Alt C. This is likely the nature of Blender not being able to truly pinpoint the position of bones affected by the Spline IK constraint after visually keying. However, there is no doubt something wrong with the way Bake Action does the visual keying on Spline IK affected bones, as 9/10 times there is a fairly large discrepancy.


Here's a first guess at what may be happening (without having checked the file or the Bake Action operator):
It's likely that because the pose gets evaluated again for each bone (in order to compute what effect the visual keying should have), the results of the previous bone in the chain (that got keyed first) will end up influencing the results for latter bones, causing drift in the results. IIRC, there are similar problems with certain operations for the IK constraint.

Thanks Joshua and Brendon for your input. I did notice that manually setting visual LocRotScale keyframes and then hitting Bake Action produced much more accurate (but not perfect) results than just hitting Ctrl Alt C to clear the contraints. Maybe because the visual keying gets applied twice?

Joshua Leung (aligorith) triaged this task as Normal priority.Jul 17 2017, 5:11 PM

Indeed, I'd be very surprised if this was related to T51971.

I'm having the same problem when trying to export a complex rig to FBX. From what I can see, the problem could be related to the scaling of the bones. In other words, the scale of the parent bone affects the transforms of the child bone, thus, rotations end up looking totally sheared. I really don't know what kind of math could solve this, but it seems a pretty nasty issue if you are exporting things to a game engine.

So far, the only way I could manage to get an undistorted result, was to make all the bones children of the root bone, therefore making each bone independent from each other. Of course, this would not be what you wanted if you were planning on setting up an IK chain inside of the target Game Engine...

Hi Juan, you might be encountering this issue? If so, I posted a workaround; and there is also a solution inside UE4 if you are using that game engine. I hope this helps!

Hi Adam! Thanks for the link!

And yes, I found a similar solution, I also had a couple of bones moving like crazy in the export, so in my case I added some new parent bones that wouldn't scale along wit the rig, but would only copy rotation and location. From what I see, the main issue is with scaling.

You're welcome! Glad you got it working. :-)