Problem with Gradient Texture and Mapping rotation

I want to flip a Gradient Texture applied to a simple plane using a Mapping node, but the texture rotation doesn’t seem to work as expected…

This is my basic configuration:



As you can see the plane is UV unwrapped and everything is fine.

Things are also fine if I rotate of 90 degrees along Z:



but I got a black texture if I change the value to 180.

I found out that to make things work I also need to set X to 1:


Could anyone explain me why and if this is normal?

Here’s a nodegroup I got from Unreal engine 4…



Rotation Angle is in radians (3.142 = 180 degrees)
Rotation Center should be (0.5, 0.5, 0) for rotating around the center

Sorry, but I don’t see the connection here.

They seem 2 completely different systems and trying to translate the texture to (0.5, 0.5) in Blender doesn’t seem to work with any angle value (just tried).

That nodegroup is just for rotation, trying to translate or scale with that nodegroup is pointless, I thought it was obvious. Why did you even try that? You can always use the mapping node for translation and scaling.

The location value indicates the origin of the gradient where everything to the left is black and everything to the right is a gradient to white. 0-1 indicates the UV co-ordinates in this case. 1 (right) is full white and 0 (left) is black.

So x 0,y 0 is rotating the gradient from the bottom left of UV space. Sliding the values interactively in the rotation field will show this. So when you rotate 180 you have just made everything to the right black instead of everything to the left. Adding a value of 1 then simply moves the origin over to the farthest right of UV space. And then your black is trailing off to the next tile to the right instead of to the tile to the left.

Remember the input in vector is the UV map. So you are driving he gradient from the UV and UV space. And you are also trying to rotate from there. And I think - if I understand your problem - you want these two values separate. One value to indicate the origin of the gradient and another to indicate the rotation center.

So to have more control you could add a Vector Curve node between the Mapping node and the Gradient Texture node. This would allow you to rotate from .5.5 and tweak the curve to adjust the position of the gradient separately.

Does that help?

Video maybe is more clear:

Wow Richard, thank you a lot! Now it’s clear.

Things are not very intuitive, but I got the logic behind it now.

Cool. And thinking on it now if all you want to do is control the gradient maybe that curve node is a better place.

Anyway glad you could make sense out of it.

I should probably point out (for others reading this) that the easiest solution to achieve what I wanted is just rotating the UV quad in the UV Editor.

I knew that already, but I was trying to understand how the Mapping node works with textures.

The solution suggested by Richard (curve node) offers way more control over the gradient and it might be the best one for something more “advanced”.

I am going to mark the thread as solved now. Thanks everyone for posting and helping me.