Imagine a long cube, like a bar, that has a dark material, and you want to animate changing its material to a light material, but do it gradually from one end to the other, like filling up a tube, or like a progress bar that fills from one end to the other.
How can you do this in Blender?
Asked
Active
Viewed 455 times
1
Ali
- 113
- 4
1 Answers
1
Something like this ?
The principle is to mix your materials (the mix shader factor) upon a coordinate of your object. Here I set the first key frame to -3 meters for X and the last one to 3 meters for X (I dont know why these values work, I had to try to find them...).
Edit : the blend file
Edit 2 : to make the transition sharper, add a "math/less than" node, as shown here

lemon
- 60,295
- 3
- 66
- 136
-
Thanks a lot @lemon Looks like exactly what I need. Can you elaborate on a few things. 1- the shader mixer does mix the full material (not just the colors) right? 2- what property are you animating? I mean what are the keyframes set on. 3- It may be that there is something very basic that I am missing but I just get a black cube in rendered mode (Cycles render engine selected). – Ali Jun 06 '16 at 14:12
-
Thanks again, in material view, it shows up fine, is there a way to control the smoothness of transition between the two materials? I mean it very gradually transitions from one material to the other Is there a way to make the border between the two sharper? – Ali Jun 06 '16 at 14:22
-
You're welcome @Ali. 1- Here I just used to simple diffuse shader but that may work with any shader (or other nodes behind them) 2- I am animating the location (X) values (they are in green in the mapping node). 3- I used a plane. For a cube you'll have to manage in which direction you want the effect. Or maybe UV unwrap it, set the UV appropriately and use UV instead of "generated" in the "texture coordinate" node. I will add the blend file in the answer. – lemon Jun 06 '16 at 14:23
-
I added a "sharper version" (the "less than" node is the last image) – lemon Jun 06 '16 at 14:36
