control bone for a shape key

Is it possible to create a bone that you can control a shape key with? Say for instance I created a shape key that moved a body part a certain way and I wanted to create a custom shape that could be used as the control for the shape key. Is that possible?

I think what you are wanting is a ‘driver’. You should be able to right click on the value slider and add a driver for the shape key. You can link the shape key to the location, or scale of the bone. I cannot remember the precise details. But you should be able to find a tutorial on drivers.

Thanks Kauranga, I am a little familiar with drivers, I know how to create them but get hung up on the details after it is created. So a driver then can be assigned to a bone is what you are saying?

It would be a driver where the value of one bone’s location and/or rotation drives the value of a shape key. But, you can use almost anything as the input to a driver.

The greatest challenge that people tend to have with drivers is mapping the range of desired input values to the range of desired output values. This is basically raw math, usually involving linear functions. For instance, you may have a control bone that will move between local z locations of 0 and 0.2. Those are your inputs. And, you may want this input to correspond to an output value of 0 to 1. This output value would drive a shape key.

I will look at each state individually. The STATE_1 is when your control bone is at location[Z]=0 and the output value is at 0. To correspond to geometry lessons, I will use X as the input and Y as the output.

STATE_1:
X_1=0
Y_1=0

STATE_2:
X_2=0.2
Y_2=1

These states may be represented as points on a line, a line that will connect the points. The points will be of the form (X,Y), so the points are:
(X_1, Y_1)=(0, 0) and (X_2, Y_2)=(0.2, 1)

To blend between these two points linearly, we need to make the line that connects those two points. There are two ways to do this, mathematically and graphically.

Mathematically
You should use a linear equation with one input and one output. For our purposes, we need the “slope intercept” form of a line.
Y=m*X+b
m and b are just numbers, and their values will determine if this line passes through the points (0,0 ) and (0.2, 1). We will choose their values to ensure that the line passes through our points. m is the value that is multiplied by X, and b is the constant (not multiplied by a variable).

This gives us two equations. Each of these equations say that the line will pass through one of the points.
Y_1=mX_1+b
Y_2=m
X_2+b

We have two unknowns, m and b. But, we have two equations, so we can solve for them using substitution or linear algebra. When you do that, you will get equations for m and b.
m=(Y_2-Y_1)/(X_2-X_1)
b=(Y_1X_2-Y_2X_1)/(X_2-X_1)

This gives us:
m=(1-0)/(0.2-0)=5
b=(00.2-10)/(0.2-0)=0

Y=5*X+0

You can enter those numbers inside of a function in a driver to get the desired result. I suggest using a Generator modifier. The default Generator is an expanded polynomial with an order of 1, which is a linear equation like we want. To avoid using a scripted expression (which requires autorun to be enabled for scripts), I suggest setting the input type of the driver to anything other than “scripted expression”. As long as you only have one input, the type will not matter.

The bottom of this page has a calculator for solving these type of problems.

Graphically
In drivers, the graph may also be used to map values. Put the two points, (X_1, Y_1) and (X_2, Y_2), onto the graph using keyframes. In the “N” panel, you can set the exact locations of the points. X is the Frame, and Y is the Value. If you are using the default settings, the points will be connected by a curve, not a line. To fix this, in the “N” panel, set the interpolation type of each point to “linear”.

WOW thanks AustinC gives me a lot to work with. I WILL conquer drivers :-). And you are right, mapping inputs on drivers is such a big hangup but you explained it well.

You are very welcome. I decided to make a tutorial series on this. The video is here:

I don’t go over the mathematical approach, but it is a good start for most people.

Watching the video. Thanks for the upload. Much needed since many books tend to leave out how you get to control issues after creating the armature. I have found myself having to append at times from tests because I did not fully understand linear drivers.