Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/integrator/integrator_shade_shadow.h
| Show All 17 Lines | |||||
| #include "kernel/integrator/integrator_shade_volume.h" | #include "kernel/integrator/integrator_shade_volume.h" | ||||
| #include "kernel/integrator/integrator_volume_stack.h" | #include "kernel/integrator/integrator_volume_stack.h" | ||||
| #include "kernel/kernel_shader.h" | #include "kernel/kernel_shader.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ccl_device_inline bool shadow_intersections_has_remaining(const int num_hits) | ccl_device_inline bool shadow_intersections_has_remaining(const uint num_hits) | ||||
| { | { | ||||
| return num_hits >= INTEGRATOR_SHADOW_ISECT_SIZE; | return num_hits >= INTEGRATOR_SHADOW_ISECT_SIZE; | ||||
| } | } | ||||
| #ifdef __TRANSPARENT_SHADOWS__ | #ifdef __TRANSPARENT_SHADOWS__ | ||||
| ccl_device_inline float3 integrate_transparent_surface_shadow(KernelGlobals kg, | ccl_device_inline float3 integrate_transparent_surface_shadow(KernelGlobals kg, | ||||
| IntegratorShadowState state, | IntegratorShadowState state, | ||||
| const int hit) | const int hit) | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | const float step_size = volume_stack_step_size( | ||||
| kg, [=](const int i) { return integrator_state_read_shadow_volume_stack(state, i); }); | kg, [=](const int i) { return integrator_state_read_shadow_volume_stack(state, i); }); | ||||
| volume_shadow_heterogeneous(kg, state, &ray, shadow_sd, throughput, step_size); | volume_shadow_heterogeneous(kg, state, &ray, shadow_sd, throughput, step_size); | ||||
| } | } | ||||
| # endif | # endif | ||||
| ccl_device_inline bool integrate_transparent_shadow(KernelGlobals kg, | ccl_device_inline bool integrate_transparent_shadow(KernelGlobals kg, | ||||
| IntegratorShadowState state, | IntegratorShadowState state, | ||||
| const int num_hits) | const uint num_hits) | ||||
| { | { | ||||
| /* Accumulate shadow for transparent surfaces. */ | /* Accumulate shadow for transparent surfaces. */ | ||||
| const int num_recorded_hits = min(num_hits, INTEGRATOR_SHADOW_ISECT_SIZE); | const uint num_recorded_hits = min(num_hits, INTEGRATOR_SHADOW_ISECT_SIZE); | ||||
| for (int hit = 0; hit < num_recorded_hits + 1; hit++) { | for (uint hit = 0; hit < num_recorded_hits + 1; hit++) { | ||||
| /* Volume shaders. */ | /* Volume shaders. */ | ||||
| if (hit < num_recorded_hits || !shadow_intersections_has_remaining(num_hits)) { | if (hit < num_recorded_hits || !shadow_intersections_has_remaining(num_hits)) { | ||||
| # ifdef __VOLUME__ | # ifdef __VOLUME__ | ||||
| if (!integrator_state_shadow_volume_stack_is_empty(kg, state)) { | if (!integrator_state_shadow_volume_stack_is_empty(kg, state)) { | ||||
| float3 throughput = INTEGRATOR_STATE(state, shadow_path, throughput); | float3 throughput = INTEGRATOR_STATE(state, shadow_path, throughput); | ||||
| integrate_transparent_volume_shadow(kg, state, hit, num_recorded_hits, &throughput); | integrate_transparent_volume_shadow(kg, state, hit, num_recorded_hits, &throughput); | ||||
| if (is_zero(throughput)) { | if (is_zero(throughput)) { | ||||
| return true; | return true; | ||||
| Show All 35 Lines | |||||
| } | } | ||||
| #endif /* __TRANSPARENT_SHADOWS__ */ | #endif /* __TRANSPARENT_SHADOWS__ */ | ||||
| ccl_device void integrator_shade_shadow(KernelGlobals kg, | ccl_device void integrator_shade_shadow(KernelGlobals kg, | ||||
| IntegratorShadowState state, | IntegratorShadowState state, | ||||
| ccl_global float *ccl_restrict render_buffer) | ccl_global float *ccl_restrict render_buffer) | ||||
| { | { | ||||
| PROFILING_INIT(kg, PROFILING_SHADE_SHADOW_SETUP); | PROFILING_INIT(kg, PROFILING_SHADE_SHADOW_SETUP); | ||||
| const int num_hits = INTEGRATOR_STATE(state, shadow_path, num_hits); | const uint num_hits = INTEGRATOR_STATE(state, shadow_path, num_hits); | ||||
| #ifdef __TRANSPARENT_SHADOWS__ | #ifdef __TRANSPARENT_SHADOWS__ | ||||
| /* Evaluate transparent shadows. */ | /* Evaluate transparent shadows. */ | ||||
| const bool opaque = integrate_transparent_shadow(kg, state, num_hits); | const bool opaque = integrate_transparent_shadow(kg, state, num_hits); | ||||
| if (opaque) { | if (opaque) { | ||||
| INTEGRATOR_SHADOW_PATH_TERMINATE(DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW); | INTEGRATOR_SHADOW_PATH_TERMINATE(DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW); | ||||
| return; | return; | ||||
| } | } | ||||
| Show All 16 Lines | |||||