mapping a colorramp with node

Hello
I am trying to use the mapping node to position a colorramp on an object. The issue I face is that when I get the ramp the way I need and if I rotate the object the ramp moves back to its original position that is either from left to right or bottom to up… I fact I don’t seem to be able to rotate the ramping of a color on an object and have it stay in the position I need.
Is there in the relation mapping and colorramp something I miss?

Can you post a .blend file?

If not, you could drive the parameters of the mapping, using the object’s rotation. In the Node editor right-click on the rotation value(the axis you want to rotate the object around) in the mapping node and click add driver.

Then go to the Graph editor and after Marker|Channel|Key at the bottom, there will be a F-Curve/Drivers dropdown menu, choose Drivers.

With the same mapping node selected in the Node editor, click on the driver on the left(T-button panel) and on the right(N-button panel), under Drivers you’ll see a new driver added. It’s name will be “var” and no objects will be assigned to it yet. Assign your object to it. Then change the “Type” to the rotation axis you will drive the rotation value of the node with.

After that above there will be a field called Expr: with a value of 1.0 assigned to it(I think 1.0). this driver. Change this 1.0 value to var and add “+” or “-” and some value to it so that you will rotate the colorramp to match the rotation you want to have. It would look like “var-90” or “var+90”, without the quotes.

I have highlighted the important parts here:


Cool thanks this is great… Your setup is really much more involved than what I could think of… I will work it out and come back on the results… Thanks again for that great direction…