Shape Key Values affecting Materals to Change

Hi, I’m trying to pull the value from my shape keys and make the texture change along with it using drivers, but I’m struggling to find any information online on if this is possible?

For Example:
mouthOpen = 0 apply texture 1
mouthOpen = .5 apply texture 2
mouthOpen = 1 apply texture 3
mouthOpen = 1 and mouthRollUpper = 1 apply texture 4

I want the values from the shape keys because a plugin I’m using is giving them values in real time, but I’m confused on how to properly grab them in use with shaders. It’s all to get a mouth texture to update with set mouth shapes from face tracking. Any help?

Hi and welcome to the forum!

Interesting problem you have there! I’m thinking you would want to look at the uv warp modifier to accomplish this.

I have no experience using this modifier, but I believe it is used for changing texture mapping. So basically, you’d have 1 image that is all 4 of your images, then you’d use the modifier to change which part of the image the UV Layout is mapped to.

Then you’d use drivers to adjust the uv warp modifier as needed. The first 3 conditions you list would be straight forward for setting up the drivers, but the 4th condition

mouthOpen = 1 and mouthRollUpper = 1 apply texture 4

Would throw a monkey wrench in things because you have 2 input values - mouthOpen and mouthRollUpper. So you’d probably need to use a pydriver to get it to work.

A pydriver is nothing more than a small bit of python code that looks at your input values and returns an output value based on them. Something like this

if mouthOpen == 0:
    return value 1
elif mouthOpen == .5:
    return value 2
elif mouthOpen == 1 and mouthRollUpper == 0:
   return value 3
elif mouthOpen == 1 and mouthRollUpper == 1:
   return value 4

So this is the direction I think you need to be looking into…

Hope this helps,
Randy