Dynamic z gradient on a moving object

Hi guys,

I’m currently working on a model for my university honours course. I’m modifying a mesh during animation, and what I need to do is to have the mesh change colour as it moves depending on z height. Now that’s all well and good to do manually if we were talking about a static gradient texture, but what I really want is to have it as a dynamic gradient eg - the top starts red and the bottom starts violet (ROYGBIV is all the way down the object). Then, as it begins to descend, the areas that were red become orange, the orange become yellow, the yellow become green, the green become blue etc. Any ideas on how I can achieve this? And if this can’t be done, how can I make the gradient go along the z axis, not the x or y?

Cheers in advance,


check out the node compositor

i think there is something to control color with curves ect…

its’ probably best bet to find something like you want !