Shapekey Driver Issue


I have been working on a way to add shapekeys to my model to get some quality deformations.
So far, I have had good luck adding those shapekeys to bones that rotate on a single axis,
such as knees, fingers and elbows. However, I am having issues on bones that rotate on multiple
axis like thighs, upper arms, feet and hands.

To illustrate my issue, I am linking a blend and a quick walk through to show the problem.
It has a simple base mesh rigged with Rigify.

Walk Through Instructions:

Example One:

Open the blend.
Select the left thigh fk bone and enter R,X,X, -90.
Select the mesh. Under Shape Keys, you should see LegX-90.L with 
a value of 1.00.
This will be Position-One.

Now reselect the thigh bone and type, R,Z,Z,-90.
This should point the leg to the side. Note the position of the bone.
It should be W 0.500. X -0.500, Y -0.500, Z -0.500
This will be Position-Two. If you select the mesh, you will see that the 
LegX-90.L shapekey is still 1.00. This is what I want.

Example Two:

Clear the rotation on the thigh.
Type R,Y,Y,-90. Then, R,X,X,-90.
The thigh will now be in the same position as Position-Two in the first example.
You can double check this in the N panel. (W-.5,X-.5,Y-.5,Z-.5)
If you select the mesh now, the shapekey will show a value of 0.00.

This is my issue. I need to have predictability in the driver. You can see by rotating to the same position
with different means, there is a different result.

Clearly, my driver is wrong, but I can’t seam to get my head around what will work for this situation. I would guess
that the reason it does not work is because of the W component in quaternion rotations. There is not a way to track that
with the Transform Channel variable type.

Another quick explanation:

I would like the value of the driver to stay consistant when I raise the leg, regardless of other rotations. So if I lift the leg 45 degree, I want the shapekey value to be 0.5 and to stay there even if I rotate the leg from the front of the body, to the side.

Any help or hints on how to accomplish this will be greatly appreciated.


after downloading your file and following your instructions… I can understand what your saying … and it’s a bit above where I’m at in drivers and Rigging… but I think what your asking may very well lie in the idea that you can “copy a data path” for a driver to use… if you right click on the W component in the Transforms you will see the “copy data path” option…

however I forget just exactly how you use it… hang on a second and I let me took for a youtube tutorial that might get you going …

… OKay… go here…

This is from Nathan Vegdahls “Humane Rigging” series… it’s very good!

he addresses what your talking about early in the video so stay with it for a few minutes and he will get to it…

Thanks norvman. I have a copy of Humane Rigging. I’ll check out that part and see if I can use that.

I think I may have found another solution. I am going to use a Rotational Difference variable type. My first tests failed using this because the variable calculates all of the rotations and that drives the value to high. If I create a new bone and constrain it’s rotation to only follow in the X, and compare it to another bone in an unrotated position, I should be able to get the driven value that I am looking for.

Unfortunately, I have a long day of work ahead, so I won’t be able to test this theory until late tomorrow. I’ll post an update if I get it to work.

Thanks for your feedback!

Keep me posted… I am interested in what you come up with…

After a lot of work I have successfully found a lot of things that don’t work. :slight_smile:

I did narrow down my problem and I am sure it has to do with quaternion rotations. I was only taking into account the x rotation, but quaternions are a mix of four values. I think the solution lies in a scripted expression that takes all of the bones rotational values into account. (X,Y,Z,and W.) Once I figure that out, I should be able to plot my shapekey value to the correct bone orientation.

I have great respect for good riggers. I learn everyday what a pain it is to do “simple” things…

If you have a suggestion, I would be glad to hear it.


When you say… Quarternions are a mix of 4 values… this is true… on the surface… what you have to Realize is that the “W” component is almost a negitive positive component… not really a full fledged Axis like X,Y,Z… yet still it’s not quite as simple as W being set to just negitive or positive… it has shades of grey between Negitive and Postitive so to speak…

this is one of the better places I have found that helps explain what it is that Quaternions are and do…

here’s another site that seems to have some kind of explaination of what Quaternions are

and another…

I often go back to these places to make my regular attempt to try and understand Quaternions…
(Like the Anchient Wisards of old however… who always returned to their places of power… putting to practice this yearly ritual… trying to desparately understand the Workings of the Universe… only in the end to find that even though they have made some small head way… it soon becomes blatantly obvious their journey is FAR from over…)

Nathan does a decent job of giving us his take on it here…

Thanks for the links norvman. I have been reading up on quaternions for the last several days. My head is about to explode.

I am convinced at this point, since I am not a rocket scientist, I need to find a way to track the position of my bone with locations, not rotations and base my driver on those values. This has been a little tricky and I have not come up with a fool proof way to do this yet.

For example I have added a bone (knee tracker) to the end point of the thigh bone. I can track it’s z location and and add my driver to increase the shapekey based on the distance the knee tracker raises. This works as long as nothing else in my rig moves. You can see that this is not a full solution because it does not take into account the position of the hip or the direction of the rotation of the thigh.

I’ve also tried adding a bone that has Euler rotations. I think this solution has promise. The problem I am having with this is, I can’t use any copy transform or copy rotation constraints to it from the quaternion bone without getting the same type of problem. Again, I need to set it’s position with locations, not rotations or I get a skewed result because X is not really X in a quaternion rotation.

Still working on a solution. I’ll get it if it kills me…

One thing I thought of in your discription above is using a Knee Pole Target (which you probably will have anyway… with your Leg IK setup…) Parent the Knee Pole to the Foot… such that when the Foot rotates the knee pole goes with it… yet the knee pole can still be moved around after you have moved the foot… this might be a good source for your location Target in your drver…

Ive rigged the left leg on the file, how I would usually rig a hip and legs.

It uses the xyz euler rotation mode, there are 3 driven shape keys on the hip.
‘lega’ Y rotation is locked (bone ik panel), so when you twist ‘legb’ (RYY), ‘lega’ rotation changes from X to Z.

Thanks for that dirty-stick. I’m sure I’ll learn a lot from that. Your deformations look good. I appreciate the time you took to put that together.

I was just about to post that I found a solution. I am still working on it, but I’ll post a blend as soon as I get it completed.

I was being a little hard headed about how I wanted to solve the problem and was overlooking a solution that Nathan Vegdahl used in the Mammoth Rigging Tutorial. Basically all you would have to do is add a bone in the position that you want a shapekey to have full influence and add a Rotational Difference variable to find that position. I think it’s easier to show then explain.

I should have mentioned that I wanted my final solution to work with Rigify. It has too many feature that I don’t think I can live without. (Torso pivot slide, IK/FK switching and snapping, and most of all the isolate rotation sliders. ) Also, I would hate to make a new rig for every mesh that I have planned. So to save time, I need a reusable base to start from.

Thanks for your help. Hopefully, I can get something together by tomorrow afternoon.


I finally have a solution! Many thanks to dirty-stick for showing me his hip/leg rig. I was able to use those ideas to make my own additions to the Rigify base. Now I have a predictable and reliable way to drive shapekeys on a leg rotation.

I should also mention the idea I had in my last post was not satisfactory.

I’m not going to write a tutorial on how to make all of this work, but here is the blend so you can check it out for yourself.

Thanks a million dirty-stick! Now I can get back to work on things I’d rather be doing.

NIce work guys… I’m going to have to study on those Drivers for awhile to figure out just exactly what is happening…

I see that there is action going on in the f-curves… is that some thing you directly manipulated? or was that just the result of creating the “sumvalue” of the variables?

I usually directly manipulate the f-curves.
If you check the leganz90.l driver keyframes, from the file I posted.
This driver sets the shape key value based on the lega.l z rotation, [lega.l_Z_Rotation : Shape_Key_value].
The first keyframe is [0.000 : 0.0000], the second is [-1.571 : 1.000].

-1.571 is displayed in the Driver variable after setup, when lega.l is rotation z-90.
I find its best to disable the ik constraint, then rotate the bone, while changing the driver settings.

So you set a driver… temporarily disable the IK… Rotate the bone to the postions your looking for and set keys… this gives you your fcurve to work with in the driver… is that correct?

Don’t look at my drivers norvman. I had to make some weird modifications to have the leg and the hip work together. I have corrected that by using the two bone Euler IK bonechain to follow the hip now. It’s not in the file that I posted.

Basically my set up uses dirty-sticks Euler bone IK to follow the quaternion bones locations/rotations in the rig. In this case they are following ORG-thigh.L and ORG-hip. I use the rotation values on the Euler IK bones to drive the shapekey values.

The driver values of a rotation are expressed in radians. 90 degrees = 1.571. 180 degrees = pi(3.14xxxx) 360= pi*2

The driver values of a rotation are expressed in radians.

Yes… when ever you use Quarternions you use something akin to Radians… and as if your brain hasn’t been bent enough trying to understand 4D space Quarternions… Quaternions use “Versors” not true Radians as a measure… (God help my poor little braincells!) LOL!

see here…