FBX export saves wrong keyframe values #50684

Closed
opened 2017-02-14 15:15:59 +01:00 by Aaron Powell · 8 comments

System Information
Windows 10
GTX 1080 (x2)

Blender Version
Broken: 2.78 4bb1e22

Short description of error
I'm trying to export baked camera animation to an FBX file to bring into another compositing program. When I import the FBX file (or even re-import into Blender), I noticed the rotation values aren't exactly the same. This makes very noticeable issues when you're trying to match projection mapped geometry to pre-rendered footage.

For example, a key frame with rotation values (92.259, 0.087, 23.025) exports to (92.229, 0.099, 22.706). I'm using XYZ Euler rotations.

Exact steps for others to reproduce the error

  1. Open "baked_camera_animation.blend" and export the camera to FBX with default settings. (Alternatively, create a camera with animation and bake it with "Bake Action" before exporting).
  2. Open a new blender file and import FBX file.

baked_camera_animation.blend

**System Information** Windows 10 GTX 1080 (x2) **Blender Version** Broken: 2.78 4bb1e22 **Short description of error** I'm trying to export baked camera animation to an FBX file to bring into another compositing program. When I import the FBX file (or even re-import into Blender), I noticed the rotation values aren't exactly the same. This makes very noticeable issues when you're trying to match projection mapped geometry to pre-rendered footage. For example, a key frame with rotation values (92.259, 0.087, 23.025) exports to (92.229, 0.099, 22.706). I'm using XYZ Euler rotations. **Exact steps for others to reproduce the error** 1. Open "baked_camera_animation.blend" and export the camera to FBX with default settings. (Alternatively, create a camera with animation and bake it with "Bake Action" before exporting). 2. Open a new blender file and import FBX file. [baked_camera_animation.blend](https://archive.blender.org/developer/F485298/baked_camera_animation.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @wayland

Added subscriber: @wayland
Author

After some more research it appears that Blender's FBX exporter has a long history of rotation issues. Something interesting I didn't really mention above is the exported keyframes seem to start off okay - the first 50 or so frames are pretty much spot on. Then it appears to deviate along the vertical axis a bit (shifting the camera left or right by fractions of a degree), but return to expected values after about 30 frames. This happens on and off throughout the animation.

I took a peek at the exporter's source code and I noticed it converts between radians and degrees at various points. Is it possible this is a precision error when rotating/converting the matrix?

"/source/blender/python/matutils/mathutils_Matrix.c" uses a double for the angle value to avoid exactly this problem (see PyObject *C_Matrix_Rotation on line 467), but is it possible something else is creating a margin for error?

After some more research it appears that Blender's FBX exporter has a long history of rotation issues. Something interesting I didn't really mention above is the exported keyframes seem to start off okay - the first 50 or so frames are pretty much spot on. Then it appears to deviate along the vertical axis a bit (shifting the camera left or right by fractions of a degree), but return to expected values after about 30 frames. This happens on and off throughout the animation. I took a peek at the exporter's source code and I noticed it converts between radians and degrees at various points. Is it possible this is a precision error when rotating/converting the matrix? "/source/blender/python/matutils/mathutils_Matrix.c" uses a double for the angle value to avoid exactly this problem (see PyObject *C_Matrix_Rotation on line 467), but is it possible something else is creating a margin for error?

Added subscriber: @mont29

Added subscriber: @mont29

I would not expect floating point precision issues to be sensible here.

More likely, you are suffering from the simplification over baked curves applied by default by the exporter (to reduce amount of data and hence size of FBX file).

In the Animation settings of FBX exporter, can you please try to set the Simplify value to zero (and ensure Sampling Rate is at its default value of 1 frame), and see whether this fixes your issue?

Otherwise, I’ll need a simple .blend file demonstrating the issue to investigate it.

I would not *expect* floating point precision issues to be sensible here. More likely, you are suffering from the simplification over baked curves applied by default by the exporter (to reduce amount of data and hence size of FBX file). In the `Animation` settings of FBX exporter, can you please try to set the `Simplify` value to zero (and ensure `Sampling Rate` is at its default value of 1 frame), and see whether this fixes your issue? Otherwise, I’ll need a simple .blend file demonstrating the issue to investigate it.
Author

Well look at that, you learn something new everyday. I completely missed the simplify function - that's exactly what was happening. I agree with you, when I looked at the source code it seemed pretty unlikely it was a precision error but ya never know sometimes.

Move along, there's no bug to see here. :)

Well look at that, you learn something new everyday. I completely missed the simplify function - that's exactly what was happening. I agree with you, when I looked at the source code it seemed pretty unlikely it was a precision error but ya never know sometimes. Move along, there's no bug to see here. :)

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2017-02-16 17:28:25 +01:00

Cool, thanks for quick head-up :)

Cool, thanks for quick head-up :)
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#50684
No description provided.