Cycles: Support proper visibility check in single volume intersection step for QBVH
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 25 Aug 2016 09:13:35 +0000 (11:13 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 25 Aug 2016 09:13:35 +0000 (11:13 +0200)
intern/cycles/kernel/bvh/qbvh_volume.h

index b4f334eb8426d3fa632cc92d47e75cb12e8b45bf..847a11d8ad4b740443895146b5d7ef99f6791d1b 100644 (file)
@@ -236,6 +236,14 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
                        /* If node is leaf, fetch triangle list. */
                        if(node_addr < 0) {
                                float4 leaf = kernel_tex_fetch(__bvh_leaf_nodes, (-node_addr-1));
+
+                               if((__float_as_uint(leaf.z) & visibility) == 0) {
+                                       /* Pop. */
+                                       node_addr = traversal_stack[stack_ptr].addr;
+                                       --stack_ptr;
+                                       continue;
+                               }
+
                                int prim_addr = __float_as_int(leaf.x);
 
 #if BVH_FEATURE(BVH_INSTANCING)