Shape key corrective driver question

Hey Guys,

I’m having another go at rigging in blender but I’m having some issues with shape key drivers, doing correctives -

Let’s say I have 3 shape keys, a jawOpen, a smile, and a corrective shape key. I’m setting up drivers for the corrective with defining the 2 other shape keys as variables.

What I would want is the corrective shape key to activate only if both shape keys are used, so averaged value didn’t work for me since that’d dial on the corrective to an extent even if I use only one of them.

Does anyone have experience with things like this? I’m sure there’s a way with scripted expressions but before I start endless hours of googling I figured I’d ask.



This is a very different approach, but in your given situation it might work: Next to the list of shape keys is a down arrow. There is “create new from mix”.
You can set both “jawOpen” and “smile” to 1, then use “create new from mix”. Instead of using a corrective shape key, you can just fix that newly created shape key now.

But then, it is good to know about drivers (I have that on my plate too). So maybe it can be fixed that way as well.

That’s how I’m creating my corrective - but I want it to dial on automatically whenever the 2 main shapes are used in combination.

Essentially I’m building a FACS/shape key based facial rig relying heavily on corrective shapes and inbetweens.

I was using maya’s shape authoring before, I’m trying to re-create that functionality.

It seems that if s1=.7 and s2=.7 then the corrective key should also be .7, but what is the case for something like s1=.9 and s2=.2 ?

it could be (s1+s2)/2 to start with and I can adjust the curve later if needed, but I didn’t figure out yet how to activate it only if both keys are used.

How about:
(1.0 - (abs(s1 - s2)) * ( abs((s1 + s2) / 2.0))

That way if one of them is zero the effect is proportionally mitigated.

No, wait that’s not it, you divide them…

To activate SKey only if both Skey1 and SKey2 are active (driving the mute attribute of the Shape-key):

Two Single Property variables:
var (path: “key_blocks[“SKey1”].mute”)
var_001 ( path: “key_blocks[“SKey2”].mute” )
Scripted expression: “(not var and not var_001) and 1 or 0”

IDK whether there is a better method, but it should work.
I hope it’s clear enough.

it doesn’t give me any errors but it seems Skey is at a constant 1.0 value now, no matter what I do.

that does look promising - where would you put the division though (clearly I should’ve payed more attention in school)

this almost does what I want, looks funky though at certain values, doesn’t dial the corrective in in a linear fashion - 1.0-(abs(s1-s2))/(abs(s1+s2)/2)

You have to assign the driver to the ‘mute’ attribute (the eye on the right), not to the ‘value’

ah, got you - tried that, the 2 mute attributes driving the third shape’s mute attribute and now it’s at a constant mute (I’m not sure I understand the scripted expression)

also, is the mute 1 or 0? I’d need the corrective value to be at .5 of both shapes are at .5 for example.

mute is 1 when the SK is disabled (‘True’ actually).
BTW, the two ‘mute’ attributes can also be used in an expression to drive the ‘value’, if you want.

As for the value, there are lots of ways you can use 2 values to drive the third, you should define exactly the behavior you want and put it in formula, also taking in account that you can use conditionals in the script.

yes, that’s what I’m trying to do, but having some issues due to my lack of scripting knowledge. To start things I’d only want the corrective shape value to be an avarage of the 2 shape values, except if either of them is 0 (in that case the corrective should be 0 as well)

For something that’s supposed to be “only-if-both” a multiplication is appropriate: Sk3 = Sk1 * Slk2. That gives you 0 at 0 for either, 1 for 1 & 1.

When you multiply, you tend to minimize. 0.5 * 0.5 = 0.25, not 0.5. The appropriate correction (for the product of two numbers) is to take the square root. (0.5 * 0.5)^0.5 = 0.5. (0.33 * 0.33)^0.5 = 0.33. (0 * 0)^0.5 = 0. (1 * 1)^0.5 = 1. (1 * 0)^0.5 = 0.

So try Sk3 = (Sk1*Sk2)^0.5.

1 Like

that’s correct to me, but be sure that both values are always not negative.

sqrt(Sk1*Sk2) is giving me 0 when either of them is 0, seems to work if the values are equal which is good, but if they have different values it’s not giving me an average (0.1 and 0.9 gave me 0.3)

For some reason (Sk1*Sk2)^0.5 just gave me 0 in any case, might be a syntax thing, not sure.

I’m not using negative shapes at the moment to keep it simple.

For what you say, (s1+s2)/2 could work then, but if only one of them is 0 you’ll get 0.5
I don’t know whether it’s what you want.

no, if either of them is 0 the corrective needs to be 0 as well.

the point is: according to what course it should go to 0.

It could be:
sin(pi/2 * x)*sin(pi/2 * y)
sin(sqrt(pi/2 * x))*sin(sqrt(pi/2 * y))