diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2011-12-29 09:40:48 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2011-12-29 09:40:48 +0400 |
commit | b4c95833aba19750364c2ba1d442fc0fa80dc7ab (patch) | |
tree | 88a8372b6bbaab55933b6bf7fffaa057ff1c627f /intern/cycles/kernel | |
parent | d14edecabff7dcae1833fe0288f1da33a7dbbd8c (diff) |
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
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_hsv.osl | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_hsv.h | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/kernel/osl/nodes/node_hsv.osl b/intern/cycles/kernel/osl/nodes/node_hsv.osl index da776c8909e..8fd7a1612e8 100644 --- a/intern/cycles/kernel/osl/nodes/node_hsv.osl +++ b/intern/cycles/kernel/osl/nodes/node_hsv.osl @@ -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; diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h index fc927f297f5..ed17d3fc985 100644 --- a/intern/cycles/kernel/svm/svm_hsv.h +++ b/intern/cycles/kernel/svm/svm_hsv.h @@ -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; |