diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-11-04 21:57:15 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-11-04 21:57:15 +0300 |
commit | 1073c6ae8e2337ef95eca69b201ddfca44db8415 (patch) | |
tree | 57c08428f862ed01a9006330d4ce53e6c6144734 /intern | |
parent | 4a9b912b968175edecd1fc374fe1903e1757b3a1 (diff) |
Cycles: Don't check shader for volume when checking if camera is inside volume
Intersection code already ignores objects without volume closure so checking it
afterwards is not needed.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/kernel_volume.h | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h index ce20f20e75a..cba95abacf6 100644 --- a/intern/cycles/kernel/kernel_volume.h +++ b/intern/cycles/kernel/kernel_volume.h @@ -992,31 +992,29 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg, ShaderData sd; shader_setup_from_ray(kg, &sd, &isect, &volume_ray, 0, 0); - if(sd.flag & SD_HAS_VOLUME) { - if(sd.flag & SD_BACKFACING) { - /* If ray exited the volume and never entered to that volume - * it means that camera is inside such a volume. - */ - bool is_enclosed = false; - for(int i = 0; i < enclosed_index; ++i) { - if(enclosed_volumes[i] == sd.object) { - is_enclosed = true; - break; - } - } - if(is_enclosed == false) { - stack[stack_index].object = sd.object; - stack[stack_index].shader = sd.shader; - ++stack_index; + if(sd.flag & SD_BACKFACING) { + /* If ray exited the volume and never entered to that volume + * it means that camera is inside such a volume. + */ + bool is_enclosed = false; + for(int i = 0; i < enclosed_index; ++i) { + if(enclosed_volumes[i] == sd.object) { + is_enclosed = true; + break; } } - else { - /* If ray from camera enters the volume, this volume shouldn't - * be added to the stak on exit. - */ - enclosed_volumes[enclosed_index++] = sd.object; + if(is_enclosed == false) { + stack[stack_index].object = sd.object; + stack[stack_index].shader = sd.shader; + ++stack_index; } } + else { + /* If ray from camera enters the volume, this volume shouldn't + * be added to the stak on exit. + */ + enclosed_volumes[enclosed_index++] = sd.object; + } /* Move ray forward. */ volume_ray.P = ray_offset(sd.P, -sd.Ng); |