From db98d9816cce0df2f2844981575ffe6b248e3bd3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 30 May 2023 14:23:06 +0200 Subject: [PATCH] Fix #108342: Regression: Cycles: Light group does not work A couple of mistakes since the light linking commit: - The +1 got missed in some of the refactors in the branch - The order of arguments to the shadow path split was wrong Pull Request: https://projects.blender.org/blender/blender/pulls/108420 --- intern/cycles/kernel/integrator/shade_dedicated_light.h | 2 +- intern/cycles/kernel/integrator/shade_surface.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intern/cycles/kernel/integrator/shade_dedicated_light.h b/intern/cycles/kernel/integrator/shade_dedicated_light.h index 394d660a7ff..4b55b9bb013 100644 --- a/intern/cycles/kernel/integrator/shade_dedicated_light.h +++ b/intern/cycles/kernel/integrator/shade_dedicated_light.h @@ -218,7 +218,7 @@ ccl_device void shadow_linking_shade(KernelGlobals kg, /* Branch off shadow kernel. */ IntegratorShadowState shadow_state = integrate_direct_light_shadow_init_common( - kg, state, &ray, bsdf_spectrum, 0, light_group); + kg, state, &ray, bsdf_spectrum, light_group, 0); /* The light is accumulated from the shade_surface kernel, which will make the clamping decision * based on the actual value of the bounce. For the dedicated shadow ray we want to follow the diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h index 7da942dcbec..5bcdc854b11 100644 --- a/intern/cycles/kernel/integrator/shade_surface.h +++ b/intern/cycles/kernel/integrator/shade_surface.h @@ -222,7 +222,7 @@ integrate_direct_light_shadow_init_common(KernelGlobals kg, } /* Write Light-group, +1 as light-group is int but we need to encode into a uint8_t. */ - INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, lightgroup) = light_group; + INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, lightgroup) = light_group + 1; #ifdef __PATH_GUIDING__ INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, unlit_throughput) = unlit_throughput; @@ -351,7 +351,7 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg, const int light_group = ls.type != LIGHT_BACKGROUND ? ls.group : kernel_data.background.lightgroup; IntegratorShadowState shadow_state = integrate_direct_light_shadow_init_common( - kg, state, &ray, bsdf_eval_sum(&bsdf_eval), mnee_vertex_count, light_group); + kg, state, &ray, bsdf_eval_sum(&bsdf_eval), light_group, mnee_vertex_count); if (is_transmission) { #ifdef __VOLUME__