Commit: 49f5a0e89647966a73ea20569b1a2d3647ab5aa5 Author: Sergey Sharybin Date: Tue Jul 20 17:18:02 2021 +0200 Branches: cycles-x https://developer.blender.org/rB49f5a0e89647966a73ea20569b1a2d3647ab5aa5
Fix background "leaking" into combined in Cycles X Was happening when transparent film is enabled, and Environment pass enabled. Test file: F10230084 Differential Revision: https://developer.blender.org/D11976 =================================================================== M intern/cycles/kernel/integrator/integrator_shade_background.h M intern/cycles/kernel/kernel_accumulate.h =================================================================== diff --git a/intern/cycles/kernel/integrator/integrator_shade_background.h b/intern/cycles/kernel/integrator/integrator_shade_background.h index 5181a5c42b4..b526ef2ec08 100644 --- a/intern/cycles/kernel/integrator/integrator_shade_background.h +++ b/intern/cycles/kernel/integrator/integrator_shade_background.h @@ -97,8 +97,11 @@ ccl_device_inline void integrate_background(INTEGRATOR_STATE_ARGS, bool eval_background = true; float transparent = 0.0f; - if (kernel_data.background.transparent && - (INTEGRATOR_STATE(path, flag) & PATH_RAY_TRANSPARENT_BACKGROUND)) { + const bool is_transparent_background_ray = kernel_data.background.transparent && + (INTEGRATOR_STATE(path, flag) & + PATH_RAY_TRANSPARENT_BACKGROUND); + + if (is_transparent_background_ray) { transparent = average(INTEGRATOR_STATE(path, throughput)); #ifdef __PASSES__ @@ -120,7 +123,8 @@ ccl_device_inline void integrate_background(INTEGRATOR_STATE_ARGS, } /* Write to render buffer. */ - kernel_accum_background(INTEGRATOR_STATE_PASS, L, transparent, render_buffer); + kernel_accum_background( + INTEGRATOR_STATE_PASS, L, transparent, is_transparent_background_ray, render_buffer); } ccl_device_inline void integrate_distant_lights(INTEGRATOR_STATE_ARGS, diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h index 63fdf0dc912..6e819dace31 100644 --- a/intern/cycles/kernel/kernel_accumulate.h +++ b/intern/cycles/kernel/kernel_accumulate.h @@ -473,6 +473,7 @@ ccl_device_inline void kernel_accum_transparent(INTEGRATOR_STATE_CONST_ARGS, ccl_device_inline void kernel_accum_background(INTEGRATOR_STATE_CONST_ARGS, const float3 L, const float transparent, + const bool is_transparent_background_ray, ccl_global float *ccl_restrict render_buffer) { float3 contribution = INTEGRATOR_STATE(path, throughput) * L; @@ -481,7 +482,13 @@ ccl_device_inline void kernel_accum_background(INTEGRATOR_STATE_CONST_ARGS, ccl_global float *buffer = kernel_accum_pixel_render_buffer(INTEGRATOR_STATE_PASS, render_buffer); - kernel_accum_combined_transparent_pass(INTEGRATOR_STATE_PASS, contribution, transparent, buffer); + if (is_transparent_background_ray) { + kernel_accum_transparent(INTEGRATOR_STATE_PASS, transparent, render_buffer); + } + else { + kernel_accum_combined_transparent_pass( + INTEGRATOR_STATE_PASS, contribution, transparent, buffer); + } kernel_accum_emission_or_background_pass( INTEGRATOR_STATE_PASS, contribution, buffer, kernel_data.film.pass_background); } _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
