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:
Brecht Van Lommel
2019-02-13 16:58:54 +01:00
parent 79f5b825a9
commit ec559912fb
4 changed files with 9 additions and 15 deletions

View File

@@ -28,9 +28,8 @@ shader node_hsv(
color Color = rgb_to_hsv(ColorIn);
// remember: fmod doesn't work for negative numbers
Color[0] += Hue + 0.5;
Color[0] = fmod(Color[0], 1.0);
Color[1] *= Saturation;
Color[0] = fmod(Color[0] + Hue + 0.5, 1.0);
Color[1] *= clamp(Saturation, 0.0, 1.0);
Color[2] *= Value;
Color = hsv_to_rgb(Color);