diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-14 12:08:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-14 12:26:20 +0300 |
commit | 3637cbbcf8d1b65318aabc11f72e9241b6992812 (patch) | |
tree | 282dad1a0962977bc9200b9c4678218b8bda43fb /intern/cycles/kernel/kernel_shadow.h | |
parent | 103a51504372129975e60f57fbf3c983527037eb (diff) |
Cycles: Fix wrong termination criteria in intersect_all functions
It was possible to miss bounces termination criteria in this functions,
mainly when max_hits was set to 0.
Made the check more robust in traversal functions (which should not
affect performance, it's an operation of same complexity AFAIK).
Also avoid doing ray-scene intersection from shadow_blocked when
limit of transparent bounces was already reached.
Diffstat (limited to 'intern/cycles/kernel/kernel_shadow.h')
-rw-r--r-- | intern/cycles/kernel/kernel_shadow.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index db2fc84834a..d1576754d2e 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -75,7 +75,12 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, ShaderData *shadow_sd, } uint num_hits; - blocked = scene_intersect_shadow_all(kg, ray, hits, max_hits, &num_hits); + if(max_hits == 0) { + blocked = true; + num_hits = 0; + } else { + blocked = scene_intersect_shadow_all(kg, ray, hits, max_hits, &num_hits); + } /* if no opaque surface found but we did find transparent hits, shade them */ if(!blocked && num_hits > 0) { |