Color gradient in material of loaded model

I loaded stl file.
and now I want apply color in linear gradient as shown in image.

download delete

Hi!
Have a look at this SO answer: