Baking Camera Focal Length Curve - Inconsistencies & Workaround
Closed, ResolvedPublic


System Information

Blender Version
Broken: 2.79

Short description of error

Need to bake a camera's animation (1 key per frame) before exporting to Nuke for VFX pipeline. I use the Bake Action operator in the 3D view. Loc/Rot/Scale bakes fine, but Focal Length / DOF Distance do not bake.

The "Bake Curve" operator in the Curve Editor does not seem to be what I want. The only way I have been able to bake the curves in the way I need is to copy/paste the Focal Length curve to a bakeable property in another object (X Location on an Empty, for example), then run Bake Action, and then copy/paste back to Focal Length.

Few ways to address this issue, but would be great to be able to bake curves (in the 1 key per frame sense) in the Graph Editor. Thank you!


Colin Levy (effstops) updated the task description. (Show Details)

There is a Sample Keyframes operator under Key menu of Graph Editor or Dopesheet that is doing that.

Is it solving your request ? Is the problem more relative to the fact focal length is under another action ? Or is it a problem with the exporter ?

Just browsing the dev site and I saw your report. Interesting bug :)
Let's check if Joshua has an answer.

Maybe the operator you are looking for is the Sample Keyframes:

It adds keyframes on every frame between the selected keyframes (Shift + O in Graph Editor)

Joshua Leung (aligorith) triaged this task as Normal priority.Nov 8 2017, 9:38 PM

As the other guys have mentioned, it sounds like what you probably want is the "Sample Keyframes" operator.

  • The "Bake Action" operator currently only supports Loc/Rot/Scale on object transforms or bone transforms only (it doesn't even support bendy bones). It's more of an object-level tool for the most commonly used transforms.
  • The "Bake Curve" operator is intended for baking down complex curves/modifier interactions into a more space-efficient and compact format, with just a single point on each frame. I never got around to adding some basic functionality to allow bulk-editing of these (e.g. time shifting the whole lot, or moving the values up/down).
  • The "Sample Keyframes" operator was intended to sample a F-Curve between each pair of selected keyframes, so that you could go in and refine the breakdowns by hand. If you want to bake the entire curve, there is a little bug there currently (T53229), as it wasn't designed to handle consecutive pairs of keyframes (i.e. the shape will get changed)

I'll look into some fixes here in the next day or so.

Another option - What addon are you using to do the export? Perhaps a quicker fix in your case would be to patch it to handle the point-sample output from "Bake Curve" instead :)

Thanks for the help, all!

I did not know about the Sample Keyframes operator - that's a great start but as Joshua points out, only seems to work consistently between any given pair of two keys. With a curve made up of 3 keys, the curve's shape changes significantly.

Regarding my workflow, it's actually pretty messed up. I need an FBX but the exporter (and importer) is broken for animation. So I'm baking the animation, exporting to a .dae file, importing to Maya and exporting to fbx from there to bring into Nuke. :/

So there's probably bigger bugs to squash, hah, but looking at the DAE exporter to get it to point-sample output from the Bake Curve sounds like a valid option to fix my original problem. :P

Ah, I see. In that case, it's probably easier to fix the Sample Keyframes operator instead :P

While looking at the code yesterday, I realised that it's actually possible to make it do what you want without the shape change issue - instead of selecting all keyframes in a curve, simply select the first and last points. It will then sample the entire frame range between the selected keyframes (i.e. all the whole curve) before modifying anything.

Would you look at that. Haha, that's very good to know - thanks for pointing that out!

That pretty much solves my immediate / original issue. Hopefully it'd be a simple fix to ignore selected keys between the two extremes? Otherwise the correct functionality is pretty buried :P

Ton Roosendaal (ton) added a comment.EditedNov 11 2017, 1:32 PM

This is a bit confusing now. Are we talking about a way to bake camera focus, or are there issues with export of baked actions in general, or both? :)

Export of animation via bake is common for nearly all external GE's... and it's what we support fbx for.

Ok, to clarify, I'm going to make sure there is a way to bake camera focus (and basically, anything that isn't transforms on an object or bone).

Export of animation (with baking) is a separate issue, and not something I intend to fix now. It also doesn't sound like it's a priority for Colin's problems/report right now.

I need an FBX but the exporter (and importer) is broken for animation.

Hrrrmm… What exactly is broken here? Or is it rather missing feature? As a reminder, FBX animation is currently only supported for loc/rot/scale of objects and bones, and shapekeys influence.

Thanks so much for looking into this Joshua!

Sorry the conversation has split into a couple topics, could probably submit a separate bug for the FBX issues:

Bastien, I'd probably need to re-investigate, since we developed our pipeline in 2015 and just stuck to what was working. But Francesco submitted this bug a while back on behalf of us, and the issue still exists to my knowledge?
(We use 2.75 for FBX import since it's broken since.) We found similar mismatch issues with exported animation data as well, but I haven't yet tried with 2.79.

Thanks for your attention!

Yeah, camera issue is still open, no idea what's happening with this one (totally confusing that it’s the only object type to have that issue it seems :( ).

@Bastien Montagne (mont29) Unless you want to keep this report open to deal with any FBX export issues for camera stuff, I suggest closing this report now?

Bastien Montagne (mont29) closed this task as Resolved.EditedNov 19 2017, 2:40 PM

@Joshua Leung (aligorith) No, we can close, FBX & cameras are already known and have own task (T45176)…