6
$\begingroup$

I'm accustomed to doing my rigging in Maya. I enjoy the precision and the constraint system is excellent.

I decided to broaden my horizons. Now the rage:

Over the past day and a half i've been messing with Blender's IK system and found it to be terribly bad. The pole target system flips my IK unless I make some pole angle adjustment. I already know how to set up the pole target so my rig doesn't twitch, that's not the problem. The problem is aiming my IK at the pole target WITHOUT having to touch the pole angle. The only way to achieve this is with a bone roll setup that hasn't been adjusted at all.

How in the hell do you guys do this? Is there some addon i'm missing?enter image description here

$\endgroup$
2
  • $\begingroup$ I was able to make a no-flip knee by also adding the Locked Track constraint. I don't know what this is exactly for, but it works. $\endgroup$
    – allen
    Commented Jul 29, 2015 at 7:39
  • $\begingroup$ Blender's rigging system is finicky to say the least. Its pole target system in particular is very bad. But Blender is ever-growing and (hopefully) there will be an option in the future to aim at a pole target by axes. Good animation can still be done, but if an IK is giving you grief, delete it and simply do the bending-joints animation manually. It doesn't take that much more effort. $\endgroup$
    – allen
    Commented Jul 30, 2015 at 5:30

5 Answers 5

5
$\begingroup$

You are trying to do impossible. Check this out how Pole target angle is exactly computed and how the IK works with it.

You either setup the pole angle or the IK base bone roll.

Adjusting the pole angle is lesser evil, that's how it should be done. Adjusting bone roll ends up in re-binding skin.

Maybe the iTaSC IK solver would suit better your application than the blender's legacy one, try it out.

$\endgroup$
2
  • 1
    $\begingroup$ @R.Navega bone roll changes the edit bones so it changes the base pose. And if there is a mesh already bound to the bone, so it changes how it is bound. You can control the pose of Pole bone how ever you want, but I don't think this changes anything on the matter. You can have it free floating, parented to IK Control, parented to "guide bone", etc. $\endgroup$ Commented Nov 23, 2017 at 10:15
  • 1
    $\begingroup$ @R.Navega It should be usually rigged how the animator wants it, but if I am animating I prefer Pole bones parented to their IK targets and those parented to the armature Root bone, that suits me:) Some animators prefer free floating. $\endgroup$ Commented Nov 24, 2017 at 8:35
3
$\begingroup$

I came to a solution after much grief. I hope anyone else having hell with this situation finds this useful.

I rebuilt the rig and discovered that there was no problem at all with the pole vector constraint. The problem is that in my previous attempt I was using the Rigify addon, and I suspect I was running into double transforms.

$\endgroup$
0
$\begingroup$

If your problem is to avoid the mesh deformation so ...

After setting yout bones contrainst, j ust go to pose menu / pose/apply /apply pose as rest pose

$\endgroup$
0
$\begingroup$

You may want to try this: http://pasteall.org/384523/python

It's an addon. You'll have to put it in your %appdata%\Blender Foundation\Blender\2.78\scripts\addons folder or the equivalent in your platform and enable it in Blender. It adds a button to the constraints panel for each IK constraint it finds. The button puts the right number in the pole angle box.

I took @jerryno's solution and coded an addon around it, so, thank him. It's not the most elegant solution around, but it did the trick for my pipeline.

EDIT: as pointed out in the comments, I'm inserting the code inline so it stays here once the pastebin turns to dust.

bl_info = {
        "name": "Bone Panel extension",
        "author": "Fernando D'Andrea - Rockhead Studios (thanks to Jerryno for the angle calculation code)",
        "version": (0, 1),
        "blender": (2, 78, 0),
        "location": "Properties > Bone Constraints > Inverse Kinematics",
        "description": "Extends IK panel funcionality",
        "warning": "",
        "wiki_url": "",
        "category": "Rigging"
        }

import bpy
import mathutils
import bmesh

def dandrea_IKConstraint_panel(self, context):

        _bone = context.pose_bone #context.object.pose.bones
        #self.layout.label(str(_bone.name))
        #self.layout.label(str(_bone.constraints))
        #self.layout.label(str(len(_bone.constraints)))
        for cons in _bone.constraints:
                if cons.type=='IK':
                        self.layout.operator("constraint.dandrea_adjust_pole", icon = 'OUTLINER_OB_ARMATURE', text='Adjust Pole Angle:    ' + _bone.name + ' ("'+ cons.name +'")').constraint = cons.name


class dandrea_adjust_pole(bpy.types.Operator):
        """Adds functionality to the IK constraint panel."""
        bl_idname = "constraint.dandrea_adjust_pole"
        bl_label = "Adjust IK Pole Angle"
        bl_icon = 'OUTLINER_OB_ARMATURE'
        constraint = bpy.props.StringProperty(name="IK Name", description="IK constraint name to set", default="")

        @classmethod
        def poll(cls, context):
                #implement poll
                return True

        def execute(self, context):

                def signed_angle(vector_u, vector_v, normal):
                        # Normal specifies orientation
                        angle = vector_u.angle(vector_v)
                        if vector_u.cross(vector_v).angle(normal) < 1:
                                angle = -angle
                        return angle

                def get_pole_angle(base_bone, ik_bone, pole_location):
                        pole_normal = (ik_bone.tail - base_bone.head).cross(pole_location - base_bone.head)
                        projected_pole_axis = pole_normal.cross(base_bone.tail - base_bone.head)
                        return signed_angle(base_bone.x_axis, projected_pole_axis, base_bone.tail - base_bone.head)

                context_mode = context.mode
                bpy.ops.object.mode_set(mode='POSE')
                ik_bone = context.pose_bone
                print (ik_bone)
                cons = ik_bone.constraints[self.constraint]
                if cons is None:
                        return {'CANCELLED'}
                cons_mute = cons.mute
                base_bone = ik_bone
                for i in range(1, cons.chain_count):
                        base_bone = base_bone.parent
                if base_bone is None:
                        return {'CANCELLED'}
                pole_bone = cons.pole_target
                if pole_bone is None:
                        return {'CANCELLED'}
                if pole_bone.type == 'ARMATURE':
                        pole_bone = context.object.pose.bones[cons.pole_subtarget]
                if pole_bone is None:
                        return {'CANCELLED'}
                print(pole_bone)
                if (base_bone is not None) and (pole_bone is not None):
                        cons.mute = False
                        bpy.ops.object.mode_set(mode='EDIT')
                        pole_angle_in_radians = get_pole_angle(base_bone,ik_bone,pole_bone.matrix.translation)
                        pole_angle_in_deg = round(180*pole_angle_in_radians/3.141592, 3)
                        print(pole_angle_in_deg)                       
                        cons.mute = cons_mute
                        bpy.ops.object.mode_set(mode=context_mode)
                        cons.pole_angle = pole_angle_in_radians

                return {'FINISHED'}

def register():
        bpy.utils.register_class(dandrea_adjust_pole)
        bpy.types.BONE_PT_constraints.append(dandrea_IKConstraint_panel)

def unregister():
        bpy.utils.unregister_class(dandrea_adjust_pole)
        bpy.types.BONE_PT_constraints.remove(dandrea_IKConstraint_panel)

if __name__ == "__main__":
        unregister()
        register()
$\endgroup$
2
  • $\begingroup$ Once this link from pasteall goes down in 5 months or so, this will not serve any use for future readers. Please include the information here, in your answer. $\endgroup$ Commented May 5, 2017 at 19:26
  • $\begingroup$ @Timaroberts there it is. $\endgroup$ Commented May 25, 2017 at 22:07
-1
$\begingroup$

Cant say for certain if it applies in this situation, but I have seen a rigging video that showed needing a slight bend needed in your base pose. If its perfectly straight, it gets wonky. Give it a try.

$\endgroup$
2
  • $\begingroup$ After another entire day wasted hunting for answers and trying a variety of methods, I've come to the conclusion that Blender's pole target system doesn't work. (some people on other forums even claimed they were never able to get it to work). Good animation is possible however, if I forego the IK's and animate the arm/leg bends manually. $\endgroup$
    – allen
    Commented Jul 30, 2015 at 5:22
  • $\begingroup$ @JeffG The base (rest) pose does not matter to standard blender's IK solver, because it is not dynamic solver nor simulation solver. It's stateless solver. $\endgroup$ Commented Jul 30, 2015 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .