# how to control the same value on multiple different materials with an object's z location?

You can do this with drivers, and I've seen multiple blender channels that use an empty to control the value of multiple lights.

i was wondering how i would use drivers to control the value of multiple math nodes within the margin of -1 to 2 with an empty's z location. the reason i want to do this is because i need to control the transparency factor of multiple objects but only in the viewport so that means not an animation. also, what i mean by "within the margin of -1 to 2" is that if i move the empty up then the value will only increase up to the value of 2 then after that point, no matter how much i move the empty up, the value wont go past 2.. and same with the -1 value.

there is an equation out there that lets us do this but i have yet to find it. :( you don't have to tell me the whole equation i just need some better insight on how i would achieve this or maybe someone's experience using a similar driver setup in there own projects. thanks.

• If you need to share @Jachym's answer between multiple materials, it might be a good idea to put it in a Node Group. Then it's instanced: If you tweak the settings in one material, it will be tweaked in them all. Oct 13 '20 at 8:13

Simply use the Map Range node to clamp the results between -1 and 2.

1. Add a Map Range node with min = -1 and max = 2 values
2. Check Clamp
3. Select your empty's Z location and go RMB > Copy Driver
4. Paste the driver to the Value field of the Map Range node.

The Result of the map range is shown here as a slider

• Perfect, minimal, descriptive, illustration, IMO.. :) Oct 13 '20 at 8:10
• Learned from the betts :). Oct 13 '20 at 8:21
• thank you so much this is the answer i needed! it worked just as i wanted it to! you're a life saver. Oct 13 '20 at 16:15
• You're welcome :). This kind of response is why i love this site. Have a great day :). Oct 13 '20 at 16:23