35#ifdef __LIGHT_LINKING__
48#ifdef __LIGHT_LINKING__
60 const int object_receiver,
61 const int object_emitter)
63#ifdef __LIGHT_LINKING__
79 const int object_receiver,
80 const int object_emitter)
82#ifdef __LIGHT_LINKING__
106template<
bool in_volume_segment>
112 const int shader_flags,
113 const uint32_t path_flag,
125 ls->shader = klight->shader_id;
126 ls->object = klight->object_id;
177 return in_volume_segment || (ls->pdf > 0.0f);
182template<
bool in_volume_segment>
188 const int object_receiver,
189 const int shader_flags,
191 const uint32_t path_flag,
205 prim = kemitter->light.id;
206 shader_flag = kemitter->shader_flag;
207 object_id = (prim >= 0) ? ls->object : kemitter->object_id;
213 light_distribution, ls->emitter_id);
214 prim = kdistribution->prim;
215 object_id = kdistribution->object_id;
216 shader_flag = kdistribution->shader_flag;
236 ls->shader |= shader_flag;
239 const int light = ~prim;
250 ls->pdf *= ls->pdf_selection;
251 return in_volume_segment || (ls->pdf > 0.0f);
258template<
bool is_main_path>
263 const int last_object,
265 const uint32_t path_flag,
266 const uint8_t path_mnee,
267 const int receiver_forward,
271#ifdef __SHADOW_LINKING__
275 for (
int lamp = 0; lamp <
kernel_data.integrator.num_lights; lamp++) {
277 const int object = klight->object_id;
304#ifdef __SHADOW_LINKING__
311 if (is_indirect_ray &&
323#ifdef __LIGHT_LINKING__
351 if (is_main_path || ray->tmax !=
FLT_MAX) {
363 if (last_prim == lamp && last_object ==
object && last_type ==
PRIMITIVE_LAMP) {
369#ifdef __SHADOW_LINKING__
391 isect->object = object;
404 const int last_object,
406 const uint32_t path_flag)
435 const int last_object,
437 const uint32_t path_flag,
438 const int receiver_forward,
462 const uint32_t path_flag,
468 ls->shader = klight->shader_id;
469 ls->object = isect->object;
470 ls->prim = isect->prim;
472 ls->P = ray_P + ray_D * ls->t;
492 kernel_assert(!
"Invalid lamp type in light_sample_from_intersection");
ccl_device_inline bool area_light_sample(const ccl_global KernelLight *klight, const float2 rand, const float3 P, ccl_private LightSample *ls)
ccl_device_inline bool area_light_sample_from_intersection(const ccl_global KernelLight *klight, const ccl_private Intersection *ccl_restrict isect, const float3 ray_P, const float3 ray_D, ccl_private LightSample *ccl_restrict ls)
ccl_device_inline bool area_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t, ccl_private float *u, ccl_private float *v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned long long int uint64_t
#define kernel_assert(cond)
#define ccl_device_forceinline
#define kernel_data_fetch(name, index)
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define KERNEL_FEATURE_SHADOW_LINKING
#define LIGHT_LINK_MASK_ALL
#define KERNEL_FEATURE_LIGHT_LINKING
#define ccl_device_noinline
#define CCL_NAMESPACE_END
ccl_device_inline bool distant_light_sample(KernelGlobals kg, const ccl_global KernelLight *klight, const float2 rand, ccl_private LightSample *ls)
ccl_device bool distant_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t, ccl_private float *u, ccl_private float *v)
ccl_device_inline int object_lightgroup(KernelGlobals kg, const int object)
ccl_device_inline float3 background_light_sample(KernelGlobals kg, const float3 P, float2 rand, ccl_private float *pdf)
ccl_device bool light_sample_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, ccl_private LightSample *ccl_restrict ls)
ccl_device_inline bool light_link_object_match(KernelGlobals kg, const int object_receiver, const int object_emitter)
ccl_device_forceinline int lights_intersect_impl(KernelGlobals kg, const ccl_private Ray *ccl_restrict ray, ccl_private Intersection *ccl_restrict isect, const int last_prim, const int last_object, const int last_type, const uint32_t path_flag, const uint8_t path_mnee, const int receiver_forward, ccl_private uint *lcg_state, int num_hits)
CCL_NAMESPACE_BEGIN ccl_device_inline bool light_select_reached_max_bounces(KernelGlobals kg, const int index, const int bounce)
ccl_device int lights_intersect_shadow_linked(KernelGlobals kg, const ccl_private Ray *ccl_restrict ray, ccl_private Intersection *ccl_restrict isect, const int last_prim, const int last_object, const int last_type, const uint32_t path_flag, const int receiver_forward, ccl_private uint *lcg_state, const int num_hits)
ccl_device_inline bool light_sample(KernelGlobals kg, const int lamp, const float2 rand, const float3 P, const float3 N, const int shader_flags, const uint32_t path_flag, ccl_private LightSample *ls)
ccl_device_inline bool light_link_light_match(KernelGlobals kg, const int object_receiver, const int object_emitter)
ccl_device_inline int light_link_receiver_nee(KernelGlobals kg, const ccl_private ShaderData *sd)
ccl_device_inline int light_link_receiver_forward(KernelGlobals kg, IntegratorState state)
ccl_device bool lights_intersect(KernelGlobals kg, IntegratorState state, const ccl_private Ray *ccl_restrict ray, ccl_private Intersection *ccl_restrict isect, const int last_prim, const int last_object, const int last_type, const uint32_t path_flag)
@ PATH_MNEE_CULL_LIGHT_CONNECTION
@ PATH_RAY_SHADOW_CATCHER_PASS
@ SHADER_EXCLUDE_SHADOW_CATCHER
@ SD_OBJECT_SHADOW_CATCHER
ccl_device float lcg_step_float(T rng)
CCL_NAMESPACE_BEGIN ccl_device_inline bool point_light_sample(KernelGlobals kg, const ccl_global KernelLight *klight, const float2 rand, const float3 P, const float3 N, const int shader_flags, ccl_private LightSample *ls)
ccl_device_inline bool point_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t)
ccl_device_inline bool point_light_sample_from_intersection(KernelGlobals kg, const ccl_global KernelLight *klight, const float3 ray_P, const float3 ray_D, const float3 N, const uint32_t path_flag, ccl_private LightSample *ccl_restrict ls)
ccl_device_forceinline bool triangle_light_sample(KernelGlobals kg, const int prim, const int object, const float2 rand, const float time, ccl_private LightSample *ls, const float3 P)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
ccl_device_inline bool spot_light_sample(KernelGlobals kg, const ccl_global KernelLight *klight, const float2 rand, const float3 P, const float3 N, const int shader_flags, ccl_private LightSample *ls)
ccl_device_inline bool spot_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t)
ccl_device_inline bool spot_light_sample_from_intersection(KernelGlobals kg, const ccl_global KernelLight *klight, const float3 ray_P, const float3 ray_D, const float3 N, const uint32_t path_flag, ccl_private LightSample *ccl_restrict ls)
#define INTEGRATOR_STATE(state, nested_struct, member)
IntegratorStateCPU * IntegratorState