Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_shadow.h
| Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | ccl_device bool shadow_blocked_opaque(KernelGlobals *kg, | ||||
| const uint visibility, | const uint visibility, | ||||
| Ray *ray, | Ray *ray, | ||||
| Intersection *isect, | Intersection *isect, | ||||
| float3 *shadow) | float3 *shadow) | ||||
| { | { | ||||
| const bool blocked = scene_intersect(kg, | const bool blocked = scene_intersect(kg, | ||||
| *ray, | *ray, | ||||
| visibility & PATH_RAY_SHADOW_OPAQUE, | visibility & PATH_RAY_SHADOW_OPAQUE, | ||||
| isect, | isect); | ||||
| NULL, | |||||
| 0.0f, 0.0f); | |||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| if(!blocked && state->volume_stack[0].shader != SHADER_NONE) { | if(!blocked && state->volume_stack[0].shader != SHADER_NONE) { | ||||
| /* Apply attenuation from current volume shader. */ | /* Apply attenuation from current volume shader. */ | ||||
| kernel_volume_shadow(kg, shadow_sd, state, ray, shadow); | kernel_volume_shadow(kg, shadow_sd, state, ray, shadow); | ||||
| } | } | ||||
| #endif | #endif | ||||
| return blocked; | return blocked; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | |||||
| # endif | # endif | ||||
| for(;;) { | for(;;) { | ||||
| if(bounce >= kernel_data.integrator.transparent_max_bounce) { | if(bounce >= kernel_data.integrator.transparent_max_bounce) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if(!scene_intersect(kg, | if(!scene_intersect(kg, | ||||
| *ray, | *ray, | ||||
| visibility & PATH_RAY_SHADOW_TRANSPARENT, | visibility & PATH_RAY_SHADOW_TRANSPARENT, | ||||
| isect, | isect)) | ||||
| NULL, | |||||
| 0.0f, 0.0f)) | |||||
| { | { | ||||
| break; | break; | ||||
| } | } | ||||
| if(!shader_transparent_shadow(kg, isect)) { | if(!shader_transparent_shadow(kg, isect)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* Attenuate the throughput. */ | /* Attenuate the throughput. */ | ||||
| if(shadow_handle_transparent_isect(kg, | if(shadow_handle_transparent_isect(kg, | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | ccl_device bool shadow_blocked_transparent_stepped( | ||||
| const uint visibility, | const uint visibility, | ||||
| Ray *ray, | Ray *ray, | ||||
| Intersection *isect, | Intersection *isect, | ||||
| float3 *shadow) | float3 *shadow) | ||||
| { | { | ||||
| bool blocked = scene_intersect(kg, | bool blocked = scene_intersect(kg, | ||||
| *ray, | *ray, | ||||
| visibility & PATH_RAY_SHADOW_OPAQUE, | visibility & PATH_RAY_SHADOW_OPAQUE, | ||||
| isect, | isect); | ||||
| NULL, | |||||
| 0.0f, 0.0f); | |||||
| bool is_transparent_isect = blocked | bool is_transparent_isect = blocked | ||||
| ? shader_transparent_shadow(kg, isect) | ? shader_transparent_shadow(kg, isect) | ||||
| : false; | : false; | ||||
| return shadow_blocked_transparent_stepped_loop(kg, | return shadow_blocked_transparent_stepped_loop(kg, | ||||
| sd, | sd, | ||||
| shadow_sd, | shadow_sd, | ||||
| state, | state, | ||||
| visibility, | visibility, | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | # ifdef __KERNEL_GPU__ | ||||
| * regressions in some files. | * regressions in some files. | ||||
| * | * | ||||
| * TODO(sergey): Check why using record-all behavior causes slowdown in such | * TODO(sergey): Check why using record-all behavior causes slowdown in such | ||||
| * cases. Could that be caused by a higher spill pressure? | * cases. Could that be caused by a higher spill pressure? | ||||
| */ | */ | ||||
| const bool blocked = scene_intersect(kg, | const bool blocked = scene_intersect(kg, | ||||
| *ray, | *ray, | ||||
| visibility & PATH_RAY_SHADOW_OPAQUE, | visibility & PATH_RAY_SHADOW_OPAQUE, | ||||
| &isect, | &isect); | ||||
| NULL, | |||||
| 0.0f, 0.0f); | |||||
| const bool is_transparent_isect = blocked | const bool is_transparent_isect = blocked | ||||
| ? shader_transparent_shadow(kg, &isect) | ? shader_transparent_shadow(kg, &isect) | ||||
| : false; | : false; | ||||
| if(!blocked || !is_transparent_isect || | if(!blocked || !is_transparent_isect || | ||||
| max_hits + 1 >= SHADOW_STACK_MAX_HITS) | max_hits + 1 >= SHADOW_STACK_MAX_HITS) | ||||
| { | { | ||||
| return shadow_blocked_transparent_stepped_loop(kg, | return shadow_blocked_transparent_stepped_loop(kg, | ||||
| sd, | sd, | ||||
| Show All 35 Lines | |||||