16#ifdef __SHADOW_LINKING__
23 const uint32_t path_flag)
37 const uint32_t path_flag,
40 const float light_sample_pdf,
45 kg,
state, path_visibility, path_flag, object_id, light_sample_pdf);
49 kg,
state, path_visibility, path_flag, object_id, light_sample_pdf,
P);
55ccl_device void shadow_linking_setup_ray_from_intersection(
72 ray->self.light_object = isect->object;
73 ray->self.light_prim = isect->prim;
88 const LightEval light_eval = shadow_linking_light_eval_from_intersection(
89 kg, isect, ray,
N, path_flag);
102 mis_weight = shadow_linking_light_sample_mis_weight(
103 kg,
state, path_visibility, path_flag, isect.prim, isect.object, light_eval.
pdf, ray.P);
105 light_weight = light_eval.
eval_fac * mis_weight *
108 shader_id = klight->shader_id;
135 kg,
state, path_visibility, path_flag, emission_sd);
139 shader_id = emission_sd->shader;
154 float light_weight = 0.0f;
155 float mis_weight = 1.0f;
160 if (!shadow_linking_shade_light(
161 kg,
state, ray, isect, light_weight, mis_weight, light_group, shader_id))
167 if (!shadow_linking_shade_surface_emission(
168 kg,
state, light_weight, mis_weight, light_group, shader_id))
177 kg, shader_id, isect.prim, isect.type ==
PRIMITIVE_LAMP, light_eval);
178 light_eval *= light_weight;
184 shadow_linking_setup_ray_from_intersection(
state, &ray, &isect);
188 kg,
state, &ray, light_eval, light_group, 0, is_constant_light_shader);
190 if (!is_constant_light_shader) {
191 integrator_state_write_shadow_light_isect(shadow_state, &isect);
198 shadow_state, shadow_path, bounce) =
INTEGRATOR_STATE(shadow_state, shadow_path, bounce) - 1;
211 state, path, pass_glossy_weight);
215 state, path, visibility);
219# if defined(__PATH_GUIDING__)
221 INTEGRATOR_STATE(shadow_state, shadow_path, guiding_light_linking_mis_weight) = mis_weight;
234#ifdef __SHADOW_LINKING__
235 shadow_linking_shade(kg,
state);
239 shadow_linking_restore_last_primitives(
state);
241 kernel_assert(!
"integrator_intersect_dedicated_light is not supposed to be scheduled");
ccl_device_inline bool is_light_shader_visible_to_path(const int shader, const PathRayVisibility path_visibility, const uint32_t path_flag)
ccl_device_inline float light_sample_mis_weight_forward_lamp(KernelGlobals kg, IntegratorState state, const PathRayVisibility path_visibility, const uint32_t path_flag, const int object_id, const float light_sample_pdf, const float3 P)
CCL_NAMESPACE_BEGIN ccl_device bool light_sample_shader_eval_nee_constant(KernelGlobals kg, const int shader_id, const int prim, const bool is_light, ccl_private Spectrum &eval)
ccl_device_inline float light_sample_mis_weight_forward_surface(KernelGlobals kg, IntegratorState state, const PathRayVisibility path_visibility, const uint32_t path_flag, const ccl_private ShaderData *sd)
ccl_device_inline float light_sample_mis_weight_forward_distant(KernelGlobals kg, IntegratorState state, const PathRayVisibility path_visibility, const uint32_t path_flag, const int object_id, const float light_sample_pdf)
#define kernel_assert(cond)
#define ccl_optional_struct_init
#define kernel_data_fetch(name, index)
#define AS_SHADER_DATA(shader_data_tiny_storage)
#define ccl_device_inline
#define KERNEL_FEATURE_LIGHT_PASSES
#define CCL_NAMESPACE_END
ccl_device_inline int object_lightgroup(KernelGlobals kg, const int object)
ccl_device LightEval light_eval_from_intersection(KernelGlobals kg, const ccl_private Intersection *ccl_restrict isect, const float3 ray_P, const float3 ray_D, const float3 N, const uint32_t path_flag)
uint32_t PathRayVisibility
ShaderData ShaderDataTinyStorage
@ PATH_RAY_SHADOW_FOR_LIGHT_LINKING
#define PROFILING_INIT(kg, event)
@ PROFILING_SHADE_DEDICATED_LIGHT
CCL_NAMESPACE_BEGIN ccl_device void integrator_shade_dedicated_light(KernelGlobals kg, IntegratorState state, ccl_global float *ccl_restrict)
ccl_device_inline IntegratorShadowState integrate_direct_light_shadow_init_common(KernelGlobals kg, IntegratorState state, const ccl_private Ray *ccl_restrict ray, const Spectrum bsdf_spectrum, const int light_group, const int mnee_vertex_count, const bool constant_light_shader)
ccl_device_forceinline void integrator_shade_surface_next_kernel(IntegratorState state)
CCL_NAMESPACE_BEGIN ccl_device_forceinline void integrate_surface_shader_setup(KernelGlobals kg, ConstIntegratorState state, ccl_private ShaderData *sd)
IntegratorShadowStateCPU * IntegratorShadowState
#define INTEGRATOR_STATE_WRITE(state, nested_struct, member)
#define INTEGRATOR_STATE(state, nested_struct, member)
IntegratorStateCPU * IntegratorState
ccl_device_forceinline void integrator_state_read_ray(ConstIntegratorState state, ccl_private Ray *ccl_restrict ray)
ccl_device_forceinline void integrator_state_read_isect(ConstIntegratorState state, ccl_private Intersection *ccl_restrict isect)
ccl_device LightEval sun_light_eval_from_intersection(const ccl_global KernelLight *klight, const float3 ray_D)