Skip to content

JiahuiCai/Blender_Interactive_Motion_Path

Repository files navigation

Blender implementation of "Tangent-Space Optimization for Interactive Animation Control"

This is a fork of the Blender repo. I implemented the interactive motion path editing gizmo in this repo. The executable for Windows10 can be found under Release.

  • The core idea comes from the Disney Research paper, Tangent-Space Optimization for Interactive Animation Control
  • The code is presented for reference only. The tool is not ready for production due to some limitations mentioned below, specifically quaternions do not work at all.
  • Feel free to ask me any questions if the code is confusing as I had to hack a bit for specific gizmo behaviors.

https://github.com/JiahuiCai/FileStorage/blob/master/AnimationTest.gif?raw=true

https://github.com/JiahuiCai/FileStorage/blob/master/motion_edit_with_constraints.gif?raw=true

https://github.com/JiahuiCai/FileStorage/blob/master/longchain.gif?raw=true

Features:

  • Motion path of all selected bones can be visualized in the viewport directly.
  • Left click and drag to alter the motion path at current frame time.
    • If there is a keyframe at the current frame time, the keyframe is adjusted.
    • Otherwise the tangents of the fcurves are adjusted (Refer to the paper above)
    • It is important to understand that it does not matter which frame-dot you click on the motion path, you are still changing the pose of the character at the CURRENT frame shown in the time line. This is intentional as it helps avoid misclick when multiple frame-dots on the motion path are bunched up. Read the next feature to find out how to change current frame time directly in the viewport.
    • Useful for giving FK-like interpolation to IK controllers or IK-like interpolation for FK rigs. You don't need IK/FK switch anymore.
    • No additional keyframes are added, only the tangents are modified, which gives nice propotional editing behavior by default.

https://raw.githubusercontent.com/JiahuiCai/FileStorage/master/LeftMouseButtonClickAndDrag.gif

  • Alt + Left mouse button, click to change frame time.

https://raw.githubusercontent.com/JiahuiCai/FileStorage/master/AltLeftMouseButtonClick.gif

  • Ctrl + Left mouse button, click to pin a point on the motion path. (Useful for doing heel roll control on a FK rig);
  • Ctrl + Left mouse button, drag to pin the entire motion path.

https://raw.githubusercontent.com/JiahuiCai/FileStorage/master/CtrlLeftMouseButton.gif

  • Shift + Left mouse button, drag on a segment between two keyframes to interpolate linearly between two locations in world space. (works for both IK/FK controls)

https://github.com/JiahuiCai/FileStorage/blob/master/ShiftLeftMouseButton.gif?raw=true

https://github.com/JiahuiCai/FileStorage/blob/master/ShiftLeftMouseButton2.gif?raw=true

  • In the "N" panel, there is a "range" option to specify how many keyframes around the current frame to display for all motion paths.

https://raw.githubusercontent.com/JiahuiCai/FileStorage/master/range.gif

  • In the "Bone" properties panel, right below IK setting there is the Motion Curve setting for the selected bone.
    • You can choose to disable visualization of the motion path gizmo for the bone head/tail. (Useful for controls that are only keyed on locations(Head only))
    • You can choose to filter the fcurves involved in the path adjustment. (Useful for joints with limited DOF, such as elbows and knees)
    • You can choose the number of bones along a bone chain that are involved in the path adjustment. (For example: you can set it to 2 for arms and legs to get regular IK behaviors, and set it to 0 for full upper/lower body IK)

https://raw.githubusercontent.com/JiahuiCai/FileStorage/master/bone_settings.gif

Limitations:

  • Only works on location fcurves and Euler angle fcurves, quaternions and blender bone constraints are not supported.
  • Interpolation adjustments only works for bezier curve interpolation mode.
  • The tool is designed for global poses, meaning you will need to key the entire character even if you only change the arms or do any minor adjustments. This also means that shifting keys to create overlap motions is not supported. You need to align all keyframes.
  • Object mode transforms are not supported. Make sure your object transfrom is zeroed out.
  • Rotational adjustment feature is limited, twist motion along the bone's local-Y axis cannot be accomplished using the tools' interface. But you could pin the bones first, use the blender rotation tool to rotate and then click on the motion path to allow the solver to recover the pinned locations.
  • My original intention is to have this motion trail/pin&drag based workflow replace the need for a complex rig. But unfortunately the pin&drag workflow is equally as tedious as working with a complex FK/IK switching rig. I would recommend you use this tool with a basic IK rig since at the very least you can achieve both IK&FK behaviors with a simple IK rig using this tool, eliminating the need for IK/FK switching.

Files:

For implementation details, please refer to the following files:

Minor changes in:

  • release/scripts/startup/bl_ui/properties_data_bone.py
  • release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
  • source/blender/editors/armature/CMakeLists.txt
  • source/blender/editors/armature/armature_intern.h
  • source/blender/editors/armature/armature_ops.c

Blender

Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.

https://code.blender.org/wp-content/uploads/2018/12/springrg.jpg

Project Pages

Development

License

Blender as a whole is licensed under the GNU Public License, Version 3. Individual files may have a different, but compatible license.

See blender.org/about/license for details.