From 98547e8817b35470fdf3bc19ded9b6695db5a8ad Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 19 Jun 2016 14:55:10 +0300 Subject: Fix Cycles RGB and Vector Curves node Fac handling. --- intern/cycles/kernel/svm/svm_ramp.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'intern/cycles/kernel/svm/svm_ramp.h') diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h index 59dec409a70..24275d05c4a 100644 --- a/intern/cycles/kernel/svm/svm_ramp.h +++ b/intern/cycles/kernel/svm/svm_ramp.h @@ -92,11 +92,11 @@ ccl_device void svm_node_rgb_curves(KernelGlobals *kg, ShaderData *sd, float *st const float min_x = __int_as_float(node.z), max_x = __int_as_float(node.w); const float range_x = max_x - min_x; - color = (color - make_float3(min_x, min_x, min_x)) / range_x; + const float3 relpos = (color - make_float3(min_x, min_x, min_x)) / range_x; - float r = rgb_ramp_lookup(kg, *offset, color.x, true, true, table_size).x; - float g = rgb_ramp_lookup(kg, *offset, color.y, true, true, table_size).y; - float b = rgb_ramp_lookup(kg, *offset, color.z, true, true, table_size).z; + float r = rgb_ramp_lookup(kg, *offset, relpos.x, true, true, table_size).x; + float g = rgb_ramp_lookup(kg, *offset, relpos.y, true, true, table_size).y; + float b = rgb_ramp_lookup(kg, *offset, relpos.z, true, true, table_size).z; color = (1.0f - fac)*color + fac*make_float3(r, g, b); stack_store_float3(stack, out_offset, color); @@ -121,11 +121,11 @@ ccl_device void svm_node_vector_curves(KernelGlobals *kg, ShaderData *sd, float const float min_x = __int_as_float(node.z), max_x = __int_as_float(node.w); const float range_x = max_x - min_x; - color = (color - make_float3(min_x, min_x, min_x)) / range_x; + const float3 relpos = (color - make_float3(min_x, min_x, min_x)) / range_x; - float r = rgb_ramp_lookup(kg, *offset, color.x, true, true, table_size).x; - float g = rgb_ramp_lookup(kg, *offset, color.y, true, true, table_size).y; - float b = rgb_ramp_lookup(kg, *offset, color.z, true, true, table_size).z; + float r = rgb_ramp_lookup(kg, *offset, relpos.x, true, true, table_size).x; + float g = rgb_ramp_lookup(kg, *offset, relpos.y, true, true, table_size).y; + float b = rgb_ramp_lookup(kg, *offset, relpos.z, true, true, table_size).z; color = (1.0f - fac)*color + fac*make_float3(r, g, b); stack_store_float3(stack, out_offset, color); -- cgit v1.2.3