Cycles: Yet another fix for camera in volume

Was an embarrassing glitch in original optimization policy,
the for-loops can't be de-duplicated here.
This commit is contained in:
Sergey Sharybin 2016-04-14 17:20:17 +02:00
parent 78c3a5d00f
commit b8892cac19
1 changed files with 4 additions and 3 deletions

View File

@ -1013,14 +1013,15 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg,
shader_setup_from_ray(kg, &sd, isect, &volume_ray);
if(sd.flag & SD_BACKFACING) {
bool need_add = true;
for(int i = 0; i < stack_index; ++i) {
for(int i = 0; i < enclosed_index && need_add; ++i) {
/* If ray exited the volume and never entered to that volume
* it means that camera is inside such a volume.
*/
if(i < enclosed_index && enclosed_volumes[i] == sd.object) {
if(enclosed_volumes[i] == sd.object) {
need_add = false;
break;
}
}
for(int i = 0; i < stack_index && need_add; ++i) {
/* Don't add intersections twice. */
if(stack[i].object == sd.object) {
need_add = false;