Inverting using one minus, subtract, lerp, or gradient texture is extremely innacurate

This is something I’ve been dealing with since UE3 and to date I haven’t found a good solution.

I’m attempting to invert a texture, whether grayscale or RGB (mostly black and white)… and the result is very inaccurate.

Here’s a picture to illustrate:

https://dl.dropboxusercontent.com/u/1997866/_TEMP/oneminustroubles_new.jpg

As you can see, the photoshop result is more representative of what things should look like. A one minus gives a washed out, inaccurate result.

Furthermore, I’ve added some arbitrary multiplies, powers, adds, and clamps… followed by a one minus… and the result is even worse.

Example:

https://dl.dropboxusercontent.com/u/1997866/_TEMP/oneminustroubles.jpg

I tried all sorts of things. I tried using a one minus, a subtract, a linear interpolate with the texture plugged into its alpha channel… I even tried hooking a gradient texture up to the texture via its UV input. All resulted in very inaccurate inversions.

There has to be a better way. I’ve searched google for the answer but to no avail. Some suggest multiplying by a power of 0.55. Some suggest using the an “if” node. I’ve tried them all, but still have come up empty handed.

Is there a more accurate way of doing this? If so, it could unlock some neat tricks.

Historically, the way I’ve dealt with this is inverting in photoshop, then using that inverted texture in editor… but it’s not exactly the best way to do things.

Any help would be appreciated. :slight_smile:

Thanks,

Is the texture sampler type set to grayscale, or linear grayscale? You probably want linear.

I would also be interested in this matter, I found the one minus giving awful results. Even with procedural stuffs, like gradients are getting inverted in a way that doesn’t make any sense. I thought that it might be that the values are lower or higher than that is possible to put on the previewer, but using a clamp doesn’t help either.

43059-screenshot+2015-05-17+15.57.21.png

Cancel mentioned above that you probably want linear instead of SRGB. Probably correct.

Secondly, Fisher007, in your case, it is an order of operations thing. If you want the same thing literally flipped, you’ll need to 1x the gradient, then do the power, and clamp. It doesn’t work to simply 1x the final result.

1 Like