1

I have a very simple question. Is it possible to change the material (i.e. color) of a body or face at each frame in Blender? Would it be possible to do it through Python?

Duarte Farrajota Ramos
  • 59,425
  • 39
  • 130
  • 187
Gil
  • 11
  • 1

1 Answers1

3

Yes it is possible. But how to do it depends on what exactly you want to do. One way is to use a driver on one of the properties of the material. Here is a very simple example to show you how it works

Material changing every frame

If you look at the Value node, you will see that I'm typing in #frame % 2. As soon as I hit enter, the Value field will be filled by a driver that changes between 0 and 1 on each frame.

Because the color ramp will give Black for 0 as the Fac and White for 1, this will generate a very annoying flashing effect.

You can use the frame number to drive pretty much any numeric value in a material and that will cause the material to change. You can generalize the ColorRamp to allow switching many colors for example, or you can perform math on the object's Normal Map.

Marty Fouts
  • 33,070
  • 10
  • 35
  • 79
  • you could also animate the value using the noise generator in the graph editor if you wanted. Just press i when your mouse is over the number and open the graph editor. A good option when you want more control. – Millard Sep 06 '21 at 20:44
  • I've rolled back the edit, because you do type the octothorpe (#) before frame when you first enter the driver. – Marty Fouts Sep 06 '21 at 23:46