bugfix: [#29711] Cycles - HSV Node - Hue Change Bug

* Adding hue instead of removing it.

fmod doesn't work as % when it comes to negative numbers:
fmod( 1.3, 1) ==  1.3 % 1 == 0.3
fmod(-0.3, 1) != -0.3 % 1
This commit is contained in:
Dalai Felinto 2011-12-29 05:40:48 +00:00
parent d14edecabf
commit b4c95833ab
2 changed files with 4 additions and 2 deletions

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

@ -110,7 +110,8 @@ __device void svm_node_hsv(KernelGlobals *kg, ShaderData *sd, float *stack, uint
color = rgb_to_hsv(color);
color.x += hue - 0.5f;
// remember: fmod doesn't work for negative numbers
color.x += hue + 0.5f;
color.x = fmod(color.x, 1.0f);
color.y *= sat;
color.z *= val;