diff options
Diffstat (limited to 'intern/cycles/kernel/svm/svm_wavelength.h')
-rw-r--r-- | intern/cycles/kernel/svm/svm_wavelength.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/intern/cycles/kernel/svm/svm_wavelength.h b/intern/cycles/kernel/svm/svm_wavelength.h index 62e026278ac..e935fd20690 100644 --- a/intern/cycles/kernel/svm/svm_wavelength.h +++ b/intern/cycles/kernel/svm/svm_wavelength.h @@ -5,7 +5,7 @@ * All Rights Reserved. * * Modifications Copyright 2013, Blender Foundation. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -71,12 +71,12 @@ ccl_static_constant float cie_colour_match[81][3] = { }; ccl_device void svm_node_wavelength(KernelGlobals *kg, ShaderData *sd, float *stack, uint wavelength, uint color_out) -{ +{ float lambda_nm = stack_load_float(stack, wavelength); float ii = (lambda_nm-380.0f) * (1.0f/5.0f); // scaled 0..80 int i = float_to_int(ii); float3 color; - + if(i < 0 || i >= 80) { color = make_float3(0.0f, 0.0f, 0.0f); } @@ -85,10 +85,10 @@ ccl_device void svm_node_wavelength(KernelGlobals *kg, ShaderData *sd, float *st ccl_constant float *c = cie_colour_match[i]; color = interp(make_float3(c[0], c[1], c[2]), make_float3(c[3], c[4], c[5]), ii); } - + color = xyz_to_rgb(kg, color); color *= 1.0f/2.52f; // Empirical scale from lg to make all comps <= 1 - + /* Clamp to zero if values are smaller */ color = max(color, make_float3(0.0f, 0.0f, 0.0f)); @@ -96,4 +96,3 @@ ccl_device void svm_node_wavelength(KernelGlobals *kg, ShaderData *sd, float *st } CCL_NAMESPACE_END - |