FBX IO: Speed up transformation animation import #104870

Merged
Thomas Barlow merged 6 commits from Mysteryem/blender-addons:fbx_import_anim_numpy_p1.5 into main 2023-09-11 13:53:12 +02:00
Member

This patch speeds up the conversion from animated FBX lcl
translation/rotation/scale to Blender translation/rotation/scale.

An FBX file containing an armature with 65 bones and a single animation
with 1523 frames (each one keyframed) animating 47 bones (144 animated
channels in the FBX file) goes from a 1.01s import to a 0.38s import for
me with this patch. This patch should provide better baselines to
compare future performance improvements against.

Animated rotations are now converted to radians in advance using NumPy.

The non-animated matrices are now calculated once in advance and
combined into as few matrices as possible using the associative property
of matrix multiplication, reducing the amount of matrix multiplication
required to calculate the final matrix for each imported keyframe.

This patch speeds up the conversion from animated FBX lcl translation/rotation/scale to Blender translation/rotation/scale. An FBX file containing an armature with 65 bones and a single animation with 1523 frames (each one keyframed) animating 47 bones (144 animated channels in the FBX file) goes from a 1.01s import to a 0.38s import for me with this patch. This patch should provide better baselines to compare future performance improvements against. Animated rotations are now converted to radians in advance using NumPy. The non-animated matrices are now calculated once in advance and combined into as few matrices as possible using the associative property of matrix multiplication, reducing the amount of matrix multiplication required to calculate the final matrix for each imported keyframe.
Thomas Barlow added 3 commits 2023-09-05 19:03:59 +02:00
acffdf2725 Speed up _transformation_curves_gen
Precalculate the matrices that do not change each frame.

Convert animated rotation values to radians in advance with NumPy.
Thomas Barlow requested review from Bastien Montagne 2023-09-05 19:04:08 +02:00
Bastien Montagne approved these changes 2023-09-11 12:54:53 +02:00
Bastien Montagne left a comment
Owner

The changes makes sense on the general level, will trust you with the implementation details. nice improvements once again on speed.

The changes makes sense on the general level, will trust you with the implementation details. nice improvements once again on speed.
Thomas Barlow added 3 commits 2023-09-11 13:49:06 +02:00
Thomas Barlow merged commit e7b1962893 into main 2023-09-11 13:53:12 +02:00
Thomas Barlow deleted branch fbx_import_anim_numpy_p1.5 2023-09-11 13:53:13 +02:00
Sign in to join this conversation.
No reviewers
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#104870
No description provided.