diff options
author | Andrii Symkin <pembem22> | 2022-07-29 14:41:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-09 17:49:34 +0300 |
commit | d832d993c5b47b0de7ca24914ad9c064607830c7 (patch) | |
tree | 889b7cd9f135a40cbaccdb4537c8de1faa1c562f /intern/cycles/kernel/bake | |
parent | 7921faa6519b9eb9062269b5d9c003c64ead2b8b (diff) |
Cycles: add new Spectrum and PackedSpectrum types
These replace float3 and packed_float3 in various places in the kernel where a
spectral color representation will be used in the future. That representation
will require more than 3 channels and conversion to from/RGB. The kernel code
was refactored to remove the assumption that Spectrum and RGB colors are the
same thing.
There are no functional changes, Spectrum is still a float3 and the conversion
functions are no-ops.
Differential Revision: https://developer.blender.org/D15535
Diffstat (limited to 'intern/cycles/kernel/bake')
-rw-r--r-- | intern/cycles/kernel/bake/bake.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/intern/cycles/kernel/bake/bake.h b/intern/cycles/kernel/bake/bake.h index ec87990b699..9d53d71b431 100644 --- a/intern/cycles/kernel/bake/bake.h +++ b/intern/cycles/kernel/bake/bake.h @@ -8,6 +8,8 @@ #include "kernel/geom/geom.h" +#include "kernel/util/color.h" + CCL_NAMESPACE_BEGIN ccl_device void kernel_displace_evaluate(KernelGlobals kg, @@ -65,7 +67,7 @@ ccl_device void kernel_background_evaluate(KernelGlobals kg, shader_eval_surface<KERNEL_FEATURE_NODE_MASK_SURFACE_LIGHT & ~(KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_NODE_LIGHT_PATH)>( kg, INTEGRATOR_STATE_NULL, &sd, NULL, path_flag); - float3 color = shader_background_eval(&sd); + Spectrum color = shader_background_eval(&sd); #ifdef __KERNEL_DEBUG_NAN__ if (!isfinite_safe(color)) { @@ -76,10 +78,12 @@ ccl_device void kernel_background_evaluate(KernelGlobals kg, /* Ensure finite color, avoiding possible numerical instabilities in the path tracing kernels. */ color = ensure_finite(color); + float3 color_rgb = spectrum_to_rgb(color); + /* Write output. */ - output[offset * 3 + 0] += color.x; - output[offset * 3 + 1] += color.y; - output[offset * 3 + 2] += color.z; + output[offset * 3 + 0] += color_rgb.x; + output[offset * 3 + 1] += color_rgb.y; + output[offset * 3 + 2] += color_rgb.z; } ccl_device void kernel_curve_shadow_transparency_evaluate( |