14
$\begingroup$

I want to render a plane with a linear gradient texture that can be rotated as needed.

I've set up a basic working node network as shown: enter image description here

I can rotate the gradient using the Mapping Node - > Texture -> Rotation.Z coordinate, however the rendered gradient is always logarithmic rather than linear:

enter image description here

This is the true linear gradient that I am looking for:

enter image description here

I've played around with the scale and location vectors but they have no impact on the linearity of the gradient.

Here's my scene (1 plane, 1 sun lamp, orthographic camera):

enter image description here

A similar question was asked a while ago over here but no real answer was given.

Any suggestions would be appreciated.


[Update]

It seems this may be due to the Color Management applied by Cycles. I'm using Cycles because as I believe you can't rotate gradients (blends) in BI. If this is not right, please let me know.

I'm really just trying to determine if it is possible in Blender to render 2D shadow mask planes using true linear gradients. I alrteady have 3D geometry that the masks need to fit perfectly against, so I extruded edges from these objects to create new 2D planes.
[End Update]

$\endgroup$
9
  • $\begingroup$ What material is that? If it is a diffuse, that could be the issue (how is it lit?) $\endgroup$ Commented Oct 19, 2015 at 13:03
  • $\begingroup$ Indeed, the linear doesn't seem to be linear, strange. $\endgroup$ Commented Oct 19, 2015 at 13:10
  • $\begingroup$ Good question sorry forgot to add that. Diffuse BSDF material, full white. 1 sun lamp, size 3 pointing straight down. See the added picutre of the scene. $\endgroup$
    – Ash
    Commented Oct 19, 2015 at 13:12
  • $\begingroup$ Try using an emission material with a value of one. That will give you the exact and accurate values your texture produces, the lights and shaders could be messing you tests up. $\endgroup$ Commented Oct 19, 2015 at 13:19
  • $\begingroup$ There is just the single Sun lamp. I changed its surface emission strength from 3 to 1. No change to the gradient, just a bit darker. $\endgroup$
    – Ash
    Commented Oct 19, 2015 at 13:25

2 Answers 2

15
$\begingroup$

I think that the gradient is linear in its values because at equal increments of the thereshold correspond the same amount of image masking:

enter image description here

As stated by the Blender reference manual's page about Color Management, Default option does no extra conversion..

..besides the conversion for the display device

So a converision still occurs.

By switching to Raw you'll get a result almost identical to the one expected. Again from the same manual page:

Raw gives the image without any color space conversion

enter image description here

On the right you can see a linear gradient image for comparison.


Object coordinates are calculated from object's origin.

enter image description here.

If you want a gradient that starts from the bottom of the plane, you should move the origin of the object's texture coordinates (so the Object's origin) at the bottom of the plane too (the default plane's origin is instead located in its center).

enter image description here

$\endgroup$
5
  • $\begingroup$ Thanks. When I changed the View, Render: to Raw initially it gave a vertical gradient that only covered the top half of the plane (lower half remained at a constant value). When I changed the Texture Coordinate node from 'Object' to 'Generated' it seems to work as in your picture. Not sure why I had to make that change. $\endgroup$
    – Ash
    Commented Oct 19, 2015 at 15:27
  • $\begingroup$ Actually, see the first (logarithmic) gradient image. This is how it looked until I changed to Generated texture coords. Rotation using Object (Texture Coordinate ) was simpler, but with Generated I can get it working as expected by adjusting Location also. $\endgroup$
    – Ash
    Commented Oct 19, 2015 at 15:34
  • $\begingroup$ That's because the Object coordinates are calculated from the object origin. In my first gif for example I moved the origin where the 3d cursor is, at the bottom of the plane, so the starting point of the gradient is where the plane starts. $\endgroup$
    – Carlo
    Commented Oct 19, 2015 at 15:34
  • $\begingroup$ Got it. The origin was in the centre of the plane, moved it to the bottom. This has been very useful learning experience about gradients, mapping and color management, thanks again. $\endgroup$
    – Ash
    Commented Oct 19, 2015 at 15:40
  • $\begingroup$ For data, any image should be set to "non-color", otherwise it will be considered a colour and transformed accordingly. Do not futz with the View, as it is strictly a one-way transform. $\endgroup$
    – troy_s
    Commented Feb 5, 2016 at 16:46
0
$\begingroup$

Rotating a gradient is easier in Internal than in cycles, mainly because it seems that gradients are centered in Internal but offset to a corner in Cycles, why that was done is beyond me but I do hope it has a good reason because it is very unintuitive.

Anyways it's as simple to rotate a texture as taking the Distort > Rotate node and enter 0.25 as turns which will rotate it by 90deg right since the default axis of rotation is Z which can be adjusted if needed.

rotated gradient

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .