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.
This commit is contained in:
Sergey Sharybin
2016-07-14 11:08:24 +02:00
parent 103a515043
commit 3637cbbcf8
5 changed files with 12 additions and 7 deletions

View File

@@ -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) {