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?
-
https://blender.stackexchange.com/questions/70255/generate-particles-with-random-colors-continuously-or-from-a-set, – brockmann Sep 06 '21 at 15:51
-
I want to mark as a duplicate but now I don't know which answer to choose – Markus von Broady Sep 06 '21 at 15:57
-
IMO not a dup because it's a more general question than 'random' implies. Or maybe because I answered it. IDK. :P – Marty Fouts Sep 06 '21 at 16:15
-
I guess there is even more @MarkusvonBroady ;) – brockmann Sep 06 '21 at 16:34
1 Answers
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
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.
- 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
