Linear Gradients not being linear

What is up with that? Even if it is a gamma thing how are you supposed to work with it when it looks everywhere not linear?

It can be fixed with using power 2.2 but then every math after that breaks it again. Very obvious is 1-x

The values in gradient are exactly linear, simply because it takes UV coordinates to generate one.You can double check that yourself, using DebugScalarValues. That is your preview viewport that is is doing gamma stuff.

Hi Davision,

This isn’t a bug. As a proof of concept I mapped the linear gradient node to a graph function of x. The graph goes from 0 to 1. As you can see the values being output by the linear gradient are indeed linear. In the example you gave where the math gets messed up this is due to the order in which you do things.

If you look at the two examples on the right one has the 1-x node after then before the power node. If you use the 1-x after the power node you effectively invert the rate of exponential decrease. To get the desired result you need to invert the gradient prior to the power node.

I assume you used the gradient tool in photo shop set to linear and dragged it across from one side of the canvas to the other. As you can see from the histogram it isn’t actually linear when drawn in this way. Photoshop adjusts the values a little to make it appear more “natural” if you want a true linear gradient you need to set smoothness to 0.

Here is with smoothness set to 0

Hope that helps,

Ed

1 Like

for the breakdown. Still, this is pretty confusing for any artist, where to put in power 2.2 and power 0.5. Even figuring out that things are different in the math then they look in the preview. I’m sure it would help a lot of people if there would be a better way to handle all this in the material editor.

Make a new HubPost asking for a feature request. That way you can make detailed suggestions that we can make an official feature request for. Be sure to be specific and plan out how you want the feature to be incorporated!

Note that feature requests don’t always get in and are judged based off community interest.

You can message me with a link to the post over the forums if you want it to be seen quickly.