Fix T61470: inconsistent HSV node results with saturation > 1.0.

Values outside the 0..1 range produce negative colors, so now clamp to that
range everywhere. Also fixes improper handling of hue > 2.0 in some places.
This commit is contained in:
2019-02-13 16:58:54 +01:00
parent 79f5b825a9
commit ec559912fb
4 changed files with 9 additions and 15 deletions

View File

@@ -881,12 +881,9 @@ void hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 ou
rgb_to_hsv(col, hsv);
hsv[0] += (hue - 0.5);
if (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;
hsv[1] *= sat;
if (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;
hsv[2] *= value;
if (hsv[2] > 1.0) hsv[2] = 1.0; else if (hsv[2] < 0.0) hsv[2] = 0.0;
hsv[0] = fract(hsv[0] + hue + 0.5);
hsv[1] = hsv[1] * clamp(sat, 0.0, 1.0);
hsv[2] = hsv[2] * value;
hsv_to_rgb(hsv, outcol);