diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2016-06-04 22:54:19 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2016-06-04 22:54:19 +0300 |
commit | 1e0c4acb29d3e3f78bbe93a413f73762cec3188f (patch) | |
tree | b06c44e34a590e3662312313aae8ed01313ba99e /intern/cycles/kernel/kernel_accumulate.h | |
parent | 5f97b51d15cd9e5a1ddaa244ba73dba3d89beb16 (diff) |
Cycles: Separate the render result for selective denoising
This commit finally implements the selective denoising pass writing.
With this commit, the denoising feature passes and therefore the changes to the
regular Cycles kernels should be finished.
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r-- | intern/cycles/kernel/kernel_accumulate.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h index 5f5a3609ded..d529ac17982 100644 --- a/intern/cycles/kernel/kernel_accumulate.h +++ b/intern/cycles/kernel/kernel_accumulate.h @@ -454,6 +454,29 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg, PathRadi return L_sum; } +ccl_device_inline void path_radiance_split_denoising(KernelGlobals *kg, PathRadiance *L, float3 *noisy, float3 *clean) +{ +#ifdef __PASSES__ + kernel_assert(L->use_light_pass); + + *clean = L->emission + L->background; + *noisy = L->direct_scatter + L->indirect_scatter; + + /* TODO Clean this up */ + *((kernel_data.film.denoise_flag & DENOISE_DIFFUSE_DIR)? noisy: clean) += L->direct_diffuse; + *((kernel_data.film.denoise_flag & DENOISE_DIFFUSE_IND)? noisy: clean) += L->indirect_diffuse; + *((kernel_data.film.denoise_flag & DENOISE_GLOSSY_DIR)? noisy: clean) += L->direct_glossy; + *((kernel_data.film.denoise_flag & DENOISE_GLOSSY_IND)? noisy: clean) += L->indirect_glossy; + *((kernel_data.film.denoise_flag & DENOISE_TRANSMISSION_DIR)? noisy: clean) += L->direct_transmission; + *((kernel_data.film.denoise_flag & DENOISE_TRANSMISSION_IND)? noisy: clean) += L->indirect_transmission; + *((kernel_data.film.denoise_flag & DENOISE_SUBSURFACE_DIR)? noisy: clean) += L->direct_subsurface; + *((kernel_data.film.denoise_flag & DENOISE_SUBSURFACE_IND)? noisy: clean) += L->indirect_subsurface; +#else + *noisy = *L; + *clean = make_float3(0.0f, 0.0f, 0.0f); +#endif +} + ccl_device_inline void path_radiance_accum_sample(PathRadiance *L, PathRadiance *L_sample, int num_samples) { float fac = 1.0f/num_samples; |