I use Eevee and I decided to do synthesizer animation. Faced a problem that I do not know how to properly make the material. The essence of the material is the color change when animating the keys.

Material in action:

Material in action

Material nodes:

Material nodes

The problem is that the color change is associated with specific coordinates, and I cannot move the synthesizer. How to associate a color change, for example, with the touch of one object to another? Or change the color relative to the main part of the synthesizer? Maybe there is a better way?


I found a way to implement this. I just need to bind the driver to the nodes. It's not an easy way, but it works great!

Here, the material nodes (each key has its own, independent) are based on a variable that is controlled by the driver, which, in turn, looks at the local rotations of the key.

The difficulty is precisely in the quantity: 88 keys with 88 materials and the same number of drivers.

  • each key, just in case, is tied to empty, which are collected together and attached to the main empty.

The recipe is as follows:

  1. create the first material with nodes according to the example above
  2. RMB on value -> add driver "guide"

  1. You configure the driver by example. Here the "key name" will change from material to material (the name of the object-synthesizer key is implied). enter image description here

  2. you transfer the key to the pressed state and turn the ColorRamp until it is white at rest, and green when it is pressed.

An important point:

before all operations, you need to reset the rotation and scale of each key to normal, via Ctrl + A .

  1. You duplicate the key, put it next to it, duplicate the material, rewrite the name of the key in the edited driver and repeat until you assemble the keyboard.

Then link through empties and you can move the synthesizer by pulling the main one

Here it is also important that the animation is exactly the rotation of the keys according to their local coordinates.

  • 2
    $\begingroup$ Could you explain how, by describing the steps and posting some screenshots of the procedure and results? $\endgroup$ Nov 4 '20 at 0:27
  • $\begingroup$ Sure! I changed the answer, I hope it turned out to be quite detailed. $\endgroup$ Nov 4 '20 at 13:47
  • 4
    $\begingroup$ Hi @JohnWilliams :) it's best to use the built in tools for images. That way, they don't wind end up missing eventually leaving the answer then losing some value to future readers. $\endgroup$
    – Timaroberts
    Nov 4 '20 at 13:50

You can also do that with a "UV warp modifier". That avoids drivers.

enter image description here

enter image description here

With it and a UV map with all vertices placed at 0.5, you can use this kind of node tree:

enter image description here

Empties can be parented to the mesh, which means you can animate the empties and then animate the mesh the way you want.


You can also trigger it from the keys rotations:

enter image description here

The setting is the same about modifier and node tree (the colorramp value is just adjusted).

Here the "from" empty (warp modifier settings) is parented to the keyboard.

The keys are parented to the keyboard and the "to" empties are respectively parented to their key.

So, the rotation makes the gap, moving the empty and finally the node tree catches this difference.

  • $\begingroup$ Greetings! Looks great. But since I am new to Blender and know it superficially. I am not quite sure how to set the "UV Warp Modifier" for rotation changes. If it's not difficult for you, could you explain? Thanks! $\endgroup$ Nov 4 '20 at 15:11
  • 1
    $\begingroup$ If you parent the empties to the key, you don't have to case about rotations. That's what I mean in the last sentence above. If not clear enough, feel free to ask. Also have a look at the attached file. $\endgroup$
    – lemon
    Nov 4 '20 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.