From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

BEPUik for Blender

BEPUik is a full body inverse kinematics library from BEPUphysics. I've ported it to pure C and C++ and integrated it into my custom build using the same GPL license as Blender. The end goal is to one day get it into trunk.

Join the discussion: blenderartists.org BEPUik forum thread


Download Available for Windows64 and Mac:

https://github.com/Squashwell/bepuik/releases

Run Blender with BEPUik

  • Download the custom Blender build.
  • Unzip the archive.
  • Run the blender executable found inside the extracted folder.
  • Go to File -> User Preferences -> Addons.
  • Type "bepuik" in the search box.
  • Click BEPUik Tool's checkbox.
  • Save User Settings.





Interface Overview

New BEPUik related functionality can be found in these areas of the interface:

  • Solver settings in the Object properties panel.
  • Bone settings in the Bone properties panel.
  • Operators, solver settings, and rigging tools in the BEPUik tab of the T panel.
  • Autorig operators and autorig layer management in the N panel.
  • Display panel of armature Data properties.
  • BEPUik constraints can be found and applied in the Bone Constraints menu.
Manual-bepuik-gui-locations.png

BEPUik Tools

BEPUik Tools is an addon that works in tandem with the BEPUik branch of blender's source code.

It contains a humanoid rig generator, and a few other rigging utilities that make rigging with BEPUik easier.

Rig Generator

  • Open the T panel and select the BEPUik tab.
  • Find the BEPUik Rigging Tools subpanel.
  • Enter object mode, and under Meta Armature Presets, click either Biped or Quadruped. At this point, you can modify the operator's settings, (at the bottom of the T panel) like number of toes, fingers, wrist width, whether the rig has a tail, and so on.
  • Enter edit mode, and position the meta armatures' bones in relation to your character mesh.
  • Enter object mode and click Generate Rig. This will process for a few moments and generate a "Rig" object. This new rig object is the animation armature that can act as a deformer for your mesh.

Rig Features

The N panel contains some posing operators and values to quickly set up control rigidities for common use cases:

Torso Stiffness
If this value is more than zero, it constrains the torso along angles matching the chest stiff and spine stiff bones. If Torso Stiffness is zero, then chest stiff and spine stiff have no effect.
Fingers Tweak
Set rigidities so the fingers are easily tweakable.
Heel Pivot
Set rigidities so the foot pivots on the heel.
Toes Pivot
Set rigidities so the foot pivots on the toes.

Other Rigging Tools

To quickly create controls and targets, first enter pose mode, and under Create Control with Target, choose one of the following:

Position and Orientation
Create a target at the head of the bone.
Position and Orientation
Create a target at the tail of the bone. Generally, you only want to use this if constraining the tail by position only.
Empty
Create a target empty at the head of the bone.

Keying Set

The WholeCharacter keying set has been updated to be compatible with BEPUik. It automatically keyframes all BEPUik Control rigidity, as well as BEPUik bones.

New Keying Set: BEPUik Controls and Targets keyframes all BEPUik Controls' rigidities and their targets' location and rotation.

Copy/Paste Pose

The Copy Pose and Paste Pose operators include BEPUik Control rigidity. For example, when copying the pose of bone, its associated control rigidity (if it has any) will be copied as well. This also works when copy and pasting a flipped pose.

Animation Operators

The BEPUik tab in the T panel gives access to some helpful operators when animating.

Enable/Disable BEPUik
Assign or disable BEPUik on each of the selected pose bones.
Modify Control Rigidity
Select a bone(s) or target bone(s) in pose mode and invoke the operator. If the selected bones relate to BEPUik Control constraint, that control's rigidity will be modified.
Apply BEPUik Visual Transform to Pose
Apply final constrained position and orientation (no scale) of all pose bones to their transforms. This also moves soft targets to match their targeted bones, but hard targets will remain unchanged.

Hotkeys

These hotkeys work on the currently selected pose bones:

  • ⇧ ShiftD Modify control's position rigidity.
  • ⇧ ShiftAltD Modify control's orientation rigidity.
  • ⇧ ShiftCtrlD Set control's soft position/orientation rigidity.
  • ⇧ ShiftCtrlAltD Set hard rigidity.
  • AltD Remove all rigidity from controls.

Solver Settings

Dynamic
During transform operators, BEPUik will be solved continuously like a dynamic physics simulation. This is like applying the BEPUik visual transform every frame.

Without dynamic solving, BEPUik solves only once from the BEPUik prepose to its target positions. This provides more control and resembles interaction with traditional Blender rigs. Also, displaying the BEPUik Prepose helps visualize the difference between Dynamic and non-dynamic solving. http://wiki.blender.org/index.php/User:Squashwell#Display_Options
Match Finished Transform
Attempts to match bones and targets to the finished BEPUik result of transform operations. It's basically applying the Visual Transform after each time you move the rig. Another way to think about it: it's updating the BEPUik Prepose to match the current visual positions of the bones. http://wiki.blender.org/index.php/User:Squashwell#Display_Options
Inactive Targets Follow
Attempts to match any currently unused targets to their targeted bones. This only has an effect during transform operators, not during animation.
Solve Peripheral Bones
Normally, peripheral bones are excluded from the BEPUik solver. Technically speaking, a bone is considered peripheral when it is not controlled and has no controlled descendants.
For example, assuming that:
  • Solve Peripheral Bones is OFF
  • The hand bone IS controlled.
  • The fingers are NOT controlled.
The hand would be solved by BEPUik, but the finger bones would be considered peripheral and therefore simply parented to the hand. Otherwise, if Solve Peripheral Bones is ON, then the fingers would be solved too, with the fingers "flowing" behind the hand.
Solve Length
Think of it like the duration of a physics simulation. A box falling from a great height under earth's gravity needs a long time to hit the ground. Alternatively, a box close to the ground needs a short period of time. Likewise, a BEPUik character requires a longer solve length to move its index finger to its toe than its index finger to its thumb.
Solve Quality
Higher solve quality reduces jitter when many constraints conflict with each other. Although for simple cases, a Solve Quality of 1 is usually enough.

BEPUik Constraints

BEPUik constraints are found in the Bone Constraints panel. Even though BEPUik Constraints are in the constraint stack, it's important to remember that conceptually no BEPUik constraint comes before or after another BEPUik constraint. All BEPUik constraints are solved simultaneously.

The pose solving order is:
Animation/Drivers -> All BEPUik Constraints -> Blender's Constraints.

Ideally, rigging would involve a fully nodal interface, allowing any arbitrary solve order. But that's for the future!

BEPUik Control
Controls constrain a BEPUik bone to a position and/or orientation. If the Hard option is enabled, then the control will be much stronger, restricting essentially all movement.
You can graphically display all controls in the 3D view by activating its option in armature display properties. Hard controls appear red and soft controls appear yellow. Controls affected by orientation will have an arrow pointing along the Y axis of the goal orientation, and a triangle pointing toward the Z.
Only the BEPUik Control constraint can reference either a bone or an external empty object; all other BEPUik constraints must reference a bone inside the same armature.
Other Constraints

TODO

Somewhat related documentation from BEPUphysics, explaining many of the constraints used in BEPUik:
http://bepuphysics.codeplex.com/wikipage?title=Joints%20and%20Constraints&referringTitle=Documentation

Display Options

Options to visualize BEPUik's controls and the BEPUik Prepose can be found in the Display subpanel of armature data properties. The BEPUik Prepose can be thought of as the keyframed/driven position of the bones before the effects of any BEPUik or blender constraint.

Quirks/Limitations

Non-uniform scaling of pose bones is unsupported by the BEPUik solver.

Compiling from Source

First, follow these directions to setup your blender build environment:
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender

Checkout the bepuik branch from my bepuik git repo:
https://github.com/Squashwell/bepuik/tree/bepuik

Clone the bepuik_tools rigging addon as well:
https://github.com/Squashwell/bepuik_tools

A good place for bepuik_tools is: blender/release/scripts/addons/

You have to use Cmake. No Scons support yet.

Pass these defines into CMake:

  • WITH_BEPUIK=ON
  • WITH_BOOST=ON

Link Dump