I have a simple plane and a cycles material as shown in the image. (Blender 2.68a)
I extracted the R channel from the ‘texture coordinates’ node to get the uv coordinates in the horizontal direction.
As you can see the grey gradient is not linear from black to white. For comparision I created a linear gradient using Gimp (see red arrow).
My question now is why the gradient is not linear and how to make it linear?
I need this to change e.g. size of a texture depending on uv coordinates, but I need it linear.
Thanks for any explanation and help!
I don’t understand the problem or the tools well enough to give you an explanation but there still might be a solution available to you by trying some of the following adjustments.
(i)Instead of using the generated coordinates, you might instead try UV mapping the plane and then using the UV coordinates to drive the RGB node.
(ii)Try using some math nodes to scale it to what you want. It looks to me like white is greatly overpowering black so I’d start with dividing the coordinates by 10 to see where things end up. If that’s backwards change the multiplier to 10 instead of 0.1.
UV coordinates might be from the range 0.0 - 1.0, that’s how GPU shaders do things, but I’m not sure with Blender. Since a default plane in Blender is 2 units, the model might be 2x bigger than the coordinates.
Comparing your results against GIMP was a great idea. You might want to take screen captures with all the different methods you try and paste then in like you did with the GIMP gradient up above. Maybe you will start to see a pattern that you can hone in on.
The gradient seems to be a logarithmic scale rather than linear.
The ColorRamp node’s “linear” is the same:
Here’s the result if you feed in a linear gradient into X with the image texture colour space set to “Color”:
And the result with the image texture colour space set to “Non-Color Data”:
So the coordinates are indeed linear, but converting Non-Color Data to Color isn’t.
Here’s a better view of the difference between Color and Non-Color Data representation of the linear gradient:
So to answer your question:
The data values ARE linear despite the visual representation of the gradient - ie, you don’t need to make the gradient linear.
thanks for reply.
@marc dion: similar ideas I had already myself, but I need a 100% linear result not on which is close to 100% linear so I need some more backgrounbd information why it is not linear and how to solve it or convert it to linear.
@spaced: sorry I don’t know what is your result now. I don’t want to create an image gradient and feed it into the R input of ‘Combine RGB’ node. I want to take the R output of ‘Separate RGB’ and work with that. So how can I make it linear? Can you please make it more clear to me?
have an idea but did not test it
don’t know what the curve is for this R output
but try to take your R output and pass it through a power node with a certain exponent value
this might inverse the curve or almost!
another that might use a real gradient i think there is a linear output with this node
then use your seperate RGB node!
hope it helps
thanks for reply, but don’t really understand what you mean saying:
‘use a real gradient i think there is a linear output with this node’
Where is this linear output please?
talking about using the gradient node in cycles it should have a better linear output!
now from another point of view by using the math power function in your nodes set up it might help to correct the curvature and get a more linear gradient if needed
The UV coordinates ARE linear.
Ignore the displayed gradient, the conversion from UV coordinate value to color value is not 1:1, but the coordinate values ARE linear.
As it is already linear, it should be able to do what you want. If it isn’t working, please post a pic and explanation of what your texture resizing looks like.
Having a rethink, and I’m wrong that it ‘should work’.
The values are not linear coming out of the ‘Separate RGB’ node, otherwise we would get a linear gradient doing this:
Maybe the issue is the mismatch between Vector and Color:
Or maybe something deeper in Blender.