Gradients: Checking my reasoning

Hi MarkE,

I’m the author of the thread that you linked and I’m pretty sure I tried something similar to your approach at first :slight_smile:

The problem with your solution is that you shift your whole gradient, so it won’t render as you might want.

I rendered two images, one with my (I mean, Jamis really) implementation and one with yours.
Both gradients should go from red to green.

My implementation:

Your implementation:

And it makes sense when you think about it. Plug in -1 for X and the term in your method evaluates to 0. Which means that the leftmost point is going to get mapped to exactly the middle of the gradient.

Hope this helps!