Bake Action inaccurate for Spline IK
Open, NormalPublic

Description

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.

Sincerely,
Adam Janz

Details

Type
Bug

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.

-Adam

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.